Skip to content

Commit

Permalink
feat: add support for customizable deployment template labels
Browse files Browse the repository at this point in the history
On-behalf-of: @SAP angel.kafazov@sap.com
Signed-off-by: Angel Kafazov <akafazov@cst-bg.net>
  • Loading branch information
akafazov committed Nov 25, 2024
1 parent 076cd6e commit 0e9cecb
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions charts/common/templates/_deploymentHelpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,7 @@ automountServiceAccountToken: {{ not (eq (.Values.security).mountServiceAccountT
{{- end }}
{{- define "common.terminationGracePeriodSeconds" -}}
{{ .Values.terminationGracePeriodSeconds | default 10 }}
{{- end }}
{{- define "common.deploymentTemplateLabels" }}

{{- end }}
Binary file modified charts/extension-manager-operator/charts/common-0.1.5.tgz
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion charts/extension-manager-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ spec:
metadata:
labels:
service: {{ include "common.entity.name" . }}
control-plane: controller-manager
{{- if ((.Values.deployment).template).labels }}
{{ .Values.deployment.template.labels | toYaml | nindent 8 }}
{{- end }}
annotations:
sidecar.istio.io/inject: "{{ (include "common.istioEnabled" .) }}"
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ operator match the snapshot:
annotations:
sidecar.istio.io/inject: "true"
labels:
control-plane: controller-manager
service: RELEASE-NAME-extension-manager-operator
spec:
containers:
Expand Down
21 changes: 21 additions & 0 deletions charts/extension-manager-operator/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,24 @@ tests:
path: /healthz
port: 8081
periodSeconds: 10
- it: check deployment template labels
template: deployment.yaml
set:
deployment:
template:
labels:
control-plane: controller-manager
asserts:
- equal:
path: spec.template.metadata.labels.control-plane
value: controller-manager
- it: check deployment without custom labels
template: deployment.yaml
set:
deployment:
template: {}
asserts:
- equal:
path: spec.template.metadata.labels
value:
service: RELEASE-NAME-extension-manager-operator
3 changes: 3 additions & 0 deletions charts/extension-manager-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ deployment:
requests:
cpu: 150m
memory: 128Mi
template:
# labels:
# control-plane: controller-manager

# The Custom Resource Definitions (CRDs) configuration
## @param crds.enabled Enable or disable the CRDs
Expand Down

0 comments on commit 0e9cecb

Please sign in to comment.