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-06-26 18:16:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/helmify (Old) and /work/SRC/openSUSE:Factory/.helmify.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "helmify" Mon Jun 26 18:16:08 2023 rev:11 rq:1095306 version:0.4.4 Changes: -------- --- /work/SRC/openSUSE:Factory/helmify/helmify.changes 2023-05-01 18:51:09.513347143 +0200 +++ /work/SRC/openSUSE:Factory/.helmify.new.15902/helmify.changes 2023-06-26 18:16:23.774550963 +0200 @@ -1,0 +2,14 @@ +Mon Jun 26 05:00:22 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.4.4: + * Move existing annotations to values.yaml + * Prevent empty white line before serviceaccount annotations + * Properly set serviceaccount annotation variable + * fixing cases where theres empty annotations + * adding metaopt to processobjmeta + * test_data and examples + * fixing annotations yams + * ensuring annotations are always present + * [serviceaccount] Annotations as Values Support + +------------------------------------------------------------------- Old: ---- helmify-0.4.3.obscpio New: ---- helmify-0.4.4.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ helmify.spec ++++++ --- /var/tmp/diff_new_pack.ej81lm/_old 2023-06-26 18:16:24.942556153 +0200 +++ /var/tmp/diff_new_pack.ej81lm/_new 2023-06-26 18:16:24.946556170 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: helmify -Version: 0.4.3 +Version: 0.4.4 Release: 0 Summary: Creates Helm chart from Kubernetes yaml License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ej81lm/_old 2023-06-26 18:16:24.986556347 +0200 +++ /var/tmp/diff_new_pack.ej81lm/_new 2023-06-26 18:16:24.990556366 +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.3</param> + <param name="revision">v0.4.4</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.ej81lm/_old 2023-06-26 18:16:25.014556472 +0200 +++ /var/tmp/diff_new_pack.ej81lm/_new 2023-06-26 18:16:25.018556490 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/arttor/helmify/</param> - <param name="changesrevision">03f8524d60a2517902506646d07cf2acac2dfa3a</param></service></servicedata> + <param name="changesrevision">de2e663fe7146cbb41fb2d80a610805368d5ba00</param></service></servicedata> (No newline at EOF) ++++++ helmify-0.4.3.obscpio -> helmify-0.4.4.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/examples/operator/templates/deployment.yaml new/helmify-0.4.4/examples/operator/templates/deployment.yaml --- old/helmify-0.4.3/examples/operator/templates/deployment.yaml 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/examples/operator/templates/deployment.yaml 2023-06-24 12:51:29.000000000 +0200 @@ -1,10 +1,3 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "operator.fullname" . }}-controller-manager - labels: - {{- include "operator.labels" . | nindent 4 }} ---- apiVersion: apps/v1 kind: Deployment metadata: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/examples/operator/templates/serviceaccount.yaml new/helmify-0.4.4/examples/operator/templates/serviceaccount.yaml --- old/helmify-0.4.3/examples/operator/templates/serviceaccount.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/helmify-0.4.4/examples/operator/templates/serviceaccount.yaml 2023-06-24 12:51:29.000000000 +0200 @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "operator.fullname" . }}-controller-manager + labels: + {{- include "operator.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.controllerManager.serviceAccount.annotations | nindent 4 }} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/examples/operator/values.yaml new/helmify-0.4.4/examples/operator/values.yaml --- old/helmify-0.4.3/examples/operator/values.yaml 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/examples/operator/values.yaml 2023-06-24 12:51:29.000000000 +0200 @@ -44,6 +44,9 @@ region: east type: user-node replicas: 1 + serviceAccount: + annotations: + k8s.acme.org/some-meta-data: ACME Inc. kubernetesClusterDomain: cluster.local managerConfig: controllerManagerConfigYaml: |- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/pkg/processor/meta.go new/helmify-0.4.4/pkg/processor/meta.go --- old/helmify-0.4.3/pkg/processor/meta.go 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/pkg/processor/meta.go 2023-06-24 12:51:29.000000000 +0200 @@ -4,13 +4,15 @@ "fmt" "strings" + "github.com/iancoleman/strcase" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" ) -const metaTeml = `apiVersion: %[1]s +const metaTemplate = `apiVersion: %[1]s kind: %[2]s metadata: name: %[3]s @@ -19,8 +21,40 @@ {{- include "%[4]s.labels" . | nindent 4 }} %[6]s` +const annotationsTemplate = ` annotations: + {{- toYaml .Values.%[1]s.%[2]s.annotations | nindent 4 }}` + +type MetaOpt interface { + apply(*options) +} + +type options struct { + values helmify.Values + annotations bool +} + +type annotationsOption struct { + values helmify.Values +} + +func (a annotationsOption) apply(opts *options) { + opts.annotations = true + opts.values = a.values +} + +func WithAnnotations(values helmify.Values) MetaOpt { + return annotationsOption{ + values: values, + } +} + // ProcessObjMeta - returns object apiVersion, kind and metadata as helm template. -func ProcessObjMeta(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (string, error) { +func ProcessObjMeta(appMeta helmify.AppMetadata, obj *unstructured.Unstructured, opts ...MetaOpt) (string, error) { + options := &options{} + for _, opt := range opts { + opt.apply(options) + } + var err error var labels, annotations string if len(obj.GetLabels()) != 0 { @@ -46,9 +80,27 @@ return "", err } } + templatedName := appMeta.TemplatedName(obj.GetName()) apiVersion, kind := obj.GetObjectKind().GroupVersionKind().ToAPIVersionAndKind() - metaStr := fmt.Sprintf(metaTeml, apiVersion, kind, templatedName, appMeta.ChartName(), labels, annotations) + + var metaStr string + if options.values != nil && options.annotations { + name := strcase.ToLowerCamel(appMeta.TrimName(obj.GetName())) + kind := strcase.ToLowerCamel(kind) + valuesAnnotations := make(map[string]interface{}) + for k, v := range obj.GetAnnotations() { + valuesAnnotations[k] = v + } + err = unstructured.SetNestedField(options.values, valuesAnnotations, name, kind, "annotations") + if err != nil { + return "", err + } + + annotations = fmt.Sprintf(annotationsTemplate, name, kind) + } + + metaStr = fmt.Sprintf(metaTemplate, apiVersion, kind, templatedName, appMeta.ChartName(), labels, annotations) metaStr = strings.Trim(metaStr, " \n") metaStr = strings.ReplaceAll(metaStr, "\n\n", "\n") return metaStr, nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/pkg/processor/rbac/serviceaccount.go new/helmify-0.4.4/pkg/processor/rbac/serviceaccount.go --- old/helmify-0.4.3/pkg/processor/rbac/serviceaccount.go 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/pkg/processor/rbac/serviceaccount.go 2023-06-24 12:51:29.000000000 +0200 @@ -1,10 +1,9 @@ package rbac import ( - "io" - "github.com/arttor/helmify/pkg/helmify" "github.com/arttor/helmify/pkg/processor" + "io" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -27,25 +26,29 @@ if obj.GroupVersionKind() != serviceAccountGVC { return false, nil, nil } - meta, err := processor.ProcessObjMeta(appMeta, obj) + values := helmify.Values{} + meta, err := processor.ProcessObjMeta(appMeta, obj, processor.WithAnnotations(values)) if err != nil { return true, nil, err } + return true, &saResult{ - data: []byte(meta), + data: []byte(meta), + values: values, }, nil } type saResult struct { - data []byte + data []byte + values helmify.Values } func (r *saResult) Filename() string { - return "deployment.yaml" + return "serviceaccount.yaml" } func (r *saResult) Values() helmify.Values { - return helmify.Values{} + return r.values } func (r *saResult) Write(writer io.Writer) error { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/test_data/k8s-operator-ci.yaml new/helmify-0.4.4/test_data/k8s-operator-ci.yaml --- old/helmify-0.4.3/test_data/k8s-operator-ci.yaml 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/test_data/k8s-operator-ci.yaml 2023-06-24 12:51:29.000000000 +0200 @@ -313,6 +313,8 @@ metadata: name: my-operator-controller-manager namespace: my-operator-system + annotations: + k8s.acme.org/some-meta-data: "ACME Inc." --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helmify-0.4.3/test_data/k8s-operator-kustomize.output new/helmify-0.4.4/test_data/k8s-operator-kustomize.output --- old/helmify-0.4.3/test_data/k8s-operator-kustomize.output 2023-04-30 11:41:20.000000000 +0200 +++ new/helmify-0.4.4/test_data/k8s-operator-kustomize.output 2023-06-24 12:51:29.000000000 +0200 @@ -323,6 +323,8 @@ metadata: name: my-operator-controller-manager namespace: my-operator-system + annotations: + k8s.acme.org/some-meta-data: "ACME Inc." --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role ++++++ helmify.obsinfo ++++++ --- /var/tmp/diff_new_pack.ej81lm/_old 2023-06-26 18:16:25.194557271 +0200 +++ /var/tmp/diff_new_pack.ej81lm/_new 2023-06-26 18:16:25.198557290 +0200 @@ -1,5 +1,5 @@ name: helmify -version: 0.4.3 -mtime: 1682847680 -commit: 03f8524d60a2517902506646d07cf2acac2dfa3a +version: 0.4.4 +mtime: 1687603889 +commit: de2e663fe7146cbb41fb2d80a610805368d5ba00 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/helmify/vendor.tar.gz /work/SRC/openSUSE:Factory/.helmify.new.15902/vendor.tar.gz differ: char 5, line 1