From 81aeb27bd9afdbcfe3c99675f9a1682c05253d45 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 26 Jan 2023 16:24:35 +0200 Subject: [PATCH] some cleanup --- library/common/1.0.0/templates/lib/general/_labels.tpl | 10 ++++------ library/common/1.0.0/templates/lib/general/_names.tpl | 2 +- .../1.0.0/templates/lib/util/_annotation_render.tpl | 1 + .../common/1.0.0/templates/lib/util/_label_render.tpl | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/common/1.0.0/templates/lib/general/_labels.tpl b/library/common/1.0.0/templates/lib/general/_labels.tpl index 1797208458..5f81bc69fa 100644 --- a/library/common/1.0.0/templates/lib/general/_labels.tpl +++ b/library/common/1.0.0/templates/lib/general/_labels.tpl @@ -1,20 +1,18 @@ {{/* Common labels shared across objects */}} {{- define "ix.v1.common.labels" -}} -helm.sh/chart: {{ include "ix.v1.common.names.chart" . }} -{{ include "ix.v1.common.labels.selectorLabels" . }} + {{- include "ix.v1.common.labels.selectorLabels" . -}} {{- if .Chart.AppVersion }} -helm-revision: {{ .Release.Revision | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +helm.sh/chart: {{ include "ix.v1.common.names.chart" . }} +helm-revision: {{ .Release.Revision | quote }} + {{/* Append global labels */}} {{- include "ix.v1.common.util.labels.render" (dict "root" . "labels" .Values.global.labels) -}} {{- end -}} {{/* Selector labels shared across objects */}} -{{/* TODO: Check why "app" and "release" are needed (ported from the current common) */}} {{- define "ix.v1.common.labels.selectorLabels" -}} app.kubernetes.io/name: {{ include "ix.v1.common.names.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} -app: {{ include "ix.v1.common.names.name" . }} -release: {{ .Release.Name }} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/general/_names.tpl b/library/common/1.0.0/templates/lib/general/_names.tpl index c810bafdf9..a32aaa7998 100644 --- a/library/common/1.0.0/templates/lib/general/_names.tpl +++ b/library/common/1.0.0/templates/lib/general/_names.tpl @@ -23,7 +23,7 @@ nameOverride applies only to the current chart {{- $globalFullNameOverride := "" -}} {{- if hasKey .Values "global" -}} - {{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}} + {{- $globalFullNameOverride = (.Values.global.fullnameOverride | default $globalFullNameOverride) -}} {{- end -}} {{- if or .Values.fullnameOverride $globalFullNameOverride -}} diff --git a/library/common/1.0.0/templates/lib/util/_annotation_render.tpl b/library/common/1.0.0/templates/lib/util/_annotation_render.tpl index 14647391ac..a5d628c369 100644 --- a/library/common/1.0.0/templates/lib/util/_annotation_render.tpl +++ b/library/common/1.0.0/templates/lib/util/_annotation_render.tpl @@ -3,6 +3,7 @@ {{- define "ix.v1.common.util.annotations.render" -}} {{- $root := .root -}} {{- $annotations := .annotations -}} + {{- if $annotations }} {{- range $k, $v := $annotations }} {{ $k }}: {{ tpl $v $root | quote }} diff --git a/library/common/1.0.0/templates/lib/util/_label_render.tpl b/library/common/1.0.0/templates/lib/util/_label_render.tpl index d151dfcc28..f41a02a656 100644 --- a/library/common/1.0.0/templates/lib/util/_label_render.tpl +++ b/library/common/1.0.0/templates/lib/util/_label_render.tpl @@ -3,6 +3,7 @@ {{- define "ix.v1.common.util.labels.render" -}} {{- $root := .root -}} {{- $labels := .labels -}} + {{- if $labels -}} {{- range $k, $v := $labels }} {{ $k }}: {{ tpl $v $root | quote }}