Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add full support for labels and annotations in helm chart #9490

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/kubernetes-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

apiVersion: v2
name: kubernetes-dashboard
version: 7.6.1
version: 7.7.0
description: General-purpose web UI for Kubernetes clusters
keywords:
- kubernetes
Expand Down
12 changes: 12 additions & 0 deletions charts/kubernetes-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ helm.sh/chart: {{ include "kubernetes-dashboard.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: {{ include "kubernetes-dashboard.name" . }}
{{- with .Values.app.labels }}
{{- toYaml . }}
{{- end }}
{{- end -}}

{{/*
Expand All @@ -63,6 +66,15 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ include "kubernetes-dashboard.name" . }}
{{- end -}}

{{/*
Common annotations
*/}}
{{- define "kubernetes-dashboard.annotations" -}}
{{- with .Values.app.annotations }}
{{- toYaml . }}
{{- end }}
{{- end -}}

{{- define "kubernetes-dashboard.app.csrf.secret.name" -}}
{{- printf "%s-%s" ( include "kubernetes-dashboard.fullname" . ) "csrf"}}
{{- end -}}
Expand Down
27 changes: 0 additions & 27 deletions charts/kubernetes-dashboard/templates/_tplvalues.tpl

This file was deleted.

2 changes: 2 additions & 0 deletions charts/kubernetes-dashboard/templates/config/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ kind: ConfigMap
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ .Values.kong.dblessConfig.configMap }}
data:
kong.yml: |
Expand Down
2 changes: 2 additions & 0 deletions charts/kubernetes-dashboard/templates/config/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ kind: ConfigMap
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.web.configMap.settings.name" . }}
data:
{{- with .Values.app.settings.global }}
Expand Down
5 changes: 3 additions & 2 deletions charts/kubernetes-dashboard/templates/deployments/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.api.labels }}
{{ toYaml . | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}
app.kubernetes.io/version: {{ .Values.api.image.tag }}
app.kubernetes.io/component: {{ .Values.api.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.api.annotations }}
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
spec:
Expand Down
5 changes: 3 additions & 2 deletions charts/kubernetes-dashboard/templates/deployments/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.auth.labels }}
{{ toYaml . | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
app.kubernetes.io/version: {{ .Values.api.image.tag }}
app.kubernetes.io/component: {{ .Values.auth.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.auth.annotations }}
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.auth.role }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.metricsScraper.labels }}
{{ toYaml . | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.metricsScraper.role }}
app.kubernetes.io/version: {{ .Values.metricsScraper.image.tag }}
app.kubernetes.io/component: {{ .Values.metricsScraper.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.metricsScraper.annotations }}
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.metrics-scraper.name" . }}
spec:
Expand Down
5 changes: 3 additions & 2 deletions charts/kubernetes-dashboard/templates/deployments/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.web.labels }}
{{ toYaml . | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.web.role }}
app.kubernetes.io/version: {{ .Values.web.image.tag }}
app.kubernetes.io/component: {{ .Values.web.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.web.annotations }}
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}
spec:
Expand Down
18 changes: 8 additions & 10 deletions charts/kubernetes-dashboard/templates/extras/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ kind: ServiceMonitor
metadata:
name: {{ template "kubernetes-dashboard.fullname" . }}
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- if .Values.app.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.app.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.extras.serviceMonitor.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extras.serviceMonitor.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.extras.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.extras.serviceMonitor.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extras.serviceMonitor.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.extras.serviceMonitor.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: https
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- if eq .Values.app.ingress.issuer.scope "default" }}
cert-manager.io/issuer: {{ .Values.app.ingress.issuer.name }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions charts/kubernetes-dashboard/templates/rbac/api/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.api.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.api.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
rules:
# Allow Dashboard API to get metrics from metrics-scraper.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ kind: RoleBinding
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.api.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.api.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ kind: ServiceAccount
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.api.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.api.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}

{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.metricsScraper.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.metricsScraper.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.metricsScraper.role }}
rules:
# Allow Metrics Scraper to get metrics from the Metrics server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ kind: ClusterRoleBinding
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.metricsScraper.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.metricsScraper.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.metricsScraper.role }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ kind: ServiceAccount
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.metricsScraper.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.metricsScraper.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.metricsScraper.role }}

{{- end -}}
2 changes: 2 additions & 0 deletions charts/kubernetes-dashboard/templates/rbac/web/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}
rules:
# Allow Dashboard Web to get and update 'kubernetes-dashboard-settings' config map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ kind: RoleBinding
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ kind: ServiceAccount
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.web.role }}

{{- end -}}
2 changes: 2 additions & 0 deletions charts/kubernetes-dashboard/templates/secrets/csrf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ kind: Secret
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.app.csrf.secret.name" . }}
data:
{{ (include "kubernetes-dashboard.app.csrf.secret.value" . ) -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ template "kubernetes-dashboard.fullname" . }}
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- if .Values.app.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.app.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- if .Values.app.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.app.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.fullname" . }}
spec:
podSelector:
matchLabels:
Expand Down
9 changes: 2 additions & 7 deletions charts/kubernetes-dashboard/templates/security/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- if .Values.app.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.app.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
annotations:
{{- if .Values.app.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.app.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
name: {{ template "kubernetes-dashboard.fullname" . }}
spec:
selector:
Expand Down
8 changes: 8 additions & 0 deletions charts/kubernetes-dashboard/templates/services/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ apiVersion: v1
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.api.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}
app.kubernetes.io/version: {{ .Values.api.image.tag }}
app.kubernetes.io/component: {{ .Values.api.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.api.serviceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.api.role }}
spec:
ports:
Expand Down
8 changes: 8 additions & 0 deletions charts/kubernetes-dashboard/templates/services/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ apiVersion: v1
metadata:
labels:
{{- include "kubernetes-dashboard.labels" . | nindent 4 }}
{{- with .Values.auth.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
app.kubernetes.io/version: {{ .Values.auth.image.tag }}
app.kubernetes.io/component: {{ .Values.auth.role }}
annotations:
{{- include "kubernetes-dashboard.annotations" . | nindent 4 }}
{{- with .Values.auth.serviceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "kubernetes-dashboard.fullname" . }}-{{ .Values.auth.role }}
spec:
ports:
Expand Down
Loading
Loading