From 78a10345d2e78e25ea1dc97e303172a7f3ca9671 Mon Sep 17 00:00:00 2001 From: Svetomir Smiljkovic Date: Wed, 26 Aug 2020 14:26:24 +0200 Subject: [PATCH] Improve labels for volumeClaimTemplates to allow char upgrade (#34) * Improve labels for volumeClaimTemplates to allow char upgrade * Add chart name into volumeClaimTemplate --- charts/bee/Chart.yaml | 2 +- charts/bee/templates/_helpers.tpl | 20 ++++++++++++++++++++ charts/bee/templates/statefulset.yaml | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/charts/bee/Chart.yaml b/charts/bee/Chart.yaml index da2a7ca..8ec55d0 100644 --- a/charts/bee/Chart.yaml +++ b/charts/bee/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 appVersion: latest name: bee -version: 0.5.2 +version: 0.5.3 description: Ethereum Swarm Bee Helm chart for Kubernetes home: https://swarm.ethereum.org icon: https://swarm-guide.readthedocs.io/en/latest/_images/swarm.png diff --git a/charts/bee/templates/_helpers.tpl b/charts/bee/templates/_helpers.tpl index 2aa2ed8..37f5d94 100644 --- a/charts/bee/templates/_helpers.tpl +++ b/charts/bee/templates/_helpers.tpl @@ -43,6 +43,26 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "bee.chartVCT" -}} +{{- printf "%s" .Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels for volumeClaimTemplates +*/}} +{{- define "bee.labelsVCT" -}} +helm.sh/chart: {{ include "bee.chartVCT" . }} +{{ include "bee.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + {{/* Selector labels */}} diff --git a/charts/bee/templates/statefulset.yaml b/charts/bee/templates/statefulset.yaml index 17102a4..eab988f 100644 --- a/charts/bee/templates/statefulset.yaml +++ b/charts/bee/templates/statefulset.yaml @@ -171,7 +171,7 @@ spec: - metadata: name: data labels: - {{- include "bee.labels" . | nindent 8 }} + {{- include "bee.labelsVCT" . | nindent 8 }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }}