From 29615ca832ea02b71e1a5261f0cc0328085cac09 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 2 Sep 2021 14:41:22 +0200 Subject: [PATCH] Add labels to more common objects and add names.fqdn (#884) * Add labels to more common objects and add names.fqdn * whoops copy pasta mistake --- charts/library/common/Chart.yaml | 2 +- charts/library/common/templates/_networkPolicy.tpl | 2 ++ charts/library/common/templates/_rbac.tpl | 2 ++ charts/library/common/templates/configmaps/_portal.tpl | 3 ++- charts/library/common/templates/lib/chart/_names.tpl | 7 +++++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index ec226dc64e0..40d40613a96 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: common sources: null type: library -version: 6.13.1 +version: 6.13.2 diff --git a/charts/library/common/templates/_networkPolicy.tpl b/charts/library/common/templates/_networkPolicy.tpl index 1db7f76ee6b..4ac6e2c95a5 100644 --- a/charts/library/common/templates/_networkPolicy.tpl +++ b/charts/library/common/templates/_networkPolicy.tpl @@ -7,6 +7,8 @@ Blueprint for the NetworkPolicy object that can be included in the addon. kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: + labels: + {{- include "common.labels" . | nindent 4 }} name: {{ include "common.names.fullname" . }} spec: podSelector: diff --git a/charts/library/common/templates/_rbac.tpl b/charts/library/common/templates/_rbac.tpl index f29f3e8fef8..7599c54e876 100644 --- a/charts/library/common/templates/_rbac.tpl +++ b/charts/library/common/templates/_rbac.tpl @@ -10,6 +10,7 @@ kind: ClusterRole metadata: name: {{ include "common.names.fullname" . -}} labels: + {{- include "common.labels" . | nindent 4 }} {{- with .Values.rbac.labels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -27,6 +28,7 @@ kind: ClusterRoleBinding metadata: name: {{ include "common.names.fullname" . -}} labels: + {{- include "common.labels" . | nindent 4 }} {{- with .Values.rbac.labels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/library/common/templates/configmaps/_portal.tpl b/charts/library/common/templates/configmaps/_portal.tpl index f77d7804d17..3f776988e79 100644 --- a/charts/library/common/templates/configmaps/_portal.tpl +++ b/charts/library/common/templates/configmaps/_portal.tpl @@ -71,7 +71,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: portal - labels: {{ include "common.labels" . | nindent 4 }} + labels: + {{ include "common.labels" . | nindent 4 }} annotations: rollme: {{ randAlphaNum 5 | quote }} data: diff --git a/charts/library/common/templates/lib/chart/_names.tpl b/charts/library/common/templates/lib/chart/_names.tpl index a32d572ffe7..86d573f38f4 100644 --- a/charts/library/common/templates/lib/chart/_names.tpl +++ b/charts/library/common/templates/lib/chart/_names.tpl @@ -56,3 +56,10 @@ If release name contains chart name it will be used as a full name. {{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}} {{- end -}} {{- end -}} + +{{/* +Create the "name" + "." + "namespace" fqdn +*/}} +{{- define "common.names.fqdn" -}} +{{- printf "%s.%s" (include "common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}}