From 5607460b4e13d7e04c19f5fd5f93e6d55da7322f Mon Sep 17 00:00:00 2001 From: Martin Briatka Date: Mon, 9 Nov 2026 13:44:22 +0100 Subject: [PATCH] Allow configuring additional annotations on the generated workload Add a spec.annotations (map[string]string) field. The operator renders its entries into the generated workload's commonAnnotations, so users can attach arbitrary annotations to the workload metadata. The field is empty by default, so existing deployments are unaffected. --- api/v1alpha1/types.go | 3 +++ api/v1alpha1/zz_generated.deepcopy.go | 7 +++++++ crds/cache.cs.sap.com_valkeys.yaml | 6 ++++++ pkg/operator/data/parameters.yaml | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/api/v1alpha1/types.go b/api/v1alpha1/types.go index a537b1a9..c8aba559 100644 --- a/api/v1alpha1/types.go +++ b/api/v1alpha1/types.go @@ -32,6 +32,9 @@ type ValkeySpec struct { Binding *BindingProperties `json:"binding,omitempty"` ExtraEnvVars []corev1.EnvVar `json:"extraEnvVars,omitempty"` ExtraFlags []string `json:"extraFlags,omitempty"` + // Additional annotations added to the generated workload metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty"` } // SentinelProperties models attributes of the sentinel sidecar diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index c5c0804e..9c038154 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -337,6 +337,13 @@ func (in *ValkeySpec) DeepCopyInto(out *ValkeySpec) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValkeySpec. diff --git a/crds/cache.cs.sap.com_valkeys.yaml b/crds/cache.cs.sap.com_valkeys.yaml index 592b216f..29aaeb91 100644 --- a/crds/cache.cs.sap.com_valkeys.yaml +++ b/crds/cache.cs.sap.com_valkeys.yaml @@ -958,6 +958,12 @@ spec: x-kubernetes-list-type: atomic type: object type: object + annotations: + additionalProperties: + type: string + description: Additional annotations added to the generated workload + metadata. + type: object binding: description: BindingProperties models custom properties for the generated binding secret diff --git a/pkg/operator/data/parameters.yaml b/pkg/operator/data/parameters.yaml index 1665b162..cdb4b712 100644 --- a/pkg/operator/data/parameters.yaml +++ b/pkg/operator/data/parameters.yaml @@ -218,6 +218,11 @@ metrics: {{- end }}{{- end }} {{- end }} +{{- with .annotations }} +commonAnnotations: + {{- toYaml . | nindent 2 }} +{{- end }} + {{- if $tlsEnabled }} tls: enabled: true