From e4683d16932b829f6055a75e00fbe127fc114d2c Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Tue, 29 Aug 2023 09:52:18 +0200 Subject: [PATCH] [bitnami/sonarqube] Support for customizing standard labels (#18748) --- bitnami/sonarqube/Chart.lock | 8 ++++---- bitnami/sonarqube/Chart.yaml | 2 +- bitnami/sonarqube/templates/deployment.yaml | 17 ++++++----------- .../sonarqube/templates/externaldb-secret.yaml | 5 +---- bitnami/sonarqube/templates/ingress.yaml | 18 ++++-------------- .../sonarqube/templates/install_plugins.yaml | 5 +---- bitnami/sonarqube/templates/jmx-configmap.yaml | 5 +---- .../sonarqube/templates/jmx-metrics-svc.yaml | 17 +++++------------ .../templates/jmx-servicemonitor.yaml | 11 +++-------- bitnami/sonarqube/templates/pvc.yaml | 14 +++----------- bitnami/sonarqube/templates/secret.yaml | 5 +---- .../sonarqube/templates/service-account.yaml | 16 +++++----------- bitnami/sonarqube/templates/service.yaml | 17 +++++------------ bitnami/sonarqube/templates/tls-secret.yaml | 10 ++-------- 14 files changed, 42 insertions(+), 108 deletions(-) diff --git a/bitnami/sonarqube/Chart.lock b/bitnami/sonarqube/Chart.lock index cd5683eafb..4ec8264c95 100644 --- a/bitnami/sonarqube/Chart.lock +++ b/bitnami/sonarqube/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: postgresql repository: oci://registry-1.docker.io/bitnamicharts - version: 12.8.3 + version: 12.10.0 - name: common repository: oci://registry-1.docker.io/bitnamicharts - version: 2.8.0 -digest: sha256:3e0d01f64a38d3e892f9b44ed3f8bf43b82c3011f3d16cd021de491520699f5f -generated: "2023-08-21T03:00:13.436725016Z" + version: 2.9.0 +digest: sha256:ea6f55aa387d1c47498b4099135809925af3a17ca17f8a1bb49b5f168dc9753c +generated: "2023-08-28T10:15:05.808239+02:00" diff --git a/bitnami/sonarqube/Chart.yaml b/bitnami/sonarqube/Chart.yaml index 10af6d8616..392241aefd 100644 --- a/bitnami/sonarqube/Chart.yaml +++ b/bitnami/sonarqube/Chart.yaml @@ -37,4 +37,4 @@ maintainers: name: sonarqube sources: - https://github.com/bitnami/charts/tree/main/bitnami/sonarqube -version: 3.2.10 +version: 3.3.0 diff --git a/bitnami/sonarqube/templates/deployment.yaml b/bitnami/sonarqube/templates/deployment.yaml index fd9286575a..e0b4a9eab0 100644 --- a/bitnami/sonarqube/templates/deployment.yaml +++ b/bitnami/sonarqube/templates/deployment.yaml @@ -8,10 +8,7 @@ kind: Deployment metadata: name: {{ include "common.names.fullname" . }} namespace: {{ .Release.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 }} @@ -20,8 +17,9 @@ spec: {{- if .Values.updateStrategy }} strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} {{- end }} + {{- $podLabels := merge .Values.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} template: metadata: annotations: @@ -34,10 +32,7 @@ spec: {{- if .Values.podAnnotations }} {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 8 }} - {{- if .Values.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} spec: serviceAccountName: {{ include "sonarqube.serviceAccountName" . }} {{- include "sonarqube.imagePullSecrets" . | nindent 6 }} @@ -48,8 +43,8 @@ spec: affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.nodeSelector }} diff --git a/bitnami/sonarqube/templates/externaldb-secret.yaml b/bitnami/sonarqube/templates/externaldb-secret.yaml index 9da6b62f48..1db4648b85 100644 --- a/bitnami/sonarqube/templates/externaldb-secret.yaml +++ b/bitnami/sonarqube/templates/externaldb-secret.yaml @@ -9,10 +9,7 @@ kind: Secret metadata: name: {{ printf "%s-externaldb" (include "common.names.fullname" .) }} namespace: {{ .Release.Namespace }} - 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/sonarqube/templates/ingress.yaml b/bitnami/sonarqube/templates/ingress.yaml index ade72cbfdc..c0a0d1bfdf 100644 --- a/bitnami/sonarqube/templates/ingress.yaml +++ b/bitnami/sonarqube/templates/ingress.yaml @@ -9,21 +9,11 @@ kind: Ingress metadata: name: {{ template "common.names.fullname" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.ingress.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.ingress.labels "context" $ ) | nindent 4 }} - {{- end }} + {{- $labels := merge .Values.ingress.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} {{- if or .Values.ingress.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.ingress.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.ingress.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.ingress.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: {{- if and .Values.ingress.ingressClassName (include "common.ingress.supportsIngressClassname" .) }} diff --git a/bitnami/sonarqube/templates/install_plugins.yaml b/bitnami/sonarqube/templates/install_plugins.yaml index b49465ce89..de95bae307 100644 --- a/bitnami/sonarqube/templates/install_plugins.yaml +++ b/bitnami/sonarqube/templates/install_plugins.yaml @@ -8,10 +8,7 @@ kind: ConfigMap metadata: name: {{ printf "%s-install-plugins-configmap" (include "common.names.fullname" .) }} namespace: {{ .Release.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 }} diff --git a/bitnami/sonarqube/templates/jmx-configmap.yaml b/bitnami/sonarqube/templates/jmx-configmap.yaml index 242b7c3f41..56535e9ef2 100644 --- a/bitnami/sonarqube/templates/jmx-configmap.yaml +++ b/bitnami/sonarqube/templates/jmx-configmap.yaml @@ -9,10 +9,7 @@ kind: ConfigMap metadata: name: {{ printf "%s-jmx-conf" (include "common.names.fullname" .) }} namespace: {{ .Release.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/sonarqube/templates/jmx-metrics-svc.yaml b/bitnami/sonarqube/templates/jmx-metrics-svc.yaml index 3c81397749..33f9ed70d7 100644 --- a/bitnami/sonarqube/templates/jmx-metrics-svc.yaml +++ b/bitnami/sonarqube/templates/jmx-metrics-svc.yaml @@ -9,19 +9,11 @@ kind: Service metadata: name: {{ printf "%s-jmx-metrics" (include "common.names.fullname" .) }} namespace: {{ .Release.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: metrics - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if or .Values.metrics.jmx.service.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.metrics.jmx.service.annotations }} - {{ include "common.tplvalues.render" ( dict "value" .Values.metrics.jmx.service.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.metrics.jmx.service.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: type: ClusterIP @@ -30,5 +22,6 @@ spec: port: {{ .Values.metrics.jmx.service.ports.metrics }} protocol: TCP targetPort: metrics - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/sonarqube/templates/jmx-servicemonitor.yaml b/bitnami/sonarqube/templates/jmx-servicemonitor.yaml index 2bc52aebe8..c1f6e78f44 100644 --- a/bitnami/sonarqube/templates/jmx-servicemonitor.yaml +++ b/bitnami/sonarqube/templates/jmx-servicemonitor.yaml @@ -11,14 +11,9 @@ metadata: {{- if .Values.metrics.serviceMonitor.namespace }} namespace: {{ .Values.metrics.serviceMonitor.namespace }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- $labels := merge .Values.metrics.serviceMonitor.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} app.kubernetes.io/component: metrics - {{- if .Values.metrics.serviceMonitor.labels }} - {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.labels "context" $) | nindent 4 }} - {{- end }} - {{- 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 }} @@ -45,7 +40,7 @@ spec: matchNames: - {{ .Release.Namespace }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: metrics {{- if .Values.metrics.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }} diff --git a/bitnami/sonarqube/templates/pvc.yaml b/bitnami/sonarqube/templates/pvc.yaml index 17960c5b72..ecf46d6879 100644 --- a/bitnami/sonarqube/templates/pvc.yaml +++ b/bitnami/sonarqube/templates/pvc.yaml @@ -9,18 +9,10 @@ apiVersion: v1 metadata: name: {{ include "common.names.fullname" . }} namespace: {{ .Release.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 or .Values.persistence.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.persistence.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.persistence.annotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.persistence.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: accessModes: diff --git a/bitnami/sonarqube/templates/secret.yaml b/bitnami/sonarqube/templates/secret.yaml index e3ade93f7d..1ef26813ee 100644 --- a/bitnami/sonarqube/templates/secret.yaml +++ b/bitnami/sonarqube/templates/secret.yaml @@ -9,10 +9,7 @@ kind: Secret metadata: name: {{ template "common.names.fullname" . }} namespace: {{ .Release.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/sonarqube/templates/service-account.yaml b/bitnami/sonarqube/templates/service-account.yaml index 75d3bc8aea..167c940422 100644 --- a/bitnami/sonarqube/templates/service-account.yaml +++ b/bitnami/sonarqube/templates/service-account.yaml @@ -9,16 +9,10 @@ kind: ServiceAccount metadata: name: {{ template "sonarqube.serviceAccountName" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- 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.serviceAccount.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.serviceAccount.annotations "context" $) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/bitnami/sonarqube/templates/service.yaml b/bitnami/sonarqube/templates/service.yaml index 1cbb6a4aa0..0a75763f67 100644 --- a/bitnami/sonarqube/templates/service.yaml +++ b/bitnami/sonarqube/templates/service.yaml @@ -8,18 +8,10 @@ kind: Service metadata: name: {{ template "common.names.fullname" . }} namespace: {{ .Release.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 or .Values.service.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.service.annotations -}} - {{ include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations -}} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $annotations := merge .Values.service.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: type: {{ .Values.service.type }} @@ -63,4 +55,5 @@ spec: {{- if .Values.service.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }} {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} diff --git a/bitnami/sonarqube/templates/tls-secret.yaml b/bitnami/sonarqube/templates/tls-secret.yaml index 56c9b774dd..cb443531bc 100644 --- a/bitnami/sonarqube/templates/tls-secret.yaml +++ b/bitnami/sonarqube/templates/tls-secret.yaml @@ -11,10 +11,7 @@ kind: Secret metadata: name: {{ .name }} namespace: {{ $.Release.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 }} @@ -34,10 +31,7 @@ kind: Secret metadata: name: {{ $secretName }} namespace: {{ .Release.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 }}