mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common): Release version 2.0.0-beta.1 (#173)
This commit is contained in:
parent
19767d668c
commit
7b6ee00be6
189 changed files with 3110 additions and 3023 deletions
|
@ -1,19 +1,26 @@
|
|||
{{/*
|
||||
Renders the configMap objects required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.configmaps" -}}
|
||||
{{- define "bjw-s.common.render.configMaps" -}}
|
||||
{{- /* Generate named configMaps as required */ -}}
|
||||
{{- range $name, $configmap := .Values.configMaps -}}
|
||||
{{- if $configmap.enabled -}}
|
||||
{{- $configmapValues := $configmap -}}
|
||||
{{- range $key, $configMap := .Values.configMaps }}
|
||||
{{- /* Enable configMap by default, but allow override */ -}}
|
||||
{{- $configMapEnabled := true -}}
|
||||
{{- if hasKey $configMap "enabled" -}}
|
||||
{{- $configMapEnabled = $configMap.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* set the default nameOverride to the configMap name */ -}}
|
||||
{{- if not $configmapValues.nameOverride -}}
|
||||
{{- $_ := set $configmapValues "nameOverride" $name -}}
|
||||
{{ end -}}
|
||||
{{- if $configMapEnabled -}}
|
||||
{{- $configMapValues := (mustDeepCopy $configMap) -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "configmap" $configmapValues) -}}
|
||||
{{- include "bjw-s.common.class.configmap" $ | nindent 0 -}}
|
||||
{{- /* Create object from the raw configMap values */ -}}
|
||||
{{- $configMapObject := (include "bjw-s.common.lib.configMap.valuesToObject" (dict "rootContext" $ "id" $key "values" $configMapValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the configMap before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.configMap.validate" (dict "rootContext" $ "object" $configMapObject) -}}
|
||||
|
||||
{{/* Include the configMap class */}}
|
||||
{{- include "bjw-s.common.class.configMap" (dict "rootContext" $ "object" $configMapObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
{{/*
|
||||
Renders the controller object required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.controller" -}}
|
||||
{{- if .Values.controller.enabled -}}
|
||||
{{- if eq .Values.controller.type "deployment" -}}
|
||||
{{- include "bjw-s.common.class.deployment" . | nindent 0 -}}
|
||||
{{- else if eq .Values.controller.type "cronjob" -}}
|
||||
{{- include "bjw-s.common.class.cronjob" . | nindent 0 -}}
|
||||
{{ else if eq .Values.controller.type "daemonset" -}}
|
||||
{{- include "bjw-s.common.class.daemonset" . | nindent 0 -}}
|
||||
{{ else if eq .Values.controller.type "statefulset" -}}
|
||||
{{- include "bjw-s.common.class.statefulset" . | nindent 0 -}}
|
||||
{{ else -}}
|
||||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
41
charts/library/common/templates/render/_controllers.tpl
Normal file
41
charts/library/common/templates/render/_controllers.tpl
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{/*
|
||||
Renders the controller objects required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.controllers" -}}
|
||||
{{- /* Generate named controller objects as required */ -}}
|
||||
{{- range $key, $controller := .Values.controllers -}}
|
||||
{{- /* Enable controller by default, but allow override */ -}}
|
||||
{{- $controllerEnabled := true -}}
|
||||
{{- if hasKey $controller "enabled" -}}
|
||||
{{- $controllerEnabled = $controller.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $controllerEnabled -}}
|
||||
{{- $controllerValues := $controller -}}
|
||||
|
||||
{{- /* Create object from the raw controller values */ -}}
|
||||
{{- $controllerObject := (include "bjw-s.common.lib.controller.valuesToObject" (dict "rootContext" $ "id" $key "values" $controllerValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the controller before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.controller.validate" (dict "rootContext" $ "object" $controllerObject) -}}
|
||||
|
||||
{{- if eq $controllerObject.type "deployment" -}}
|
||||
{{- $deploymentObject := (include "bjw-s.common.lib.deployment.valuesToObject" (dict "rootContext" $ "id" $key "values" $controllerObject)) | fromYaml -}}
|
||||
{{- include "bjw-s.common.lib.deployment.validate" (dict "rootContext" $ "object" $deploymentObject) -}}
|
||||
{{- include "bjw-s.common.class.deployment" (dict "rootContext" $ "object" $deploymentObject) | nindent 0 -}}
|
||||
{{- else if eq $controllerObject.type "cronjob" -}}
|
||||
{{- $cronjobObject := (include "bjw-s.common.lib.cronjob.valuesToObject" (dict "rootContext" $ "id" $key "values" $controllerObject)) | fromYaml -}}
|
||||
{{- include "bjw-s.common.lib.cronjob.validate" (dict "rootContext" $ "object" $cronjobObject) -}}
|
||||
{{- include "bjw-s.common.class.cronjob" (dict "rootContext" $ "object" $cronjobObject) | nindent 0 -}}
|
||||
{{- else if eq $controllerObject.type "daemonset" -}}
|
||||
{{- $daemonsetObject := (include "bjw-s.common.lib.daemonset.valuesToObject" (dict "rootContext" $ "id" $key "values" $controllerObject)) | fromYaml -}}
|
||||
{{- include "bjw-s.common.lib.daemonset.validate" (dict "rootContext" $ "object" $daemonsetObject) -}}
|
||||
{{- include "bjw-s.common.class.daemonset" (dict "rootContext" $ "object" $daemonsetObject) | nindent 0 -}}
|
||||
{{- else if eq $controllerObject.type "statefulset" -}}
|
||||
{{- $statefulsetObject := (include "bjw-s.common.lib.statefulset.valuesToObject" (dict "rootContext" $ "id" $key "values" $controllerObject)) | fromYaml -}}
|
||||
{{- include "bjw-s.common.lib.statefulset.validate" (dict "rootContext" $ "object" $statefulsetObject) -}}
|
||||
{{- include "bjw-s.common.class.statefulset" (dict "rootContext" $ "object" $statefulsetObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -2,18 +2,25 @@
|
|||
Renders the Ingress objects required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.ingresses" -}}
|
||||
{{- /* Generate named ingresses as required */ -}}
|
||||
{{- range $name, $ingress := .Values.ingress }}
|
||||
{{- if $ingress.enabled -}}
|
||||
{{- $ingressValues := $ingress -}}
|
||||
{{- /* Generate named Ingresses as required */ -}}
|
||||
{{- range $key, $ingress := .Values.ingress }}
|
||||
{{- /* Enable Ingress by default, but allow override */ -}}
|
||||
{{- $ingressEnabled := true -}}
|
||||
{{- if hasKey $ingress "enabled" -}}
|
||||
{{- $ingressEnabled = $ingress.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* set defaults */}}
|
||||
{{- if and (not $ingressValues.nameOverride) (ne $name (include "bjw-s.common.lib.ingress.primary" $)) -}}
|
||||
{{- $_ := set $ingressValues "nameOverride" $name -}}
|
||||
{{- end -}}
|
||||
{{- if $ingressEnabled -}}
|
||||
{{- $ingressValues := (mustDeepCopy $ingress) -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- include "bjw-s.common.class.ingress" $ | nindent 0 -}}
|
||||
{{- /* Create object from the raw ingress values */ -}}
|
||||
{{- $ingressObject := (include "bjw-s.common.lib.ingress.valuesToObject" (dict "rootContext" $ "id" $key "values" $ingressValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the ingress before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.ingress.validate" (dict "rootContext" $ "object" $ingressObject) -}}
|
||||
|
||||
{{/* Include the ingress class */}}
|
||||
{{- include "bjw-s.common.class.ingress" (dict "rootContext" $ "object" $ingressObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,14 +3,18 @@ Renders the Persistent Volume Claim objects required by the chart.
|
|||
*/}}
|
||||
{{- define "bjw-s.common.render.pvcs" -}}
|
||||
{{- /* Generate pvc as required */ -}}
|
||||
{{- range $index, $PVC := .Values.persistence -}}
|
||||
{{- if and $PVC.enabled (eq (default "pvc" $PVC.type) "pvc") (not $PVC.existingClaim) -}}
|
||||
{{- $persistenceValues := $PVC -}}
|
||||
{{- if not $persistenceValues.nameOverride -}}
|
||||
{{- $_ := set $persistenceValues "nameOverride" $index -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "persistence" $persistenceValues) -}}
|
||||
{{- include "bjw-s.common.class.pvc" $ | nindent 0 -}}
|
||||
{{- range $key, $pvc := .Values.persistence -}}
|
||||
{{- if and $pvc.enabled (eq (default "persistentVolumeClaim" $pvc.type) "persistentVolumeClaim") (not $pvc.existingClaim) -}}
|
||||
{{- $pvcValues := (mustDeepCopy $pvc) -}}
|
||||
|
||||
{{- /* Create object from the raw PVC values */ -}}
|
||||
{{- $pvcObject := (include "bjw-s.common.lib.pvc.valuesToObject" (dict "rootContext" $ "id" $key "values" $pvcValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the PVC before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.pvc.validate" (dict "rootContext" $ "object" $pvcValues) -}}
|
||||
|
||||
{{- /* Include the PVC class */ -}}
|
||||
{{- include "bjw-s.common.class.pvc" (dict "rootContext" $ "object" $pvcValues) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
{{/* Renders the Route objects required by the chart */}}
|
||||
{{- define "bjw-s.common.render.routes" -}}
|
||||
{{- /* Generate named routes as required */ -}}
|
||||
{{- range $name, $route := .Values.route }}
|
||||
{{- if $route.enabled -}}
|
||||
{{- $routeValues := $route -}}
|
||||
{{- range $key, $route := .Values.route }}
|
||||
{{- /* Enable Route by default, but allow override */ -}}
|
||||
{{- $routeEnabled := true -}}
|
||||
{{- if hasKey $route "enabled" -}}
|
||||
{{- $routeEnabled = $route.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* set defaults */}}
|
||||
{{- if and (not $routeValues.nameOverride) (ne $name (include "bjw-s.common.lib.route.primary" $)) -}}
|
||||
{{- $_ := set $routeValues "nameOverride" $name -}}
|
||||
{{- end -}}
|
||||
{{- if $routeEnabled -}}
|
||||
{{- $routeValues := (mustDeepCopy $route) -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "route" $routeValues) -}}
|
||||
{{- include "bjw-s.common.class.route" $ | nindent 0 -}}
|
||||
{{- $_ := unset $.ObjectValues "route" -}}
|
||||
{{- /* Create object from the raw Route values */ -}}
|
||||
{{- $routeObject := (include "bjw-s.common.lib.route.valuesToObject" (dict "rootContext" $ "id" $key "values" $routeValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the Route before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.route.validate" (dict "rootContext" $ "object" $routeObject) -}}
|
||||
|
||||
{{- /* Include the Route class */ -}}
|
||||
{{- include "bjw-s.common.class.route" (dict "rootContext" $ "object" $routeObject) | nindent 0 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -3,17 +3,24 @@ Renders the Secret objects required by the chart.
|
|||
*/}}
|
||||
{{- define "bjw-s.common.render.secrets" -}}
|
||||
{{- /* Generate named Secrets as required */ -}}
|
||||
{{- range $name, $secret := .Values.secrets -}}
|
||||
{{- if $secret.enabled -}}
|
||||
{{- $secretValues := $secret -}}
|
||||
{{- range $key, $secret := .Values.secrets }}
|
||||
{{- /* Enable Secret by default, but allow override */ -}}
|
||||
{{- $secretEnabled := true -}}
|
||||
{{- if hasKey $secret "enabled" -}}
|
||||
{{- $secretEnabled = $secret.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* set the default nameOverride to the Secret name */ -}}
|
||||
{{- if not $secretValues.nameOverride -}}
|
||||
{{- $_ := set $secretValues "nameOverride" $name -}}
|
||||
{{ end -}}
|
||||
{{- if $secretEnabled -}}
|
||||
{{- $secretValues := (mustDeepCopy $secret) -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "secret" $secretValues) -}}
|
||||
{{- include "bjw-s.common.class.secret" $ | nindent 0 -}}
|
||||
{{- /* Create object from the raw Secret values */ -}}
|
||||
{{- $secretObject := (include "bjw-s.common.lib.secret.valuesToObject" (dict "rootContext" $ "id" $key "values" $secretValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the Secret before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.secret.validate" (dict "rootContext" $ "object" $secretObject) -}}
|
||||
|
||||
{{/* Include the Secret class */}}
|
||||
{{- include "bjw-s.common.class.secret" (dict "rootContext" $ "object" $secretObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -2,19 +2,25 @@
|
|||
Renders the serviceMonitor objects required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.serviceMonitors" -}}
|
||||
{{- /* Generate named services as required */ -}}
|
||||
{{- range $name, $serviceMonitor := .Values.serviceMonitor -}}
|
||||
{{- if $serviceMonitor.enabled -}}
|
||||
{{- $serviceMonitorValues := $serviceMonitor -}}
|
||||
{{- /* Generate named serviceMonitors as required */ -}}
|
||||
{{- range $key, $serviceMonitor := .Values.serviceMonitor -}}
|
||||
{{- /* Enable ServiceMonitor by default, but allow override */ -}}
|
||||
{{- $serviceMonitorEnabled := true -}}
|
||||
{{- if hasKey $serviceMonitor "enabled" -}}
|
||||
{{- $serviceMonitorEnabled = $serviceMonitor.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (not $serviceMonitorValues.nameOverride) (ne $name "main") -}}
|
||||
{{- $_ := set $serviceMonitorValues "nameOverride" $name -}}
|
||||
{{- end -}}
|
||||
{{- if $serviceMonitorEnabled -}}
|
||||
{{- $serviceMonitorValues := (mustDeepCopy $serviceMonitor) -}}
|
||||
|
||||
{{- /* Create object from the raw ServiceMonitor values */ -}}
|
||||
{{- $serviceMonitorObject := (include "bjw-s.common.lib.serviceMonitor.valuesToObject" (dict "rootContext" $ "id" $key "values" $serviceMonitorValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the serviceMonitor before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.serviceMonitor.validate" (dict "rootContext" $ "object" $serviceMonitorObject) -}}
|
||||
|
||||
{{/* Include the serviceMonitor class */}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "serviceMonitor" $serviceMonitorValues) -}}
|
||||
{{- include "bjw-s.common.class.serviceMonitor" $ | nindent 0 -}}
|
||||
{{- $_ := unset $.ObjectValues "serviceMonitor" -}}
|
||||
{{- include "bjw-s.common.class.serviceMonitor" (dict "rootContext" $ "object" $serviceMonitorObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,11 +3,18 @@ Renders the serviceAccount object required by the chart.
|
|||
*/}}
|
||||
{{- define "bjw-s.common.render.serviceAccount" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- $serviceAccountValues := (mustDeepCopy .Values.serviceAccount) -}}
|
||||
|
||||
{{- /* Create object from the raw ServiceAccount values */ -}}
|
||||
{{- $serviceAccountObject := (include "bjw-s.common.lib.serviceAccount.valuesToObject" (dict "rootContext" $ "id" "default" "values" $serviceAccountValues)) | fromYaml -}}
|
||||
|
||||
{{- /* Perform validations on the ServiceAccount before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.serviceAccount.validate" (dict "rootContext" $ "object" $serviceAccountObject) -}}
|
||||
|
||||
{{/* Include the serviceAccount class */}}
|
||||
{{- include "bjw-s.common.class.serviceAccount" (dict "rootContext" $ "object" $serviceAccountObject) | nindent 0 -}}
|
||||
|
||||
{{- /* Create a service account secret */ -}}
|
||||
{{- $serviceAccountName := include "bjw-s.common.lib.chart.names.serviceAccountName" . -}}
|
||||
{{- $_ := set .Values.secrets "sa-token" (dict "enabled" true "annotations" (dict "kubernetes.io/service-account.name" $serviceAccountName) "type" "kubernetes.io/service-account-token") -}}
|
||||
|
||||
{{- include "bjw-s.common.class.serviceAccount" $ | nindent 0 -}}
|
||||
{{- $_ := set .Values.secrets "sa-token" (dict "enabled" true "annotations" (dict "kubernetes.io/service-account.name" $serviceAccountObject.name) "type" "kubernetes.io/service-account-token") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -2,24 +2,18 @@
|
|||
Renders the Service objects required by the chart.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.render.services" -}}
|
||||
{{- /* Generate named services as required */ -}}
|
||||
{{- range $name, $service := .Values.service -}}
|
||||
{{- $serviceEnabled := true -}}
|
||||
{{- if hasKey $service "enabled" -}}
|
||||
{{- $serviceEnabled = $service.enabled -}}
|
||||
{{- end -}}
|
||||
{{- if $serviceEnabled -}}
|
||||
{{- $serviceValues := $service -}}
|
||||
{{- /* Generate named Services as required */ -}}
|
||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $) | fromYaml ) -}}
|
||||
{{- range $key, $svc := $enabledServices -}}
|
||||
{{- $serviceValues := (mustDeepCopy $svc) -}}
|
||||
|
||||
{{/* set the default nameOverride to the service name */}}
|
||||
{{- if and (not $serviceValues.nameOverride) (ne $name (include "bjw-s.common.lib.service.primary" $)) -}}
|
||||
{{- $_ := set $serviceValues "nameOverride" $name -}}
|
||||
{{ end -}}
|
||||
{{- /* Create object from the raw Service values */ -}}
|
||||
{{- $serviceObject := (include "bjw-s.common.lib.service.valuesToObject" (dict "rootContext" $ "id" $key "values" $serviceValues)) | fromYaml -}}
|
||||
|
||||
{{/* Include the Service class */}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
{{- include "bjw-s.common.class.service" $ | nindent 0 -}}
|
||||
{{- $_ := unset $.ObjectValues "service" -}}
|
||||
{{- end -}}
|
||||
{{- /* Perform validations on the Service before rendering */ -}}
|
||||
{{- include "bjw-s.common.lib.service.validate" (dict "rootContext" $ "object" $serviceObject) -}}
|
||||
|
||||
{{- /* Include the Service class */ -}}
|
||||
{{- include "bjw-s.common.class.service" (dict "rootContext" $ "object" $serviceObject) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue