From 799baea4dc8ac04b585997373314eaffba3fd914 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 10 Oct 2021 00:02:33 +0200 Subject: [PATCH] seperate setup and post-setup to prevent double setup runs on common chart --- charts/incubator/sogo/templates/common.yaml | 2 +- charts/library/common/Chart.yaml | 2 +- charts/library/common/templates/_all.tpl | 56 +----------------- .../library/common/templates/_postSetup.tpl | 59 +++++++++++++++++++ charts/stable/authelia/templates/common.yaml | 2 +- .../stable/fireflyiii/templates/common.yaml | 2 +- .../stable/freeradius/templates/common.yaml | 2 +- charts/stable/gitea/templates/common.yaml | 2 +- .../stable/k8s-gateway/templates/common.yaml | 2 +- .../stable/littlelink/templates/common.yaml | 2 +- charts/stable/mosquitto/templates/common.yaml | 2 +- charts/stable/nextcloud/templates/common.yaml | 2 +- charts/stable/openldap/templates/common.yaml | 2 +- charts/stable/pihole/templates/common.yaml | 2 +- charts/stable/traefik/templates/common.yaml | 2 +- 15 files changed, 74 insertions(+), 67 deletions(-) create mode 100644 charts/library/common/templates/_postSetup.tpl diff --git a/charts/incubator/sogo/templates/common.yaml b/charts/incubator/sogo/templates/common.yaml index 6fcc8fbce16..e0a42e551ca 100644 --- a/charts/incubator/sogo/templates/common.yaml +++ b/charts/incubator/sogo/templates/common.yaml @@ -23,4 +23,4 @@ volumeSpec: {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 9264602f925..96266bf800f 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 8.3.2 +version: 8.3.3 diff --git a/charts/library/common/templates/_all.tpl b/charts/library/common/templates/_all.tpl index 887cfea96dc..52cb4116f09 100644 --- a/charts/library/common/templates/_all.tpl +++ b/charts/library/common/templates/_all.tpl @@ -5,59 +5,7 @@ Main entrypoint for the common library chart. It will render all underlying temp {{- /* Generate chart and dependency values */ -}} {{- include "common.setup" . }} - {{- /* Enable code-server add-on if required */ -}} - {{- if .Values.addons.codeserver.enabled }} - {{- include "common.addon.codeserver" . }} - {{- end -}} - - {{- /* Enable VPN add-on if required */ -}} - {{- if ne "disabled" .Values.addons.vpn.type -}} - {{- include "common.addon.vpn" . }} - {{- end -}} - - {{- /* Enable promtail add-on if required */ -}} - {{- if .Values.addons.promtail.enabled }} - {{- include "common.addon.promtail" . }} - {{- end -}} - - {{- /* Enable netshoot add-on if required */ -}} - {{- if .Values.addons.netshoot.enabled }} - {{- include "common.addon.netshoot" . }} - {{- end -}} - - {{- /* Build the templates */ -}} - {{- include "common.pvc" . }} - - {{- if .Values.serviceAccount.create -}} - {{- include "common.serviceAccount" . }} - {{- end -}} - - {{- if .Values.controller.enabled }} - {{- if eq .Values.controller.type "deployment" }} - {{- include "common.deployment" . | nindent 0 }} - {{ else if eq .Values.controller.type "daemonset" }} - {{- include "common.daemonset" . | nindent 0 }} - {{ else if eq .Values.controller.type "statefulset" }} - {{- include "common.statefulset" . | nindent 0 }} - {{ else }} - {{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }} - {{- end -}} - {{- end -}} - - {{ include "common.rbac" . | nindent 0 }} - - {{ include "common.hpa" . | nindent 0 }} - - {{ include "common.service" . | nindent 0 }} - - {{ include "common.ingress" . | nindent 0 }} - - {{- if .Values.secret -}} - {{ include "common.secret" . | nindent 0 }} - {{- end -}} - - {{ include "common.configmap.portal" . | nindent 0 }} - - {{ include "common.networkpolicy" . | nindent 0 }} + {{- /* Generate remaining objects */ -}} + {{- include "common.postSetup" . }} {{- end -}} diff --git a/charts/library/common/templates/_postSetup.tpl b/charts/library/common/templates/_postSetup.tpl new file mode 100644 index 00000000000..06974e23714 --- /dev/null +++ b/charts/library/common/templates/_postSetup.tpl @@ -0,0 +1,59 @@ +{{/* +Secondary entrypoint and primary loader for the common chart +*/}} +{{- define "common.postSetup" -}} + {{- /* Enable code-server add-on if required */ -}} + {{- if .Values.addons.codeserver.enabled }} + {{- include "common.addon.codeserver" . }} + {{- end -}} + + {{- /* Enable VPN add-on if required */ -}} + {{- if ne "disabled" .Values.addons.vpn.type -}} + {{- include "common.addon.vpn" . }} + {{- end -}} + + {{- /* Enable promtail add-on if required */ -}} + {{- if .Values.addons.promtail.enabled }} + {{- include "common.addon.promtail" . }} + {{- end -}} + + {{- /* Enable netshoot add-on if required */ -}} + {{- if .Values.addons.netshoot.enabled }} + {{- include "common.addon.netshoot" . }} + {{- end -}} + + {{- /* Build the templates */ -}} + {{- include "common.pvc" . }} + + {{- if .Values.serviceAccount.create -}} + {{- include "common.serviceAccount" . }} + {{- end -}} + + {{- if .Values.controller.enabled }} + {{- if eq .Values.controller.type "deployment" }} + {{- include "common.deployment" . | nindent 0 }} + {{ else if eq .Values.controller.type "daemonset" }} + {{- include "common.daemonset" . | nindent 0 }} + {{ else if eq .Values.controller.type "statefulset" }} + {{- include "common.statefulset" . | nindent 0 }} + {{ else }} + {{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }} + {{- end -}} + {{- end -}} + + {{ include "common.rbac" . | nindent 0 }} + + {{ include "common.hpa" . | nindent 0 }} + + {{ include "common.service" . | nindent 0 }} + + {{ include "common.ingress" . | nindent 0 }} + + {{- if .Values.secret -}} + {{ include "common.secret" . | nindent 0 }} + {{- end -}} + + {{ include "common.configmap.portal" . | nindent 0 }} + + {{ include "common.networkpolicy" . | nindent 0 }} +{{- end -}} diff --git a/charts/stable/authelia/templates/common.yaml b/charts/stable/authelia/templates/common.yaml index e12894b34b2..0afe8de1d3e 100644 --- a/charts/stable/authelia/templates/common.yaml +++ b/charts/stable/authelia/templates/common.yaml @@ -69,4 +69,4 @@ volumeSpec: {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/fireflyiii/templates/common.yaml b/charts/stable/fireflyiii/templates/common.yaml index 5c5aa574829..da58e96d9e0 100644 --- a/charts/stable/fireflyiii/templates/common.yaml +++ b/charts/stable/fireflyiii/templates/common.yaml @@ -2,4 +2,4 @@ {{- include "common.setup" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/freeradius/templates/common.yaml b/charts/stable/freeradius/templates/common.yaml index 5c5aa574829..da58e96d9e0 100644 --- a/charts/stable/freeradius/templates/common.yaml +++ b/charts/stable/freeradius/templates/common.yaml @@ -2,4 +2,4 @@ {{- include "common.setup" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/gitea/templates/common.yaml b/charts/stable/gitea/templates/common.yaml index 31f989cc560..703865da3de 100644 --- a/charts/stable/gitea/templates/common.yaml +++ b/charts/stable/gitea/templates/common.yaml @@ -35,4 +35,4 @@ volumeSpec: {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/k8s-gateway/templates/common.yaml b/charts/stable/k8s-gateway/templates/common.yaml index e2b0bbcfea5..80cb9a9cb39 100644 --- a/charts/stable/k8s-gateway/templates/common.yaml +++ b/charts/stable/k8s-gateway/templates/common.yaml @@ -21,4 +21,4 @@ volumeSpec: {{- $_ := set .Values.persistence "config-volume" (include "k8s-gateway.configvolume" . | fromYaml) -}} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/littlelink/templates/common.yaml b/charts/stable/littlelink/templates/common.yaml index be87c2524a0..90b9a2748b1 100644 --- a/charts/stable/littlelink/templates/common.yaml +++ b/charts/stable/littlelink/templates/common.yaml @@ -2,7 +2,7 @@ {{- include "common.setup" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} {{/* Render configmap for littlelink */}} {{- include "littlelink.configmap" . }} diff --git a/charts/stable/mosquitto/templates/common.yaml b/charts/stable/mosquitto/templates/common.yaml index 5929163cdaf..170372870d4 100644 --- a/charts/stable/mosquitto/templates/common.yaml +++ b/charts/stable/mosquitto/templates/common.yaml @@ -14,4 +14,4 @@ volumeSpec: {{- $_ := set .Values.persistence "mosquitto-config" (include "mosquitto.configVolume" . | fromYaml) -}} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/nextcloud/templates/common.yaml b/charts/stable/nextcloud/templates/common.yaml index be2911a68ba..e73a8b7783c 100644 --- a/charts/stable/nextcloud/templates/common.yaml +++ b/charts/stable/nextcloud/templates/common.yaml @@ -14,4 +14,4 @@ {{- include "nextcloud.cronjob" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/openldap/templates/common.yaml b/charts/stable/openldap/templates/common.yaml index 1e13e008365..bc9c9caa860 100644 --- a/charts/stable/openldap/templates/common.yaml +++ b/charts/stable/openldap/templates/common.yaml @@ -2,7 +2,7 @@ {{- include "common.setup" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} {{/* Render configmap for openldap */}} {{- include "openldap.configmap" . }} diff --git a/charts/stable/pihole/templates/common.yaml b/charts/stable/pihole/templates/common.yaml index 141f20a28ec..a6f73771f8c 100644 --- a/charts/stable/pihole/templates/common.yaml +++ b/charts/stable/pihole/templates/common.yaml @@ -5,4 +5,4 @@ {{- include "pihole.configmap" . }} {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }} diff --git a/charts/stable/traefik/templates/common.yaml b/charts/stable/traefik/templates/common.yaml index c29a7233d6f..72c57659973 100644 --- a/charts/stable/traefik/templates/common.yaml +++ b/charts/stable/traefik/templates/common.yaml @@ -21,4 +21,4 @@ {{/* Render the templates */}} -{{ include "common.all" . }} +{{ include "common.postSetup" . }}