Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package helmify for openSUSE:Factory checked in at 2023-05-01 18:51:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/helmify (Old) and /work/SRC/openSUSE:Factory/.helmify.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "helmify" Mon May 1 18:51:08 2023 rev:10 rq:1083765 version:0.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/helmify/helmify.changes 2023-04-28 16:26:12.215003219 +0200 +++ /work/SRC/openSUSE:Factory/.helmify.new.1533/helmify.changes 2023-05-01 18:51:09.513347143 +0200 @@ -1,0 +2,14 @@ +Sun Apr 30 10:52:45 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.4.3: + * Fixed the rest of the linting that went a little crazy + * Fixed indentions that went a little crazy + * Added security context processing for initContainers, refactor + to reduce code duplication + * Fixed incorrect name for the test data initContainer + * Updated to not include initContainers:null in templates if none + exist in the source manifest + * Regenerated chart examples + * This change adds support for initContainers + +------------------------------------------------------------------- Old: ---- helmify-0.4.2.obscpio New: ---- helmify-0.4.3.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ helmify.spec ++++++ --- /var/tmp/diff_new_pack.kl6yOT/_old 2023-05-01 18:51:10.229351394 +0200 +++ /var/tmp/diff_new_pack.kl6yOT/_new 2023-05-01 18:51:10.233351418 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: helmify -Version: 0.4.2 +Version: 0.4.3 Release: 0 Summary: Creates Helm chart from Kubernetes yaml License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.kl6yOT/_old 2023-05-01 18:51:10.269351631 +0200 +++ /var/tmp/diff_new_pack.kl6yOT/_new 2023-05-01 18:51:10.273351656 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/arttor/helmify/</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.4.2</param> + <param name="revision">v0.4.3</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.kl6yOT/_old 2023-05-01 18:51:10.293351774 +0200 +++ /var/tmp/diff_new_pack.kl6yOT/_new 2023-05-01 18:51:10.297351797 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/arttor/helmify/</param> - <param name="changesrevision">3e87d86d3c6468ec33150d57f6f2c37de00b86da</param></service></servicedata> + <param name="changesrevision">03f8524d60a2517902506646d07cf2acac2dfa3a</param></service></servicedata> (No newline at EOF) ++++++ helmify-0.4.2.obscpio -> helmify-0.4.3.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.2/examples/app/templates/deployment.yaml new/helmify-0.4.3/examples/app/templates/deployment.yaml --- old/helmify-0.4.2/examples/app/templates/deployment.yaml 2023-04-28 09:50:13.000000000 +0200 +++ new/helmify-0.4.3/examples/app/templates/deployment.yaml 2023-04-30 11:41:20.000000000 +0200 @@ -73,6 +73,18 @@ - containerPort: 8443 name: https resources: {} + initContainers: + - command: + - /bin/sh + - -c + - echo Initializing container... + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.myapp.initContainer.image.repository }}:{{ .Values.myapp.initContainer.image.tag + | default .Chart.AppVersion }} + name: init-container + resources: {} nodeSelector: {{- toYaml .Values.myapp.nodeSelector | nindent 8 }} securityContext: runAsNonRoot: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.2/examples/app/values.yaml new/helmify-0.4.3/examples/app/values.yaml --- old/helmify-0.4.2/examples/app/values.yaml 2023-04-28 09:50:13.000000000 +0200 +++ new/helmify-0.4.3/examples/app/values.yaml 2023-04-30 11:41:20.000000000 +0200 @@ -69,6 +69,10 @@ requests: cpu: 100m memory: 20Mi + initContainer: + image: + repository: bash + tag: latest nodeSelector: region: east type: user-node diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.2/pkg/processor/pod/pod.go new/helmify-0.4.3/pkg/processor/pod/pod.go --- old/helmify-0.4.2/pkg/processor/pod/pod.go 2023-04-28 09:50:13.000000000 +0200 +++ new/helmify-0.4.3/pkg/processor/pod/pod.go 2023-04-30 11:41:20.000000000 +0200 @@ -38,41 +38,13 @@ if err != nil { return nil, nil, fmt.Errorf("%w: unable to convert podSpec to map", err) } - containers, _, err := unstructured.NestedSlice(specMap, "containers") + + specMap, values, err = processNestedContainers(specMap, objName, values, "containers") if err != nil { return nil, nil, err } - for i := range containers { - containerName := strcase.ToLowerCamel((containers[i].(map[string]interface{})["name"]).(string)) - res, exists, err := unstructured.NestedMap(values, objName, containerName, "resources") - if err != nil { - return nil, nil, err - } - if exists && len(res) > 0 { - err = unstructured.SetNestedField(containers[i].(map[string]interface{}), fmt.Sprintf(`{{- toYaml .Values.%s.%s.resources | nindent 10 }}`, objName, containerName), "resources") - if err != nil { - return nil, nil, err - } - } - - args, exists, err := unstructured.NestedStringSlice(containers[i].(map[string]interface{}), "args") - if err != nil { - return nil, nil, err - } - if exists && len(args) > 0 { - err = unstructured.SetNestedField(containers[i].(map[string]interface{}), fmt.Sprintf(`{{- toYaml .Values.%[1]s.%[2]s.args | nindent 8 }}`, objName, containerName), "args") - if err != nil { - return nil, nil, err - } - - err = unstructured.SetNestedStringSlice(values, args, objName, containerName, "args") - if err != nil { - return nil, nil, fmt.Errorf("%w: unable to set deployment value field", err) - } - } - } - err = unstructured.SetNestedSlice(specMap, containers, "containers") + specMap, values, err = processNestedContainers(specMap, objName, values, "initContainers") if err != nil { return nil, nil, err } @@ -104,6 +76,60 @@ return specMap, values, nil } +func processNestedContainers(specMap map[string]interface{}, objName string, values map[string]interface{}, containerKey string) (map[string]interface{}, map[string]interface{}, error) { + containers, _, err := unstructured.NestedSlice(specMap, containerKey) + if err != nil { + return nil, nil, err + } + + if len(containers) > 0 { + containers, values, err = processContainers(objName, values, containerKey, containers) + if err != nil { + return nil, nil, err + } + + err = unstructured.SetNestedSlice(specMap, containers, containerKey) + if err != nil { + return nil, nil, err + } + } + + return specMap, values, nil +} + +func processContainers(objName string, values helmify.Values, containerType string, containers []interface{}) ([]interface{}, helmify.Values, error) { + for i := range containers { + containerName := strcase.ToLowerCamel((containers[i].(map[string]interface{})["name"]).(string)) + res, exists, err := unstructured.NestedMap(values, objName, containerName, "resources") + if err != nil { + return nil, nil, err + } + if exists && len(res) > 0 { + err = unstructured.SetNestedField(containers[i].(map[string]interface{}), fmt.Sprintf(`{{- toYaml .Values.%s.%s.resources | nindent 10 }}`, objName, containerName), "resources") + if err != nil { + return nil, nil, err + } + } + + args, exists, err := unstructured.NestedStringSlice(containers[i].(map[string]interface{}), "args") + if err != nil { + return nil, nil, err + } + if exists && len(args) > 0 { + err = unstructured.SetNestedField(containers[i].(map[string]interface{}), fmt.Sprintf(`{{- toYaml .Values.%[1]s.%[2]s.args | nindent 8 }}`, objName, containerName), "args") + if err != nil { + return nil, nil, err + } + + err = unstructured.SetNestedStringSlice(values, args, objName, containerName, "args") + if err != nil { + return nil, nil, fmt.Errorf("%w: unable to set deployment value field", err) + } + } + } + return containers, values, nil +} + func processPodSpec(name string, appMeta helmify.AppMetadata, pod *corev1.PodSpec) (helmify.Values, error) { values := helmify.Values{} for i, c := range pod.Containers { @@ -113,6 +139,15 @@ } pod.Containers[i] = processed } + + for i, c := range pod.InitContainers { + processed, err := processPodContainer(name, appMeta, c, &values) + if err != nil { + return nil, err + } + pod.InitContainers[i] = processed + } + for _, v := range pod.Volumes { if v.ConfigMap != nil { v.ConfigMap.Name = appMeta.TemplatedName(v.ConfigMap.Name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.2/pkg/processor/security-context/container_security_context.go new/helmify-0.4.3/pkg/processor/security-context/container_security_context.go --- old/helmify-0.4.2/pkg/processor/security-context/container_security_context.go 2023-04-28 09:50:13.000000000 +0200 +++ new/helmify-0.4.3/pkg/processor/security-context/container_security_context.go 2023-04-30 11:41:20.000000000 +0200 @@ -16,9 +16,22 @@ // ProcessContainerSecurityContext adds 'securityContext' to the podSpec in specMap, if it doesn't have one already defined. func ProcessContainerSecurityContext(nameCamel string, specMap map[string]interface{}, values *helmify.Values) error { - if _, defined := specMap["containers"]; defined { - containers, _, _ := unstructured.NestedSlice(specMap, "containers") - for _, container := range containers { + err := processSecurityContext(nameCamel, "containers", specMap, values) + if err != nil { + return err + } + + err = processSecurityContext(nameCamel, "initContainers", specMap, values) + if err != nil { + return err + } + + return nil +} + +func processSecurityContext(nameCamel string, containerType string, specMap map[string]interface{}, values *helmify.Values) error { + if containers, defined := specMap[containerType]; defined { + for _, container := range containers.([]interface{}) { castedContainer := container.(map[string]interface{}) containerName := strcase.ToLowerCamel(castedContainer["name"].(string)) if _, defined2 := castedContainer["securityContext"]; defined2 { @@ -28,7 +41,7 @@ } } } - err := unstructured.SetNestedSlice(specMap, containers, "containers") + err := unstructured.SetNestedField(specMap, containers, containerType) if err != nil { return err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.2/test_data/sample-app.yaml new/helmify-0.4.3/test_data/sample-app.yaml --- old/helmify-0.4.2/test_data/sample-app.yaml 2023-04-28 09:50:13.000000000 +0200 +++ new/helmify-0.4.3/test_data/sample-app.yaml 2023-04-30 11:41:20.000000000 +0200 @@ -15,6 +15,10 @@ labels: app: myapp spec: + initContainers: + - name: init-container + image: bash:latest + command: ["/bin/sh", "-c", "echo 'Initializing container...'"] containers: - name: app args: ++++++ helmify.obsinfo ++++++ --- /var/tmp/diff_new_pack.kl6yOT/_old 2023-05-01 18:51:10.449352700 +0200 +++ /var/tmp/diff_new_pack.kl6yOT/_new 2023-05-01 18:51:10.453352723 +0200 @@ -1,5 +1,5 @@ name: helmify -version: 0.4.2 -mtime: 1682668213 -commit: 3e87d86d3c6468ec33150d57f6f2c37de00b86da +version: 0.4.3 +mtime: 1682847680 +commit: 03f8524d60a2517902506646d07cf2acac2dfa3a ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/helmify/vendor.tar.gz /work/SRC/openSUSE:Factory/.helmify.new.1533/vendor.tar.gz differ: char 5, line 1