diff --git a/deploy/charts/istio-csr/README.md b/deploy/charts/istio-csr/README.md index 278d211d..52c75b54 100644 --- a/deploy/charts/istio-csr/README.md +++ b/deploy/charts/istio-csr/README.md @@ -426,5 +426,12 @@ tolerations: > ```yaml > {} > ``` +#### **commonLabels** ~ `object` +> Default value: +> ```yaml +> {} +> ``` + +Labels to apply to all resources \ No newline at end of file diff --git a/deploy/charts/istio-csr/templates/_helpers.tpl b/deploy/charts/istio-csr/templates/_helpers.tpl index 1efa5448..0de7cd09 100644 --- a/deploy/charts/istio-csr/templates/_helpers.tpl +++ b/deploy/charts/istio-csr/templates/_helpers.tpl @@ -24,6 +24,9 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.commonLabels }} +{{ toYaml .Values.commonLabels }} +{{- end }} {{- end -}} {{/* diff --git a/deploy/charts/istio-csr/templates/certificate.yaml b/deploy/charts/istio-csr/templates/certificate.yaml index 5aacb42b..93bb234a 100644 --- a/deploy/charts/istio-csr/templates/certificate.yaml +++ b/deploy/charts/istio-csr/templates/certificate.yaml @@ -4,6 +4,8 @@ kind: Certificate metadata: name: istiod namespace: {{ .Values.app.istio.namespace }} + labels: + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} {{- if .Values.app.certmanager.additionalAnnotations }} annotations: {{- range $annotation := .Values.app.certmanager.additionalAnnotations }} diff --git a/deploy/charts/istio-csr/templates/clusterrole.yaml b/deploy/charts/istio-csr/templates/clusterrole.yaml index 8949b2c7..b61f53ad 100644 --- a/deploy/charts/istio-csr/templates/clusterrole.yaml +++ b/deploy/charts/istio-csr/templates/clusterrole.yaml @@ -2,7 +2,7 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} name: {{ include "cert-manager-istio-csr.name" . }} rules: - apiGroups: diff --git a/deploy/charts/istio-csr/templates/clusterrolebinding.yaml b/deploy/charts/istio-csr/templates/clusterrolebinding.yaml index f4389f45..52c7b132 100644 --- a/deploy/charts/istio-csr/templates/clusterrolebinding.yaml +++ b/deploy/charts/istio-csr/templates/clusterrolebinding.yaml @@ -2,7 +2,7 @@ kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} name: {{ include "cert-manager-istio-csr.name" . }} roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/deploy/charts/istio-csr/templates/deployment.yaml b/deploy/charts/istio-csr/templates/deployment.yaml index 47e1acdd..f27169fa 100644 --- a/deploy/charts/istio-csr/templates/deployment.yaml +++ b/deploy/charts/istio-csr/templates/deployment.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "cert-manager-istio-csr.name" . }} namespace: {{ .Release.Namespace }} labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: @@ -14,6 +14,7 @@ spec: metadata: labels: app: {{ include "cert-manager-istio-csr.name" . }} + {{- include "cert-manager-istio-csr.labels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/deploy/charts/istio-csr/templates/metrics-service.yaml b/deploy/charts/istio-csr/templates/metrics-service.yaml index d2a0dd8b..c0461d26 100644 --- a/deploy/charts/istio-csr/templates/metrics-service.yaml +++ b/deploy/charts/istio-csr/templates/metrics-service.yaml @@ -6,7 +6,7 @@ metadata: namespace: {{ .Release.Namespace }} labels: app: {{ include "cert-manager-istio-csr.name" . }}-metrics -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} spec: type: {{ .Values.app.metrics.service.type }} ports: diff --git a/deploy/charts/istio-csr/templates/metrics-servicemonitor.yaml b/deploy/charts/istio-csr/templates/metrics-servicemonitor.yaml index 4147a0db..a22dcffa 100644 --- a/deploy/charts/istio-csr/templates/metrics-servicemonitor.yaml +++ b/deploy/charts/istio-csr/templates/metrics-servicemonitor.yaml @@ -6,7 +6,7 @@ metadata: namespace: {{ .Release.Namespace }} labels: app: {{ include "cert-manager-istio-csr.name" . }} -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} prometheus: {{ .Values.app.metrics.service.servicemonitor.prometheusInstance }} {{- if .Values.app.metrics.service.servicemonitor.labels }} {{ toYaml .Values.app.metrics.service.servicemonitor.labels | indent 4}} diff --git a/deploy/charts/istio-csr/templates/role.yaml b/deploy/charts/istio-csr/templates/role.yaml index 1151682a..e7e3ca33 100644 --- a/deploy/charts/istio-csr/templates/role.yaml +++ b/deploy/charts/istio-csr/templates/role.yaml @@ -2,7 +2,7 @@ kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} name: {{ include "cert-manager-istio-csr.name" . }} namespace: {{ .Values.app.certmanager.namespace }} rules: diff --git a/deploy/charts/istio-csr/templates/role_leases.yaml b/deploy/charts/istio-csr/templates/role_leases.yaml index db6e0d3e..d69d7d1c 100644 --- a/deploy/charts/istio-csr/templates/role_leases.yaml +++ b/deploy/charts/istio-csr/templates/role_leases.yaml @@ -2,7 +2,7 @@ kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} name: {{ include "cert-manager-istio-csr.name" . }}-leases namespace: {{ .Values.app.controller.leaderElectionNamespace }} rules: diff --git a/deploy/charts/istio-csr/templates/rolebinding.yaml b/deploy/charts/istio-csr/templates/rolebinding.yaml index 352f4e1e..3aab1d7d 100644 --- a/deploy/charts/istio-csr/templates/rolebinding.yaml +++ b/deploy/charts/istio-csr/templates/rolebinding.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "cert-manager-istio-csr.name" . }} namespace: {{ .Values.app.certmanager.namespace }} labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role diff --git a/deploy/charts/istio-csr/templates/rolebinding_leases.yaml b/deploy/charts/istio-csr/templates/rolebinding_leases.yaml index 989dd223..ffe06f50 100644 --- a/deploy/charts/istio-csr/templates/rolebinding_leases.yaml +++ b/deploy/charts/istio-csr/templates/rolebinding_leases.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "cert-manager-istio-csr.name" . }}-leases namespace: {{ .Values.app.controller.leaderElectionNamespace }} labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role diff --git a/deploy/charts/istio-csr/templates/service.yaml b/deploy/charts/istio-csr/templates/service.yaml index 13d5c6e5..c49a970f 100644 --- a/deploy/charts/istio-csr/templates/service.yaml +++ b/deploy/charts/istio-csr/templates/service.yaml @@ -5,7 +5,7 @@ metadata: namespace: {{ .Release.Namespace }} labels: app: {{ include "cert-manager-istio-csr.name" . }} -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: diff --git a/deploy/charts/istio-csr/templates/serviceaccount.yaml b/deploy/charts/istio-csr/templates/serviceaccount.yaml index 38a6ca99..0ad33a9d 100644 --- a/deploy/charts/istio-csr/templates/serviceaccount.yaml +++ b/deploy/charts/istio-csr/templates/serviceaccount.yaml @@ -6,6 +6,6 @@ imagePullSecrets: {{- end }} metadata: labels: -{{ include "cert-manager-istio-csr.labels" . | indent 4 }} + {{- include "cert-manager-istio-csr.labels" . | nindent 4 }} name: {{ include "cert-manager-istio-csr.name" . }} namespace: {{ .Release.Namespace }} diff --git a/deploy/charts/istio-csr/values.schema.json b/deploy/charts/istio-csr/values.schema.json index 26e143dc..7d626e19 100644 --- a/deploy/charts/istio-csr/values.schema.json +++ b/deploy/charts/istio-csr/values.schema.json @@ -9,6 +9,9 @@ "app": { "$ref": "#/$defs/helm-values.app" }, + "commonLabels": { + "$ref": "#/$defs/helm-values.commonLabels" + }, "image": { "$ref": "#/$defs/helm-values.image" }, @@ -444,6 +447,11 @@ "description": "The Istio cluster's trust domain.", "type": "string" }, + "helm-values.commonLabels": { + "default": {}, + "description": "Labels to apply to all resources", + "type": "object" + }, "helm-values.image": { "additionalProperties": false, "properties": { diff --git a/deploy/charts/istio-csr/values.yaml b/deploy/charts/istio-csr/values.yaml index b45d08bb..4a2a22b3 100644 --- a/deploy/charts/istio-csr/values.yaml +++ b/deploy/charts/istio-csr/values.yaml @@ -230,3 +230,6 @@ affinity: {} tolerations: [] nodeSelector: {} + +# Labels to apply to all resources +commonLabels: {}