From c4b335e1f8f308307bba57443c99d84f3b1939d7 Mon Sep 17 00:00:00 2001 From: "M. David Bennett" Date: Tue, 11 Feb 2020 12:58:04 -0600 Subject: [PATCH] Fix broken labels (#251) * Fix broken labels Turns out k8s doesn't like having a plus "+" sign in labels, meaning I need to convert the "+" sign in the version to a supported character. This does that. Signed-off-by: M. David Bennett * Remove indent. Signed-off-by: M. David Bennett --- helm/opsy/templates/_helpers.tpl | 4 ++-- helm/opsy/templates/database_migration.yaml | 6 +----- helm/opsy/templates/deployment.yaml | 6 +----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/helm/opsy/templates/_helpers.tpl b/helm/opsy/templates/_helpers.tpl index 061faa5..8097fc6 100644 --- a/helm/opsy/templates/_helpers.tpl +++ b/helm/opsy/templates/_helpers.tpl @@ -36,7 +36,7 @@ Common labels */}} {{- define "opsy.labels" -}} app.kubernetes.io/name: {{ include "opsy.name" . }} -helm.sh/chart: {{ include "opsy.chart" . }} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} app.kubernetes.io/instance: {{ .Release.Name }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} @@ -49,7 +49,7 @@ Migration labels */}} {{- define "opsy.migrationLabels" -}} app.kubernetes.io/name: {{ include "opsy.name" . }}-database-migrations -helm.sh/chart: {{ include "opsy.chart" . }} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} app.kubernetes.io/instance: {{ .Release.Name }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} diff --git a/helm/opsy/templates/database_migration.yaml b/helm/opsy/templates/database_migration.yaml index f40783c..ea1d9a5 100644 --- a/helm/opsy/templates/database_migration.yaml +++ b/helm/opsy/templates/database_migration.yaml @@ -14,11 +14,7 @@ spec: metadata: name: {{ include "opsy.fullname" . }}-database-migration labels: - app: {{ include "opsy.fullname" . }} - app.kubernetes.io/name: {{ include "opsy.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service | quote }} - app.kubernetes.io/instance: {{ .Release.Name | quote }} - helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +{{ include "opsy.migrationLabels" . | indent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} diff --git a/helm/opsy/templates/deployment.yaml b/helm/opsy/templates/deployment.yaml index cfc0fa3..f874e3c 100644 --- a/helm/opsy/templates/deployment.yaml +++ b/helm/opsy/templates/deployment.yaml @@ -13,11 +13,7 @@ spec: template: metadata: labels: - app: {{ include "opsy.fullname" . }} - app.kubernetes.io/name: {{ include "opsy.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service | quote }} - app.kubernetes.io/instance: {{ .Release.Name | quote }} - helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +{{ include "opsy.labels" . | indent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}