From 309a5a5a4b979ebe5ca4a47bf86a7f1dc949dbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D0=B5=D0=BC=20=D0=94=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=D0=BB=D1=8F=D0=BD?= Date: Wed, 23 Aug 2023 16:11:28 +0700 Subject: [PATCH] 2.4.1 fixes --- CHANGELOG.md | 6 ++++++ Chart.yaml | 2 +- templates/deployment.yml | 1 + templates/helpers/_pod.tpl | 4 ++-- templates/helpers/_workloads.tpl | 16 ++++++++-------- templates/serviceaccount.yml | 10 +++++----- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b3bd52..4dca7e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.4.1 - August 23, 2023 +* fix: render serviceaccount names +* fix: merging env if both general and container envs are used ([#50](https://github.com/nixys/nxs-universal-chart/issues/50)) +* fix: deploymentsGeneral.annotation applying to deployment ([#49](https://github.com/nixys/nxs-universal-chart/issues/49)) + + ## 2.4.0 - July 21, 2023 * feature: add Service Account workload to create serviceaccount and coresponding roles/clusterroles with bindings * fix: default container and init-container names diff --git a/Chart.yaml b/Chart.yaml index f7f2e86..6cc2e1f 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: Nixys universal Helm chart for deploy your apps to Kubernetes name: universal-chart -version: 2.4.0 +version: 2.4.1 maintainers: - name: Roman Andreev email: r.andreev@nixys.ru diff --git a/templates/deployment.yml b/templates/deployment.yml index 49fddba..7dee8fa 100644 --- a/templates/deployment.yml +++ b/templates/deployment.yml @@ -13,6 +13,7 @@ metadata: {{- with .labels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }} annotations: {{- include "helpers.app.genericAnnotations" $ | indent 4 }} + {{- with $general.annotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }} {{- with .annotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }} spec: replicas: {{ .replicas | default 1 }} diff --git a/templates/helpers/_pod.tpl b/templates/helpers/_pod.tpl index 00ec276..26c25a8 100644 --- a/templates/helpers/_pod.tpl +++ b/templates/helpers/_pod.tpl @@ -7,9 +7,9 @@ {{- $name := .name -}} {{- with .value -}} {{- if .serviceAccountName }} -serviceAccountName: {{ .serviceAccountName }} +serviceAccountName: {{- include "helpers.tplvalues.render" (dict "value" .serviceAccountName "context" $) | nindent 2 }} {{- else if $.Values.generic.serviceAccountName }} -serviceAccountName: {{ $.Values.generic.serviceAccountName }} +serviceAccountName: {{- include "helpers.tplvalues.render" (dict "value" $.Values.generic.serviceAccountName "context" $) | nindent 2 }} {{- end }} {{- if .hostAliases }} hostAliases: {{- include "helpers.tplvalues.render" (dict "value" .hostAliases "context" $) | nindent 2 }} diff --git a/templates/helpers/_workloads.tpl b/templates/helpers/_workloads.tpl index be99d40..6cbddcd 100644 --- a/templates/helpers/_workloads.tpl +++ b/templates/helpers/_workloads.tpl @@ -6,10 +6,10 @@ env: {{ with $general.envsFromConfigmap }}{{- include "helpers.configmaps.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} {{ with $v.envsFromConfigmap }}{{- include "helpers.configmaps.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $general.envsFromSecret }}{{- include "helpers.secrets.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $v.envsFromSecret }}{{- include "helpers.secrets.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $general.env }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $v.env }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $general.envsFromSecret }}{{- include "helpers.secrets.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $v.envsFromSecret }}{{- include "helpers.secrets.includeEnv" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $general.env }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $v.env }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} {{- end }} {{- end }} @@ -21,10 +21,10 @@ env: envFrom: {{ with $general.envConfigmaps }}{{- include "helpers.configmaps.includeEnvConfigmap" ( dict "value" . "context" $ctx) }}{{- end }} {{ with $v.envConfigmaps }}{{- include "helpers.configmaps.includeEnvConfigmap" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $general.envSecrets }}{{- include "helpers.secrets.includeEnvSecret" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $v.envSecrets }}{{- include "helpers.secrets.includeEnvSecret" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $general.envFrom }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} -{{- with $v.envFrom }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $general.envSecrets }}{{- include "helpers.secrets.includeEnvSecret" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $v.envSecrets }}{{- include "helpers.secrets.includeEnvSecret" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $general.envFrom }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} +{{ with $v.envFrom }}{{- include "helpers.tplvalues.render" ( dict "value" . "context" $ctx) }}{{- end }} {{- end }} {{- end }} diff --git a/templates/serviceaccount.yml b/templates/serviceaccount.yml index 2f16a87..56e4917 100644 --- a/templates/serviceaccount.yml +++ b/templates/serviceaccount.yml @@ -11,7 +11,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ $name }} + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} namespace: {{ $.Release.Namespace | quote }} labels: {{- include "helpers.app.labels" $ | nindent 4 }} @@ -60,7 +60,7 @@ roleRef: name: {{ include "helpers.app.fullname" (dict "name" $val.role.name "context" $) }} subjects: - kind: ServiceAccount - name: {{ $name }} + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} namespace: {{ $.Release.Namespace | quote }} {{- else }} --- @@ -83,7 +83,7 @@ roleRef: name: {{ $val.role.name }} subjects: - kind: ServiceAccount - name: {{ $name }} + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} namespace: {{ $.Release.Namespace | quote }} {{- end }} {{- end }} @@ -123,7 +123,7 @@ roleRef: name: {{ include "helpers.app.fullname" (dict "name" $val.clusterRole.name "context" $) }} subjects: - kind: ServiceAccount - name: {{ $name }} + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} namespace: {{ $.Release.Namespace | quote }} {{- else }} --- @@ -145,7 +145,7 @@ roleRef: name: {{ $val.clusterRole.name }} subjects: - kind: ServiceAccount - name: {{ $name }} + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} namespace: {{ $.Release.Namespace | quote }} {{- end }} {{- end }}