From 57ca4e1d1bcd379ea8b45bcf877f7f6f231fb5b3 Mon Sep 17 00:00:00 2001 From: Olivier Gintrand Date: Sun, 12 Dec 2021 08:44:00 +0100 Subject: [PATCH] Add _tplvalues.tpl and define commonLabels, podLabels, commonAnnotations and podAnnotations attributes (#6638) * Update helm resources to enbale common bitnami usage Add dependency and update values add _tplvalues and remove dependencies * Update Chart.yaml bump version to 5.0.5 * add missing license --- .../kubernetes-dashboard/Chart.yaml | 20 +++--- .../templates/_tplvalues.tpl | 27 ++++++++ .../templates/clusterrole-metrics.yaml | 9 ++- .../templates/clusterrole-readonly.yaml | 9 ++- .../templates/clusterrolebinding-metrics.yaml | 9 ++- .../clusterrolebinding-readonly.yaml | 9 ++- .../templates/configmap.yaml | 9 ++- .../templates/deployment.yaml | 62 ++++++++++--------- .../templates/ingress.yaml | 29 +++++---- .../templates/networkpolicy.yaml | 9 ++- .../kubernetes-dashboard/templates/pdb.yaml | 11 +++- .../kubernetes-dashboard/templates/psp.yaml | 13 +++- .../kubernetes-dashboard/templates/role.yaml | 9 ++- .../templates/rolebinding.yaml | 9 ++- .../templates/secret.yaml | 13 +++- .../templates/service.yaml | 26 +++++--- .../templates/serviceaccount.yaml | 9 ++- .../kubernetes-dashboard/values.yaml | 15 ++++- 18 files changed, 219 insertions(+), 78 deletions(-) create mode 100644 aio/deploy/helm-chart/kubernetes-dashboard/templates/_tplvalues.tpl diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/Chart.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/Chart.yaml index 9ab7051a4336..eee7a6171d40 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/Chart.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/Chart.yaml @@ -14,22 +14,22 @@ apiVersion: v2 name: kubernetes-dashboard -version: 5.0.4 +version: 5.0.5 appVersion: 2.4.0 description: General-purpose web UI for Kubernetes clusters keywords: -- kubernetes -- dashboard + - kubernetes + - dashboard home: https://github.com/kubernetes/dashboard sources: -- https://github.com/kubernetes/dashboard + - https://github.com/kubernetes/dashboard maintainers: -- name: desaintmartin - email: cdesaintmartin@wiremind.fr + - name: desaintmartin + email: cdesaintmartin@wiremind.fr icon: https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.svg kubeVersion: ">=1.19.0-0" dependencies: -- name: metrics-server - version: 3.5.0 - repository: https://kubernetes-sigs.github.io/metrics-server/ - condition: metrics-server.enabled + - name: metrics-server + version: 3.5.0 + repository: https://kubernetes-sigs.github.io/metrics-server/ + condition: metrics-server.enabled diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/_tplvalues.tpl b/aio/deploy/helm-chart/kubernetes-dashboard/templates/_tplvalues.tpl new file mode 100644 index 000000000000..ba8fe55c540b --- /dev/null +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/_tplvalues.tpl @@ -0,0 +1,27 @@ +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-metrics.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-metrics.yaml index 441795f94641..46760dd1e103 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-metrics.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-metrics.yaml @@ -18,7 +18,14 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: "{{ template "kubernetes-dashboard.fullname" . }}-metrics" labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} rules: # Allow Metrics Scraper to get metrics from the Metrics server - apiGroups: ["metrics.k8s.io"] diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-readonly.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-readonly.yaml index 71d14bfa37b2..bd0669fa08bf 100755 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-readonly.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrole-readonly.yaml @@ -18,7 +18,14 @@ kind: ClusterRole metadata: name: "{{ template "kubernetes-dashboard.fullname" . }}-readonly" labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} rules: - apiGroups: - "" diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-metrics.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-metrics.yaml index d88c8192c990..d33715d3d305 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-metrics.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-metrics.yaml @@ -18,7 +18,14 @@ kind: ClusterRoleBinding metadata: name: "{{ template "kubernetes-dashboard.fullname" . }}-metrics" labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-readonly.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-readonly.yaml index c52647a339ae..4edc0f9712d7 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-readonly.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/clusterrolebinding-readonly.yaml @@ -18,7 +18,14 @@ kind: ClusterRoleBinding metadata: name: {{ template "kubernetes-dashboard.fullname" . }}-readonly labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/configmap.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/configmap.yaml index d4071b58561e..a23f8bb15f80 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/configmap.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/configmap.yaml @@ -16,7 +16,14 @@ apiVersion: v1 kind: ConfigMap metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} name: kubernetes-dashboard-settings data: {{- with .Values.settings }} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/deployment.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/deployment.yaml index 3ca8de241708..37c15bfff49b 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/deployment.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/deployment.yaml @@ -16,16 +16,22 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "kubernetes-dashboard.fullname" . }} -{{- with .Values.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + {{- with .Values.annotations }} + {{ toYaml . | nindent 4 }} + {{- end }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: kubernetes-dashboard -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.replicaCount }} strategy: @@ -35,24 +41,24 @@ spec: type: RollingUpdate selector: matchLabels: -{{ include "kubernetes-dashboard.matchLabels" . | indent 6 }} +{{ include "kubernetes-dashboard.matchLabels" . | nindent 6 }} app.kubernetes.io/component: kubernetes-dashboard template: metadata: -{{- with .Values.podAnnotations }} annotations: -{{ toYaml . | indent 8 }} -{{- end }} + {{- if .Values.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 8 }} + {{- include "kubernetes-dashboard.labels" . | nindent 8 }} app.kubernetes.io/component: kubernetes-dashboard -{{- with .Values.podLabels }} -{{ toYaml . | indent 8 }} -{{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} spec: {{- with .Values.securityContext }} securityContext: -{{ toYaml . | indent 8 }} +{{ toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ template "kubernetes-dashboard.serviceAccountName" . }} containers: @@ -70,11 +76,11 @@ spec: - --metrics-provider=none {{- end }} {{- with .Values.extraArgs }} -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} {{- with .Values.extraEnv }} env: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} ports: {{- if .Values.protocolHttp }} @@ -93,7 +99,7 @@ spec: - mountPath: /tmp name: tmp-volume {{- with .Values.extraVolumeMounts }} -{{ toYaml . | indent 8 }} +{{ toYaml . | nindent 8 }} {{- end }} livenessProbe: httpGet: @@ -110,11 +116,11 @@ spec: timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} {{- with .Values.resources }} resources: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} {{- with .Values.containerSecurityContext }} securityContext: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} {{- if .Values.metricsScraper.enabled }} - name: dashboard-metrics-scraper @@ -122,7 +128,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.metricsScraper.args }} args: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} ports: - containerPort: 8000 @@ -139,11 +145,11 @@ spec: name: tmp-volume {{- with .Values.metricsScraper.containerSecurityContext }} securityContext: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} {{- with .Values.metricsScraper.resources }} resources: -{{ toYaml . | indent 10 }} +{{ toYaml . | nindent 10 }} {{- end }} {{- end }} {{- with .Values.image.pullSecrets }} @@ -154,7 +160,7 @@ spec: {{- end }} {{- with .Values.nodeSelector }} nodeSelector: -{{ toYaml . | indent 8 }} +{{ toYaml . | nindent 8 }} {{- end }} {{- with .Values.priorityClassName }} priorityClassName: "{{ . }}" @@ -166,13 +172,13 @@ spec: - name: tmp-volume emptyDir: {} {{- with .Values.extraVolumes }} -{{ toYaml . | indent 6 }} +{{ toYaml . | nindent 6 }} {{- end }} {{- with .Values.tolerations }} tolerations: -{{ toYaml . | indent 8 }} +{{ toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: -{{ toYaml . | indent 8 }} +{{ toYaml . | nindent 8 }} {{- end }} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/ingress.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/ingress.yaml index 7c479c031482..cb1b05e13462 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/ingress.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/ingress.yaml @@ -21,21 +21,26 @@ kind: Ingress metadata: name: {{ template "kubernetes-dashboard.fullname" . }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} - {{- range $key, $value := .Values.ingress.labels }} + {{- include "kubernetes-dashboard.labels" . | nindent 4 }} + {{- range $key, $value := .Values.ingress.labels }} {{ $key }}: {{ $value | quote }} - {{- end }} - + {{- end }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} annotations: -{{- if not .Values.protocolHttp }} + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + {{- if not .Values.protocolHttp }} # Add https backend protocol support for ingress-nginx nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" # Add https backend protocol support for GKE service.alpha.kubernetes.io/app-protocols: '{"https":"HTTPS"}' -{{- end }} -{{- with .Values.ingress.annotations }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- end }} + {{- with .Values.ingress.annotations }} + {{ toYaml . | nindent 4 }} + {{- end }} spec: {{- with .Values.ingress.className }} ingressClassName: {{ . | quote }} @@ -47,7 +52,7 @@ spec: http: paths: {{- if len ($.Values.ingress.customPaths) }} - {{- "\n" }}{{ tpl (toYaml $.Values.ingress.customPaths | indent 10) $ }} + {{- "\n" }}{{ tpl (toYaml $.Values.ingress.customPaths | nindent 10) $ }} {{- else }} {{- range $p := $paths }} - path: {{ $p }} @@ -64,7 +69,7 @@ spec: - http: paths: {{- if len ($.Values.ingress.customPaths) }} - {{- "\n" }}{{ tpl (toYaml $.Values.ingress.customPaths | indent 10) $ }} + {{- "\n" }}{{ tpl (toYaml $.Values.ingress.customPaths | nindent 10) $ }} {{- else }} {{- range $p := $paths }} - path: {{ $p }} @@ -79,6 +84,6 @@ spec: {{- end -}} {{- if .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} +{{ toYaml .Values.ingress.tls | nindent 4 }} {{- end -}} {{- end -}} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/networkpolicy.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/networkpolicy.yaml index a550bd2eb202..d1961fe43a7f 100755 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/networkpolicy.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/networkpolicy.yaml @@ -22,10 +22,17 @@ metadata: chart: {{ template "kubernetes-dashboard.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- 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 }} spec: podSelector: matchLabels: -{{ include "kubernetes-dashboard.matchLabels" . | indent 6 }} +{{ include "kubernetes-dashboard.matchLabels" . | nindent 6 }} ingress: - ports: {{- if .Values.protocolHttp }} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/pdb.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/pdb.yaml index c044658baea8..c702278900db 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/pdb.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/pdb.yaml @@ -17,7 +17,14 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} name: {{ template "kubernetes-dashboard.fullname" . }} spec: {{- if .Values.podDisruptionBudget.minAvailable }} @@ -28,5 +35,5 @@ spec: {{- end }} selector: matchLabels: -{{ include "kubernetes-dashboard.matchLabels" . | indent 6 }} +{{ include "kubernetes-dashboard.matchLabels" . | nindent 6 }} {{- end -}} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/psp.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/psp.yaml index d630a6758002..fa86e1d24d59 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/psp.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/psp.yaml @@ -18,7 +18,14 @@ kind: PodSecurityPolicy metadata: name: {{ template "kubernetes-dashboard.fullname" . }}-psp labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} annotations: seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' spec: @@ -47,7 +54,7 @@ kind: RoleBinding metadata: name: {{ template "kubernetes-dashboard.fullname" . }}-psp labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} +{{ include "kubernetes-dashboard.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role @@ -62,7 +69,7 @@ kind: Role metadata: name: {{ template "kubernetes-dashboard.fullname" . }}-psp labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} +{{ include "kubernetes-dashboard.labels" . | nindent 4 }} rules: - apiGroups: - extensions diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/role.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/role.yaml index ef9a84a73184..8dd5937e05b7 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/role.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/role.yaml @@ -18,7 +18,14 @@ kind: Role metadata: name: {{ template "kubernetes-dashboard.fullname" . }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} rules: # Allow Dashboard to get, update and delete Dashboard exclusive secrets. - apiGroups: [""] diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/rolebinding.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/rolebinding.yaml index 01fb7638a5b6..80a7d0692700 100755 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/rolebinding.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/rolebinding.yaml @@ -18,7 +18,14 @@ kind: RoleBinding metadata: name: {{ template "kubernetes-dashboard.fullname" . }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/secret.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/secret.yaml index 72a28ac39f3e..2d1bfbe14517 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/secret.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/secret.yaml @@ -17,7 +17,14 @@ apiVersion: v1 kind: Secret metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} name: {{ template "kubernetes-dashboard.fullname" . }}-certs type: Opaque --- @@ -26,7 +33,7 @@ apiVersion: v1 kind: Secret metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} +{{ include "kubernetes-dashboard.labels" . | nindent 4 }} name: kubernetes-dashboard-csrf type: Opaque --- @@ -35,6 +42,6 @@ apiVersion: v1 kind: Secret metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} +{{ include "kubernetes-dashboard.labels" . | nindent 4 }} name: kubernetes-dashboard-key-holder type: Opaque diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/service.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/service.yaml index e5092d9da7c9..05f2417ae58b 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/service.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/service.yaml @@ -17,16 +17,22 @@ kind: Service metadata: name: {{ template "kubernetes-dashboard.fullname" . }} labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{ include "kubernetes-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: kubernetes-dashboard -{{ .Values.service.clusterServiceLabel.key | indent 4}}: {{ .Values.service.clusterServiceLabel.enabled | quote }} -{{- if .Values.service.labels }} -{{ toYaml .Values.service.labels | indent 4 }} -{{- end }} -{{- if .Values.service.annotations }} + {{ .Values.service.clusterServiceLabel.key | nindent 4}}: {{ .Values.service.clusterServiceLabel.enabled | quote }} + {{- if .Values.service.labels }} + {{ toYaml .Values.service.labels | nindent 4 }} + {{- end }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} annotations: -{{ toYaml .Values.service.annotations | indent 4 }} -{{- end }} + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.service.annotations }} + {{ toYaml .Values.service.annotations | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: @@ -43,10 +49,10 @@ spec: {{- end }} {{- if .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} +{{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} {{- end }} selector: -{{ include "kubernetes-dashboard.matchLabels" . | indent 4 }} +{{ include "kubernetes-dashboard.matchLabels" . | nindent 4 }} app.kubernetes.io/component: kubernetes-dashboard {{- if .Values.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/templates/serviceaccount.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/templates/serviceaccount.yaml index c276abadc4e1..580918686b16 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/templates/serviceaccount.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/templates/serviceaccount.yaml @@ -17,6 +17,13 @@ apiVersion: v1 kind: ServiceAccount metadata: labels: -{{ include "kubernetes-dashboard.labels" . | indent 4 }} + {{- include "kubernetes-dashboard.labels" . | 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 }} name: {{ template "kubernetes-dashboard.serviceAccountName" . }} {{- end -}} diff --git a/aio/deploy/helm-chart/kubernetes-dashboard/values.yaml b/aio/deploy/helm-chart/kubernetes-dashboard/values.yaml index 87d4a1eb64c8..02b58705fef7 100644 --- a/aio/deploy/helm-chart/kubernetes-dashboard/values.yaml +++ b/aio/deploy/helm-chart/kubernetes-dashboard/values.yaml @@ -27,6 +27,13 @@ image: ## Number of replicas replicaCount: 1 +## @param commonLabels Labels to add to all deployed objects +## +commonLabels: {} +## @param commonAnnotations Annotations to add to all deployed objects +## +commonAnnotations: {} + ## Here annotations can be added to the kubernetes dashboard deployment annotations: {} ## Here labels can be added to the kubernetes dashboard deployment @@ -68,8 +75,14 @@ securityContext: seccompProfile: type: RuntimeDefault -# Labels to be added to kubernetes dashboard pods +## @param podLabels Extra labels for OAuth2 Proxy pods +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## podLabels: {} +## @param podAnnotations Annotations for OAuth2 Proxy pods +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} ## Node labels for pod assignment ## Ref: https://kubernetes.io/docs/user-guide/node-selection/