Skip to content

Commit

Permalink
change values name to podSecurityContext
Browse files Browse the repository at this point in the history
  • Loading branch information
manherna authored and arttor committed Sep 12, 2024
1 parent 1474644 commit 3c8d2c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/processor/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ func ProcessSpec(objName string, appMeta helmify.AppMetadata, spec corev1.PodSpe
return nil, nil, err
}
if len(securityContextMap) > 0 {
err = unstructured.SetNestedField(specMap, fmt.Sprintf(`{{- toYaml .Values.%[1]s.podSecurityPolicy | nindent 8 }}`, objName), "securityContext")
err = unstructured.SetNestedField(specMap, fmt.Sprintf(`{{- toYaml .Values.%[1]s.podSecurityContext | nindent 8 }}`, objName), "securityContext")
if err != nil {
return nil, nil, err
}

err = unstructured.SetNestedField(values, securityContextMap, objName, "podSecurityPolicy")
err = unstructured.SetNestedField(values, securityContextMap, objName, "podSecurityContext")
if err != nil {
return nil, nil, fmt.Errorf("%w: unable to set deployment value field", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/processor/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ func Test_pod_Process(t *testing.T) {
"resources": map[string]interface{}{},
},
},
"securityContext": "{{- toYaml .Values.nginx.podSecurityPolicy | nindent 8 }}",
"securityContext": "{{- toYaml .Values.nginx.podSecurityContext | nindent 8 }}",
}, specMap)

assert.Equal(t, helmify.Values{
"nginx": map[string]interface{}{
"podSecurityPolicy": map[string]interface{}{
"podSecurityContext": map[string]interface{}{
"fsGroup": int64(20000),
"runAsGroup": int64(30000),
"runAsNonRoot": true,
Expand Down

0 comments on commit 3c8d2c0

Please sign in to comment.