From 25122a48ba54483de7dd5a02f32ed9108cc78947 Mon Sep 17 00:00:00 2001 From: Andrey Pokhilko Date: Mon, 10 Aug 2026 14:17:16 +0100 Subject: [PATCH] feat(chart): apply commonLabels to all rendered resources (#739) Applies commonLabels to every rendered resource, wires up the likewise-unused dashboard.persistence.labels, and adds the missing README rows. Closes #730 Co-authored-by: ashutoshbhardwaj007 --- charts/helm-dashboard/README.md | 3 +++ charts/helm-dashboard/templates/_helpers.tpl | 3 +++ charts/helm-dashboard/templates/deployment.yaml | 3 +++ charts/helm-dashboard/templates/pvc.yaml | 3 +++ charts/helm-dashboard/templates/serviceaccount.yaml | 4 ++++ charts/helm-dashboard/values.yaml | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/charts/helm-dashboard/README.md b/charts/helm-dashboard/README.md index 9be30b0..56486c1 100644 --- a/charts/helm-dashboard/README.md +++ b/charts/helm-dashboard/README.md @@ -68,6 +68,7 @@ The following table lists the configurable parameters of the chart and their def | `service.port ` | Kubernetes service port | `8080` | | `serviceAccount.create` | Creates a service account | `true` | | `serviceAccount.name` | Optional name for the service account | `{RELEASE_FULLNAME}` | +| `commonLabels` | Labels to add to all resources managed by this chart | `{}` | | `nodeSelector` | Node labels for pod assignment | | | `affinity` | Affinity settings for pod assignment | | | `tolerations` | Tolerations for pod assignment | | @@ -75,6 +76,8 @@ The following table lists the configurable parameters of the chart and their def | `dashboard.persistence.accessModes` | Persistent Volume access modes | `["ReadWriteOnce"]` | | `dashboard.persistence.storageClass` | Persistent Volume storage class | `""` | | `dashboard.persistence.size` | Persistent Volume size | `100M` | +| `dashboard.persistence.labels` | Extra labels for the Persistent Volume Claim | `{}` | +| `dashboard.persistence.annotations` | Annotations for the Persistent Volume Claim | `{}` | | `dashboard.persistence.finalizers` | Finalizers for the Persistent Volume Claim | `[kubernetes.io/pvc-protection]` | | `dashboard.persistence.lookupVolumeName` | Lookup volume name for the Persistent Volume Claim | `true` | | `updateStrategy.type` | Set up update strategy for helm-dashboard installation. | `RollingUpdate` | diff --git a/charts/helm-dashboard/templates/_helpers.tpl b/charts/helm-dashboard/templates/_helpers.tpl index 5e2ced8..05711e5 100644 --- a/charts/helm-dashboard/templates/_helpers.tpl +++ b/charts/helm-dashboard/templates/_helpers.tpl @@ -33,6 +33,9 @@ helm.sh/chart: {{ include "helm-dashboard.chart" . }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- with .Values.commonLabels }} +{{ toYaml . }} +{{- end }} {{- end }} {{/* diff --git a/charts/helm-dashboard/templates/deployment.yaml b/charts/helm-dashboard/templates/deployment.yaml index 5940836..84a76c4 100644 --- a/charts/helm-dashboard/templates/deployment.yaml +++ b/charts/helm-dashboard/templates/deployment.yaml @@ -20,6 +20,9 @@ spec: {{- end }} labels: {{- include "helm-dashboard.selectorLabels" . | nindent 8 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- include "helm-dashboard.imagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "helm-dashboard.serviceAccountName" . }} diff --git a/charts/helm-dashboard/templates/pvc.yaml b/charts/helm-dashboard/templates/pvc.yaml index e8662d4..7c1cb5e 100644 --- a/charts/helm-dashboard/templates/pvc.yaml +++ b/charts/helm-dashboard/templates/pvc.yaml @@ -6,6 +6,9 @@ metadata: namespace: {{ .Release.Namespace | quote }} labels: {{- include "helm-dashboard.labels" . | nindent 4 }} + {{- with .Values.dashboard.persistence.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- with .Values.dashboard.persistence.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/helm-dashboard/templates/serviceaccount.yaml b/charts/helm-dashboard/templates/serviceaccount.yaml index 8190700..4eb472b 100644 --- a/charts/helm-dashboard/templates/serviceaccount.yaml +++ b/charts/helm-dashboard/templates/serviceaccount.yaml @@ -14,6 +14,8 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "helm-dashboard.serviceAccountName" . }} + labels: + {{- include "helm-dashboard.labels" . | nindent 4 }} rules: - apiGroups: ["*"] resources: ["*"] @@ -28,6 +30,8 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ include "helm-dashboard.serviceAccountName" . }} + labels: + {{- include "helm-dashboard.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/charts/helm-dashboard/values.yaml b/charts/helm-dashboard/values.yaml index d92f95b..26fe3e5 100644 --- a/charts/helm-dashboard/values.yaml +++ b/charts/helm-dashboard/values.yaml @@ -39,6 +39,10 @@ resources: cpu: 1 memory: 1Gi +## Labels to add to all resources managed by this chart +## +commonLabels: {} + dashboard: allowWriteActions: true