diff --git a/deploy/helm/charts/README.md b/deploy/helm/charts/README.md index 07c4b1f7..50245a16 100644 --- a/deploy/helm/charts/README.md +++ b/deploy/helm/charts/README.md @@ -71,6 +71,7 @@ helm install openebs-localpv openebs-localpv/localpv-provisioner --namespace ope | `release.version` | LocalPV Provisioner release version | `4.1.0` | | `analytics.enabled` | Enable sending stats to Google Analytics | `true` | | `analytics.pingInterval` | Duration(hours) between sending ping stat | `24h` | +| `extraLabels` | Additional labels to add to all chart resources | `{}` | | `helperPod.image.registry` | Registry for helper image | `""` | | `helperPod.image.repository` | Image for helper pod | `"openebs/linux-utils"` | | `helperPod.image.pullPolicy` | Pull policy for helper pod | `"IfNotPresent"` | diff --git a/deploy/helm/charts/templates/_helpers.tpl b/deploy/helm/charts/templates/_helpers.tpl index 776f7902..4a092194 100644 --- a/deploy/helm/charts/templates/_helpers.tpl +++ b/deploy/helm/charts/templates/_helpers.tpl @@ -64,12 +64,7 @@ Common labels {{ include "localpv.common.metaLabels" . }} {{ include "localpv.selectorLabels" . }} {{ include "localpv.componentLabels" . }} -{{- if (gt (len .Values.labels) 0) -}} -{{ printf "\n"}} -{{ .Values.labels | toYaml }} {{- end -}} -{{- end -}} - {{/* Create the name of the service account to use diff --git a/deploy/helm/charts/templates/deployment.yaml b/deploy/helm/charts/templates/deployment.yaml index 9a27809b..0d9d9f5a 100644 --- a/deploy/helm/charts/templates/deployment.yaml +++ b/deploy/helm/charts/templates/deployment.yaml @@ -8,6 +8,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.localpv.replicas }} strategy: @@ -23,8 +26,11 @@ spec: {{- end }} labels: {{- include "localpv.labels" . | nindent 8 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 8 }} + {{- end }} {{- with .Values.localpv.podLabels }} - {{ toYaml . | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} spec: {{ with .Values.priorityClassName }} diff --git a/deploy/helm/charts/templates/hostpath-class.yaml b/deploy/helm/charts/templates/hostpath-class.yaml index e7c32793..7c5be71c 100644 --- a/deploy/helm/charts/templates/hostpath-class.yaml +++ b/deploy/helm/charts/templates/hostpath-class.yaml @@ -34,9 +34,8 @@ metadata: {{- if .Values.hostpathClass.isDefaultClass }} storageclass.kubernetes.io/is-default-class: "true" {{- end }} -{{- if (gt (len .Values.labels) 0) }} - labels: -{{ toYaml .Values.labels | indent 4 }} +{{- if .Values.extraLabels }} + labels: {{- toYaml .Values.extraLabels | nindent 4 -}} {{- end }} provisioner: openebs.io/local volumeBindingMode: WaitForFirstConsumer diff --git a/deploy/helm/charts/templates/psp.yaml b/deploy/helm/charts/templates/psp.yaml index ec64aad4..ed97e28c 100644 --- a/deploy/helm/charts/templates/psp.yaml +++ b/deploy/helm/charts/templates/psp.yaml @@ -8,6 +8,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} spec: privileged: {{ .Values.localpv.privileged }} allowPrivilegeEscalation: true diff --git a/deploy/helm/charts/templates/rbac.yaml b/deploy/helm/charts/templates/rbac.yaml index d9b894a5..aeeed85e 100644 --- a/deploy/helm/charts/templates/rbac.yaml +++ b/deploy/helm/charts/templates/rbac.yaml @@ -5,6 +5,9 @@ metadata: name: {{ include "localpv.serviceAccountName" . }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -21,6 +24,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} rules: - apiGroups: ["*"] resources: ["nodes"] @@ -55,6 +61,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole @@ -74,6 +83,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} rules: - apiGroups: ['policy'] resources: ['podsecuritypolicies'] @@ -90,6 +102,9 @@ metadata: {{- end }} labels: {{- include "localpv.labels" . | nindent 4 }} + {{- if .Values.extraLabels -}} + {{- toYaml .Values.extraLabels | nindent 4 }} + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/deploy/helm/charts/values.yaml b/deploy/helm/charts/values.yaml index ebd51d1d..a984e210 100644 --- a/deploy/helm/charts/values.yaml +++ b/deploy/helm/charts/values.yaml @@ -123,10 +123,10 @@ helperPod: # Overrides the image tag whose default is the chart appVersion. tag: 4.1.0 +# Additional labels to add to all chart resources +extraLabels: {} + analytics: enabled: true # Specify in hours the duration after which a ping event needs to be sent. pingInterval: "24h" - -# Additional labels to add to all chart resources -labels: {}