From 3af35f90b85eeeb109c6d86d5772300ec48e37df Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Tue, 22 Aug 2023 16:54:15 +0200 Subject: [PATCH] [bitnami/metallb] Support for customizing standard labels (#18333) --- bitnami/metallb/Chart.lock | 6 ++--- bitnami/metallb/Chart.yaml | 4 ++-- .../templates/controller/configmap.yaml | 5 +--- .../templates/controller/deployment.yaml | 17 +++++-------- .../{ => controller}/networkpolicy.yaml | 8 +++---- bitnami/metallb/templates/controller/psp.yaml | 5 +--- .../metallb/templates/controller/rbac.yaml | 20 ++++------------ .../metallb/templates/controller/service.yaml | 19 ++++++--------- .../templates/controller/serviceaccount.yaml | 14 +++-------- .../templates/controller/servicemonitor.yaml | 24 ++++++------------- .../templates/controller/webhooks.yaml | 10 ++++---- .../templates/prometheus/metallb.alerts.yaml | 5 +--- bitnami/metallb/templates/rbac.yaml | 10 ++------ .../metallb/templates/speaker/daemonset.yaml | 17 +++++-------- bitnami/metallb/templates/speaker/psp.yaml | 5 +--- bitnami/metallb/templates/speaker/rbac.yaml | 20 ++++------------ bitnami/metallb/templates/speaker/secret.yaml | 5 +--- .../metallb/templates/speaker/service.yaml | 19 ++++++--------- .../templates/speaker/serviceaccount.yaml | 14 +++-------- .../templates/speaker/servicemonitor.yaml | 24 ++++++------------- 20 files changed, 74 insertions(+), 177 deletions(-) rename bitnami/metallb/templates/{ => controller}/networkpolicy.yaml (82%) diff --git a/bitnami/metallb/Chart.lock b/bitnami/metallb/Chart.lock index c9af78cb40..a419e36382 100644 --- a/bitnami/metallb/Chart.lock +++ b/bitnami/metallb/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common repository: oci://registry-1.docker.io/bitnamicharts - version: 2.8.0 -digest: sha256:0119fce6b509ebf3eaf5218f87f6ec0af64ec7da15f272115673b0716c4b6919 -generated: "2023-08-17T14:13:09.423737398Z" + version: 2.9.0 +digest: sha256:416ad278a896f0e9b51d5305bef5d875c7cca6fbb64b75e1f131b04763e2aff9 +generated: "2023-08-22T14:16:03.110856+02:00" diff --git a/bitnami/metallb/Chart.yaml b/bitnami/metallb/Chart.yaml index 1a3074b983..0ca0deaf1d 100644 --- a/bitnami/metallb/Chart.yaml +++ b/bitnami/metallb/Chart.yaml @@ -34,5 +34,5 @@ maintainers: url: https://github.com/bitnami/charts name: metallb sources: -- https://github.com/bitnami/charts/tree/main/bitnami/metallb -version: 4.6.5 + - https://github.com/bitnami/charts/tree/main/bitnami/metallb +version: 4.7.0 diff --git a/bitnami/metallb/templates/controller/configmap.yaml b/bitnami/metallb/templates/controller/configmap.yaml index b63c6f9df0..5106367f37 100644 --- a/bitnami/metallb/templates/controller/configmap.yaml +++ b/bitnami/metallb/templates/controller/configmap.yaml @@ -9,10 +9,7 @@ kind: ConfigMap metadata: name: {{ include "metallb.configMapName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/controller/deployment.yaml b/bitnami/metallb/templates/controller/deployment.yaml index 9d434dffb6..0d94ff7b0c 100644 --- a/bitnami/metallb/templates/controller/deployment.yaml +++ b/bitnami/metallb/templates/controller/deployment.yaml @@ -8,11 +8,8 @@ kind: Deployment metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -22,16 +19,14 @@ spec: strategy: {{- toYaml .Values.controller.updateStrategy | nindent 4 }} {{- end }} revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} + {{- $podLabels := merge .Values.controller.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: controller template: metadata: - labels: {{- include "common.labels.standard" . | nindent 8 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} app.kubernetes.io/component: controller - {{- if .Values.controller.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.controller.podLabels "context" $) | nindent 8 }} - {{- end }} {{- if .Values.controller.podAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.controller.podAnnotations "context" $) | nindent 8 }} {{- end }} @@ -50,8 +45,8 @@ spec: affinity: {{- include "common.tplvalues.render" (dict "value" .Values.controller.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAffinityPreset "component" "controller" "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAntiAffinityPreset "component" "controller" "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAffinityPreset "component" "controller" "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.controller.podAntiAffinityPreset "component" "controller" "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.controller.nodeAffinityPreset.type "key" .Values.controller.nodeAffinityPreset.key "values" .Values.controller.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.controller.tolerations }} diff --git a/bitnami/metallb/templates/networkpolicy.yaml b/bitnami/metallb/templates/controller/networkpolicy.yaml similarity index 82% rename from bitnami/metallb/templates/networkpolicy.yaml rename to bitnami/metallb/templates/controller/networkpolicy.yaml index 62d4a75ec3..5802186cbb 100644 --- a/bitnami/metallb/templates/networkpolicy.yaml +++ b/bitnami/metallb/templates/controller/networkpolicy.yaml @@ -9,17 +9,15 @@ apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: + {{- $podLabels := merge .Values.controller.podLabels .Values.commonLabels }} podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: controller policyTypes: - Ingress diff --git a/bitnami/metallb/templates/controller/psp.yaml b/bitnami/metallb/templates/controller/psp.yaml index a2dc8759b2..81a1789501 100644 --- a/bitnami/metallb/templates/controller/psp.yaml +++ b/bitnami/metallb/templates/controller/psp.yaml @@ -10,11 +10,8 @@ kind: PodSecurityPolicy metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/controller/rbac.yaml b/bitnami/metallb/templates/controller/rbac.yaml index 1bd77ddbbe..f43cc60901 100644 --- a/bitnami/metallb/templates/controller/rbac.yaml +++ b/bitnami/metallb/templates/controller/rbac.yaml @@ -8,11 +8,8 @@ apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} kind: ClusterRole metadata: name: {{ printf "%s:controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -93,11 +90,8 @@ kind: Role metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -198,11 +192,8 @@ apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} kind: ClusterRoleBinding metadata: name: {{ printf "%s:controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -220,11 +211,8 @@ kind: RoleBinding metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/controller/service.yaml b/bitnami/metallb/templates/controller/service.yaml index 33e9ddc35e..a717e64546 100644 --- a/bitnami/metallb/templates/controller/service.yaml +++ b/bitnami/metallb/templates/controller/service.yaml @@ -9,22 +9,17 @@ kind: Service metadata: name: {{ printf "%s-controller-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.controller.metrics.service.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.service.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if or .Values.controller.metrics.service.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.controller.metrics.service.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: ClusterIP clusterIP: "None" - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.controller.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller ports: - name: metrics diff --git a/bitnami/metallb/templates/controller/serviceaccount.yaml b/bitnami/metallb/templates/controller/serviceaccount.yaml index a2dddcc340..ee952f03eb 100644 --- a/bitnami/metallb/templates/controller/serviceaccount.yaml +++ b/bitnami/metallb/templates/controller/serviceaccount.yaml @@ -9,19 +9,11 @@ kind: ServiceAccount metadata: name: {{ include "metallb.controller.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if or .Values.controller.serviceAccount.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.controller.serviceAccount.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.controller.serviceAccount.annotations "context" $) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.controller.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} automountServiceAccountToken: {{ .Values.controller.serviceAccount.automountServiceAccountToken }} {{- end -}} diff --git a/bitnami/metallb/templates/controller/servicemonitor.yaml b/bitnami/metallb/templates/controller/servicemonitor.yaml index 80660d69aa..d61bf21d2e 100644 --- a/bitnami/metallb/templates/controller/servicemonitor.yaml +++ b/bitnami/metallb/templates/controller/servicemonitor.yaml @@ -8,27 +8,17 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ printf "%s-controller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - {{- if .Values.controller.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.controller.metrics.serviceMonitor.namespace | quote }} - {{- else }} - namespace: {{ include "common.names.namespace" . | quote }} - {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ default .Release.Namespace .Values.controller.metrics.serviceMonitor.namespace | quote }} + {{- $labels := merge .Values.controller.metrics.serviceMonitor.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.controller.metrics.serviceMonitor.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.controller.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: controller {{- if .Values.controller.metrics.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.controller.metrics.serviceMonitor.selector "context" $) | nindent 6 }} diff --git a/bitnami/metallb/templates/controller/webhooks.yaml b/bitnami/metallb/templates/controller/webhooks.yaml index 89c9e01e41..039bef5f99 100644 --- a/bitnami/metallb/templates/controller/webhooks.yaml +++ b/bitnami/metallb/templates/controller/webhooks.yaml @@ -7,7 +7,7 @@ apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: metallb-webhook-configuration - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} webhooks: - admissionReviewVersions: - v1 @@ -154,13 +154,13 @@ kind: Service metadata: name: metallb-webhook-service namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} spec: ports: - port: 443 targetPort: 9443 - selector: - {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.controller.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: controller --- apiVersion: v1 @@ -168,4 +168,4 @@ kind: Secret metadata: name: webhook-server-cert namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} diff --git a/bitnami/metallb/templates/prometheus/metallb.alerts.yaml b/bitnami/metallb/templates/prometheus/metallb.alerts.yaml index d9e79290a3..49a2a60283 100644 --- a/bitnami/metallb/templates/prometheus/metallb.alerts.yaml +++ b/bitnami/metallb/templates/prometheus/metallb.alerts.yaml @@ -9,10 +9,7 @@ kind: PrometheusRule metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/rbac.yaml b/bitnami/metallb/templates/rbac.yaml index 871d461a97..98bb94886f 100644 --- a/bitnami/metallb/templates/rbac.yaml +++ b/bitnami/metallb/templates/rbac.yaml @@ -9,10 +9,7 @@ kind: Role metadata: name: {{ printf "%s-config-watcher" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -31,10 +28,7 @@ kind: RoleBinding metadata: name: {{ printf "%s-config-watcher" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/speaker/daemonset.yaml b/bitnami/metallb/templates/speaker/daemonset.yaml index f3639653d6..a3f4da7af8 100644 --- a/bitnami/metallb/templates/speaker/daemonset.yaml +++ b/bitnami/metallb/templates/speaker/daemonset.yaml @@ -9,11 +9,8 @@ kind: DaemonSet metadata: name: {{ printf "%s-speaker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -21,16 +18,14 @@ spec: {{- if .Values.speaker.updateStrategy }} updateStrategy: {{- toYaml .Values.speaker.updateStrategy | nindent 4 }} {{- end }} + {{- $podLabels := merge .Values.speaker.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: speaker template: metadata: - labels: {{- include "common.labels.standard" . | nindent 8 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} app.kubernetes.io/component: speaker - {{- if .Values.speaker.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.speaker.podLabels "context" $) | nindent 8 }} - {{- end }} {{- if .Values.speaker.podAnnotations }} annotations: {{- include "common.tplvalues.render" (dict "value" .Values.speaker.podAnnotations "context" $) | nindent 8 }} {{- end }} @@ -44,8 +39,8 @@ spec: affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.speaker.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.speaker.podAffinityPreset "component" "speaker" "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.speaker.podAntiAffinityPreset "component" "speaker" "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.speaker.podAffinityPreset "component" "speaker" "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.speaker.podAntiAffinityPreset "component" "speaker" "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.speaker.nodeAffinityPreset.type "key" .Values.speaker.nodeAffinityPreset.key "values" .Values.speaker.nodeAffinityPreset.values) | nindent 10 }} {{- end }} nodeSelector: diff --git a/bitnami/metallb/templates/speaker/psp.yaml b/bitnami/metallb/templates/speaker/psp.yaml index af06989ad4..ce9e5f6cd1 100644 --- a/bitnami/metallb/templates/speaker/psp.yaml +++ b/bitnami/metallb/templates/speaker/psp.yaml @@ -11,11 +11,8 @@ kind: PodSecurityPolicy metadata: name: {{ printf "%s-speaker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/speaker/rbac.yaml b/bitnami/metallb/templates/speaker/rbac.yaml index f8c9fa4016..3f242eb2e1 100644 --- a/bitnami/metallb/templates/speaker/rbac.yaml +++ b/bitnami/metallb/templates/speaker/rbac.yaml @@ -8,11 +8,8 @@ apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} kind: ClusterRole metadata: name: {{ printf "%s-speaker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -57,11 +54,8 @@ kind: Role metadata: name: {{ printf "%s-pod-lister" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -141,11 +135,8 @@ apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} kind: ClusterRoleBinding metadata: name: {{ printf "%s-speaker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -163,11 +154,8 @@ kind: RoleBinding metadata: name: {{ printf "%s-pod-lister" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/metallb/templates/speaker/secret.yaml b/bitnami/metallb/templates/speaker/secret.yaml index 0c9639dca4..53442796e7 100644 --- a/bitnami/metallb/templates/speaker/secret.yaml +++ b/bitnami/metallb/templates/speaker/secret.yaml @@ -10,11 +10,8 @@ kind: Secret metadata: name: {{ include "metallb.speaker.secretName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} annotations: "helm.sh/hook": "pre-install" "helm.sh/hook-delete-policy": "before-hook-creation" diff --git a/bitnami/metallb/templates/speaker/service.yaml b/bitnami/metallb/templates/speaker/service.yaml index 47379c34ee..14dd73433e 100644 --- a/bitnami/metallb/templates/speaker/service.yaml +++ b/bitnami/metallb/templates/speaker/service.yaml @@ -9,22 +9,17 @@ kind: Service metadata: name: {{ printf "%s-speaker-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.speaker.metrics.service.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.speaker.metrics.service.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if or .Values.speaker.metrics.service.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.speaker.metrics.service.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: ClusterIP clusterIP: "None" - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.speaker.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker ports: - name: metrics diff --git a/bitnami/metallb/templates/speaker/serviceaccount.yaml b/bitnami/metallb/templates/speaker/serviceaccount.yaml index ed394fb455..957a01a815 100644 --- a/bitnami/metallb/templates/speaker/serviceaccount.yaml +++ b/bitnami/metallb/templates/speaker/serviceaccount.yaml @@ -9,19 +9,11 @@ kind: ServiceAccount metadata: name: {{ include "metallb.speaker.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if or .Values.speaker.serviceAccount.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.speaker.serviceAccount.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.speaker.serviceAccount.annotations "context" $) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.speaker.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} automountServiceAccountToken: {{ .Values.speaker.serviceAccount.automountServiceAccountToken }} {{- end -}} diff --git a/bitnami/metallb/templates/speaker/servicemonitor.yaml b/bitnami/metallb/templates/speaker/servicemonitor.yaml index 678a4f0bf3..f2caacb029 100644 --- a/bitnami/metallb/templates/speaker/servicemonitor.yaml +++ b/bitnami/metallb/templates/speaker/servicemonitor.yaml @@ -8,27 +8,17 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ printf "%s-speaker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - {{- if .Values.speaker.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.speaker.metrics.serviceMonitor.namespace | quote }} - {{- else }} - namespace: {{ include "common.names.namespace" . | quote }} - {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ default .Release.Namespace .Values.speaker.metrics.serviceMonitor.namespace | quote }} + {{- $labels := merge .Values.speaker.metrics.serviceMonitor.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} app.kubernetes.io/component: speaker - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.speaker.metrics.serviceMonitor.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.speaker.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: jobLabel: {{ .Values.speaker.metrics.serviceMonitor.jobLabel | quote }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: speaker {{- if .Values.speaker.metrics.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.speaker.metrics.serviceMonitor.selector "context" $) | nindent 6 }}