From 96ca830e6483fe9b8f3c2e58f98b079188f6c6b6 Mon Sep 17 00:00:00 2001 From: Sebastien Baizet Date: Wed, 25 Sep 2024 14:54:15 +0200 Subject: [PATCH] fix missing labels on config files --- .../templates/config-file.yaml | 2 + .../admin-system-cron/templates/helpers.tpl | 47 +++++++++++++++++++ charts/frontends/templates/config-file.yaml | 2 + .../templates/config-file.yaml | 2 + 4 files changed, 53 insertions(+) create mode 100644 charts/admin-system-cron/templates/helpers.tpl diff --git a/charts/admin-system-cron/templates/config-file.yaml b/charts/admin-system-cron/templates/config-file.yaml index 8f90e766..854e5fad 100644 --- a/charts/admin-system-cron/templates/config-file.yaml +++ b/charts/admin-system-cron/templates/config-file.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: admin-system-cron-config + labels: + {{- include "scroll-sdk.labels" $ | nindent 4 }} data: admin-system-backend-config.json: | {{ .Values.scrollConfig | indent 4 }} diff --git a/charts/admin-system-cron/templates/helpers.tpl b/charts/admin-system-cron/templates/helpers.tpl new file mode 100644 index 00000000..d762ba10 --- /dev/null +++ b/charts/admin-system-cron/templates/helpers.tpl @@ -0,0 +1,47 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "scroll-sdk.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "scroll-sdk.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} +{{/* +Create chart name and build as used by the chart label. +*/}} +{{- define "scroll-sdk.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} +{{/* +Common labels +*/}} +{{- define "scroll-sdk.labels" -}} +helm.sh/chart: {{ include "scroll-sdk.chart" . }} +{{ include "scroll-sdk.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/build: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} +{{/* +Selector labels +*/}} +{{- define "scroll-sdk.selectorLabels" -}} +app.kubernetes.io/name: {{ include "scroll-sdk.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/frontends/templates/config-file.yaml b/charts/frontends/templates/config-file.yaml index 20854dbc..53548c1a 100644 --- a/charts/frontends/templates/config-file.yaml +++ b/charts/frontends/templates/config-file.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: frontends-config + labels: + {{- include "scroll-sdk.labels" $ | nindent 4 }} data: frontend-config: | {{ .Values.scrollConfig | indent 4 }} diff --git a/charts/rollup-explorer-backend/templates/config-file.yaml b/charts/rollup-explorer-backend/templates/config-file.yaml index 3c9c56e1..d0d14342 100644 --- a/charts/rollup-explorer-backend/templates/config-file.yaml +++ b/charts/rollup-explorer-backend/templates/config-file.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: ConfigMap metadata: name: rollup-explorer-backend-config + labels: + {{- include "scroll-sdk.labels" $ | nindent 4 }} data: config.json: | {{ .Values.scrollConfig | indent 4 }}