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
|
@ -2,33 +2,31 @@
|
|||
This template serves as a blueprint for all configMap objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.configmap" -}}
|
||||
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- $configMapName := $fullName -}}
|
||||
{{- $values := .Values.configmap -}}
|
||||
{{- define "bjw-s.common.class.configMap" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $configMapObject := .object -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.configmap -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $configMapName = printf "%v-%v" $configMapName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
{{- $labels := merge
|
||||
($configMapObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($configMapObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $configMapName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $configMapObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- with $values.data }}
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with $configMapObject.data }}
|
||||
{{- tpl (toYaml .) $rootContext | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,45 +3,48 @@ This template serves as a blueprint for Cronjob objects that are created
|
|||
using the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.cronjob" -}}
|
||||
{{- $restartPolicy := default "Never" .Values.controller.restartPolicy -}}
|
||||
{{- if and (ne $restartPolicy "Never") (ne $restartPolicy "OnFailure") -}}
|
||||
{{- fail (printf "Not a valid restartPolicy for CronJob (%s)" $restartPolicy) -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set .Values.controller "restartPolicy" $restartPolicy -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $cronjobObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/component" $cronjobObject.identifier)
|
||||
($cronjobObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($cronjobObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }}
|
||||
labels: {{- . | nindent 4 }}
|
||||
name: {{ $cronjobObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }}
|
||||
annotations: {{- . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
concurrencyPolicy: "{{ .Values.controller.cronjob.concurrencyPolicy }}"
|
||||
startingDeadlineSeconds: {{ .Values.controller.cronjob.startingDeadlineSeconds }}
|
||||
schedule: "{{ .Values.controller.cronjob.schedule }}"
|
||||
successfulJobsHistoryLimit: {{ .Values.controller.cronjob.successfulJobsHistory }}
|
||||
failedJobsHistoryLimit: {{ .Values.controller.cronjob.failedJobsHistory }}
|
||||
concurrencyPolicy: "{{ $cronjobObject.cronjob.concurrencyPolicy }}"
|
||||
startingDeadlineSeconds: {{ $cronjobObject.cronjob.startingDeadlineSeconds }}
|
||||
schedule: "{{ $cronjobObject.cronjob.schedule }}"
|
||||
successfulJobsHistoryLimit: {{ $cronjobObject.cronjob.successfulJobsHistory }}
|
||||
failedJobsHistoryLimit: {{ $cronjobObject.cronjob.failedJobsHistory }}
|
||||
jobTemplate:
|
||||
spec:
|
||||
{{- with .Values.controller.cronjob.ttlSecondsAfterFinished }}
|
||||
{{- with $cronjobObject.cronjob.ttlSecondsAfterFinished }}
|
||||
ttlSecondsAfterFinished: {{ . }}
|
||||
{{- end }}
|
||||
backoffLimit: {{ .Values.controller.cronjob.backoffLimit }}
|
||||
backoffLimit: {{ $cronjobObject.cronjob.backoffLimit }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }}
|
||||
annotations:
|
||||
{{- . | nindent 12 }}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
|
||||
annotations: {{ . | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
|
||||
labels: {{ . | nindent 12 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 12 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "bjw-s.common.lib.controller.pod" . | nindent 10 }}
|
||||
spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $cronjobObject) | nindent 10 }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,33 +3,38 @@ This template serves as the blueprint for the DaemonSet objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.daemonset" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $daemonsetObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/component" $daemonsetObject.identifier)
|
||||
($daemonsetObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($daemonsetObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }}
|
||||
labels: {{- . | nindent 4 }}
|
||||
name: {{ $daemonsetObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }}
|
||||
annotations: {{- . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
|
||||
revisionHistoryLimit: {{ $daemonsetObject.revisionHistoryLimit }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: {{ $daemonsetObject.identifier }}
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
|
||||
annotations: {{ include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 8 }}
|
||||
labels: {{ include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 8 }}
|
||||
spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 6 }}
|
||||
{{- end }}
|
||||
|
|
|
@ -3,30 +3,38 @@ This template serves as a blueprint for Deployment objects that are created
|
|||
using the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.deployment" -}}
|
||||
{{- $strategy := default "Recreate" .Values.controller.strategy -}}
|
||||
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") -}}
|
||||
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) -}}
|
||||
{{- end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $deploymentObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/component" $deploymentObject.identifier)
|
||||
($deploymentObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($deploymentObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }}
|
||||
labels: {{- . | nindent 4 }}
|
||||
name: {{ $deploymentObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }}
|
||||
annotations: {{- . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
|
||||
{{- if not (eq .Values.controller.replicas nil) }}
|
||||
replicas: {{ .Values.controller.replicas }}
|
||||
revisionHistoryLimit: {{ $deploymentObject.revisionHistoryLimit }}
|
||||
{{- if not (eq $deploymentObject.replicas nil) }}
|
||||
replicas: {{ $deploymentObject.replicas }}
|
||||
{{- end }}
|
||||
strategy:
|
||||
type: {{ $strategy }}
|
||||
{{- with .Values.controller.rollingUpdate }}
|
||||
{{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }}
|
||||
type: {{ $deploymentObject.strategy }}
|
||||
{{- with $deploymentObject.rollingUpdate }}
|
||||
{{- if and (eq $deploymentObject.strategy "RollingUpdate") (or .surge .unavailable) }}
|
||||
rollingUpdate:
|
||||
{{- with .unavailable }}
|
||||
maxUnavailable: {{ . }}
|
||||
|
@ -38,18 +46,15 @@ spec:
|
|||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: {{ $deploymentObject.identifier }}
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $deploymentObject)) }}
|
||||
annotations: {{ . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $deploymentObject)) }}
|
||||
labels: {{ . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
|
||||
spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $deploymentObject) | nindent 6 }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -2,74 +2,65 @@
|
|||
This template serves as a blueprint for all Ingress objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
|
||||
{{- define "bjw-s.common.class.ingress" -}}
|
||||
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- $ingressName := $fullName -}}
|
||||
{{- $values := .Values.ingress -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $ingressObject := .object -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.ingress -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
|
||||
{{- $labels := merge
|
||||
($ingressObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($ingressObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $ingressName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $ingressObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $values.ingressClassName }}
|
||||
ingressClassName: {{ $values.ingressClassName }}
|
||||
{{- if $ingressObject.className }}
|
||||
ingressClassName: {{ $ingressObject.className }}
|
||||
{{- end }}
|
||||
{{- if $values.tls }}
|
||||
{{- if $ingressObject.tls }}
|
||||
tls:
|
||||
{{- range $values.tls }}
|
||||
{{- range $ingressObject.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ tpl . $ | quote }}
|
||||
- {{ tpl . $rootContext | quote }}
|
||||
{{- end }}
|
||||
{{- $secretName := tpl (default "" .secretName) $ }}
|
||||
{{- $secretName := tpl (default "" .secretName) $rootContext }}
|
||||
{{- if $secretName }}
|
||||
secretName: {{ $secretName | quote}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.hosts }}
|
||||
- host: {{ tpl .host $ | quote }}
|
||||
{{- range $ingressObject.hosts }}
|
||||
- host: {{ tpl .host $rootContext | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
{{- $service := $defaultServiceName -}}
|
||||
{{- $port := $defaultServicePort.port -}}
|
||||
{{- if .service -}}
|
||||
{{- $service = default $service .service.name -}}
|
||||
{{- $port = default $port .service.port -}}
|
||||
{{- end }}
|
||||
- path: {{ tpl .path $ | quote }}
|
||||
- path: {{ tpl .path $rootContext | quote }}
|
||||
pathType: {{ default "Prefix" .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $service }}
|
||||
{{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .service.name) | fromYaml -}}
|
||||
{{ $servicePrimaryPort := dict -}}
|
||||
{{ if $service -}}
|
||||
{{ $servicePrimaryPort = include "bjw-s.common.lib.service.primaryPort" (dict "rootContext" $rootContext "serviceObject" $service) | fromYaml -}}
|
||||
{{ end -}}
|
||||
name: {{ default .service.name $service.name }}
|
||||
port:
|
||||
number: {{ $port }}
|
||||
number: {{ default .service.port $servicePrimaryPort.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -3,43 +3,45 @@ This template serves as a blueprint for all PersistentVolumeClaim objects that a
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.pvc" -}}
|
||||
{{- $values := .Values.persistence -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.persistence -}}
|
||||
{{- $values = . -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $pvcObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
($pvcObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($pvcObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- if $pvcObject.retain }}
|
||||
{{- $annotations = merge
|
||||
(dict "helm.sh/resource-policy" "keep")
|
||||
$annotations
|
||||
-}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $pvcName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- if not (eq $values.nameOverride "-") -}}
|
||||
{{- $pvcName = printf "%v-%v" $pvcName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ $pvcName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $pvcObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if $values.retain }}
|
||||
"helm.sh/resource-policy": keep
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ required (printf "accessMode is required for PVC %v" $pvcName) $values.accessMode | quote }}
|
||||
- {{ required (printf "accessMode is required for PVC %v" $pvcObject.name) $pvcObject.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ required (printf "size is required for PVC %v" $pvcName) $values.size | quote }}
|
||||
{{- if $values.storageClass }}
|
||||
storageClassName: {{ if (eq "-" $values.storageClass) }}""{{- else }}{{ $values.storageClass | quote }}{{- end }}
|
||||
storage: {{ required (printf "size is required for PVC %v" $pvcObject.name) $pvcObject.size | quote }}
|
||||
{{- if $pvcObject.storageClass }}
|
||||
storageClassName: {{ if (eq "-" $pvcObject.storageClass) }}""{{- else }}{{ $pvcObject.storageClass | quote }}{{- end }}
|
||||
{{- end }}
|
||||
{{- if $values.volumeName }}
|
||||
volumeName: {{ $values.volumeName | quote }}
|
||||
{{- if $pvcObject.volumeName }}
|
||||
volumeName: {{ $pvcObject.volumeName | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,24 +3,18 @@ This template serves as a blueprint for all Route objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.route" -}}
|
||||
{{- $values := .Values.route -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.route -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $routeObject := .object -}}
|
||||
|
||||
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $fullName = printf "%v-%v" $fullName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $routeKind := $values.kind | default "HTTPRoute" -}}
|
||||
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
|
||||
{{- $routeKind := $routeObject.kind | default "HTTPRoute" -}}
|
||||
{{- $labels := merge
|
||||
($routeObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($routeObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1alpha2
|
||||
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }}
|
||||
|
@ -28,39 +22,44 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
|
|||
{{- end }}
|
||||
kind: {{ $routeKind }}
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $routeObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
parentRefs:
|
||||
{{- range $values.parentRefs }}
|
||||
{{- range $routeObject.parentRefs }}
|
||||
- group: {{ default "gateway.networking.k8s.io" .group }}
|
||||
kind: {{ default "Gateway" .kind }}
|
||||
name: {{ required (printf "parentRef name is required for %v %v" $routeKind $fullName) .name }}
|
||||
namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $fullName) .namespace }}
|
||||
name: {{ required (printf "parentRef name is required for %v %v" $routeKind $routeObject.name) .name }}
|
||||
namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $routeObject.name) .namespace }}
|
||||
{{- if .sectionName }}
|
||||
sectionName: {{ .sectionName | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $values.hostnames }}
|
||||
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $routeObject.hostnames }}
|
||||
hostnames:
|
||||
{{- with $values.hostnames }}
|
||||
{{- with $routeObject.hostnames }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.rules }}
|
||||
{{- range $routeObject.rules }}
|
||||
- backendRefs:
|
||||
{{- range .backendRefs }}
|
||||
{{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .name) | fromYaml -}}
|
||||
{{ $servicePrimaryPort := dict -}}
|
||||
{{ if $service -}}
|
||||
{{ $servicePrimaryPort = include "bjw-s.common.lib.service.primaryPort" (dict "rootContext" $rootContext "serviceObject" $service) | fromYaml -}}
|
||||
{{- end }}
|
||||
- group: {{ default "" .group | quote}}
|
||||
kind: {{ default "Service" .kind }}
|
||||
name: {{ default $defaultServiceName .name }}
|
||||
namespace: {{ default $.Release.Namespace .namespace }}
|
||||
port: {{ default $defaultServicePort.port .port }}
|
||||
name: {{ default .name $service.name }}
|
||||
namespace: {{ default $rootContext.Release.Namespace .namespace }}
|
||||
port: {{ default .port $servicePrimaryPort.port }}
|
||||
weight: {{ default 1 .weight }}
|
||||
{{- end }}
|
||||
{{- if (eq $routeKind "HTTPRoute") }}
|
||||
|
|
|
@ -3,35 +3,37 @@ This template serves as a blueprint for all Secret objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.secret" -}}
|
||||
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- $secretName := $fullName -}}
|
||||
{{- $values := .Values.configmap -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $secretObject := .object -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.secret -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $labels := merge
|
||||
($secretObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($secretObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $secretName = printf "%v-%v" $secretName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
{{- $stringData := "" -}}
|
||||
{{- with $secretObject.stringData -}}
|
||||
{{- $stringData = (toYaml $secretObject.stringData) | trim -}}
|
||||
{{- end -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
{{- with $values.type }}
|
||||
{{- with $secretObject.type }}
|
||||
type: {{ . }}
|
||||
{{- end }}
|
||||
metadata:
|
||||
name: {{ $secretName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $secretObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with $values.stringData }}
|
||||
stringData:
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- with $stringData }}
|
||||
stringData: {{- tpl $stringData $rootContext | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -3,83 +3,80 @@ This template serves as a blueprint for all Service objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.service" -}}
|
||||
{{- $values := .Values.service -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.service -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $serviceObject := .object -}}
|
||||
|
||||
{{- $serviceName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $svcType := $values.type | default "" -}}
|
||||
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "serviceName" $serviceName "values" $values) | fromYaml }}
|
||||
{{- $primaryPort := get $values.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $values)) }}
|
||||
{{- $svcType := $serviceObject.type | default "" -}}
|
||||
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "rootContext" $rootContext "serviceObject" $serviceObject) | fromYaml }}
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/service" $serviceObject.name)
|
||||
($serviceObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($serviceObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $serviceName }}
|
||||
labels:
|
||||
app.kubernetes.io/service: {{ $serviceName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if eq ( $primaryPort.protocol | default "" ) "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
name: {{ $serviceObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }}
|
||||
type: ClusterIP
|
||||
{{- if $values.clusterIP }}
|
||||
clusterIP: {{ $values.clusterIP }}
|
||||
{{- if $serviceObject.clusterIP }}
|
||||
clusterIP: {{ $serviceObject.clusterIP }}
|
||||
{{end}}
|
||||
{{- else if eq $svcType "LoadBalancer" }}
|
||||
type: {{ $svcType }}
|
||||
{{- if $values.loadBalancerIP }}
|
||||
loadBalancerIP: {{ $values.loadBalancerIP }}
|
||||
{{- if $serviceObject.loadBalancerIP }}
|
||||
loadBalancerIP: {{ $serviceObject.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if $values.loadBalancerSourceRanges }}
|
||||
{{- if $serviceObject.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml $values.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{ toYaml $serviceObject.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
type: {{ $svcType }}
|
||||
{{- end }}
|
||||
{{- if $values.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $values.externalTrafficPolicy }}
|
||||
{{- if $serviceObject.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $serviceObject.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if $values.sessionAffinity }}
|
||||
sessionAffinity: {{ $values.sessionAffinity }}
|
||||
{{- if $values.sessionAffinityConfig }}
|
||||
{{- if hasKey $serviceObject "allocateLoadBalancerNodePorts" }}
|
||||
allocateLoadBalancerNodePorts: {{ $serviceObject.allocateLoadBalancerNodePorts }}
|
||||
{{- end }}
|
||||
{{- if $serviceObject.sessionAffinity }}
|
||||
sessionAffinity: {{ $serviceObject.sessionAffinity }}
|
||||
{{- if $serviceObject.sessionAffinityConfig }}
|
||||
sessionAffinityConfig:
|
||||
{{ toYaml $values.sessionAffinityConfig | nindent 4 }}
|
||||
{{ toYaml $serviceObject.sessionAffinityConfig | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- with $values.externalIPs }}
|
||||
{{- with $serviceObject.externalIPs }}
|
||||
externalIPs:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $values.publishNotReadyAddresses }}
|
||||
publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }}
|
||||
{{- if $serviceObject.publishNotReadyAddresses }}
|
||||
publishNotReadyAddresses: {{ $serviceObject.publishNotReadyAddresses }}
|
||||
{{- end }}
|
||||
{{- if $values.ipFamilyPolicy }}
|
||||
ipFamilyPolicy: {{ $values.ipFamilyPolicy }}
|
||||
{{- if $serviceObject.ipFamilyPolicy }}
|
||||
ipFamilyPolicy: {{ $serviceObject.ipFamilyPolicy }}
|
||||
{{- end }}
|
||||
{{- with $values.ipFamilies }}
|
||||
{{- with $serviceObject.ipFamilies }}
|
||||
ipFamilies:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- range $name, $port := $enabledPorts }}
|
||||
- port: {{ $port.port }}
|
||||
targetPort: {{ $port.targetPort | default $name }}
|
||||
targetPort: {{ $port.targetPort | default $port.port }}
|
||||
{{- if $port.protocol }}
|
||||
{{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }}
|
||||
protocol: TCP
|
||||
|
@ -94,7 +91,11 @@ spec:
|
|||
nodePort: {{ $port.nodePort }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- with (merge ($values.extraSelectorLabels | default dict) (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }}
|
||||
{{- with (merge
|
||||
($serviceObject.extraSelectorLabels | default dict)
|
||||
(dict "app.kubernetes.io/component" $serviceObject.controller)
|
||||
(include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | fromYaml)
|
||||
) }}
|
||||
selector: {{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -3,17 +3,28 @@ This template serves as a blueprint for ServiceAccount objects that are created
|
|||
using the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.serviceAccount" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $serviceAccountObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
($serviceAccountObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($serviceAccountObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "bjw-s.common.lib.chart.names.serviceAccountName" . }}
|
||||
{{- with include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $serviceAccountObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge (.Values.serviceAccount.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
secrets:
|
||||
- name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-sa-token
|
||||
- name: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}-sa-token
|
||||
{{- end -}}
|
||||
|
|
|
@ -1,34 +1,33 @@
|
|||
{{- define "bjw-s.common.class.serviceMonitor" -}}
|
||||
{{- $values := dict -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.serviceMonitor -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $serviceMonitorName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $serviceMonitorName = printf "%v-%v" $serviceMonitorName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $serviceMonitorObject := .object -}}
|
||||
{{- $labels := merge
|
||||
($serviceMonitorObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($serviceMonitorObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ $serviceMonitorName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
name: {{ $serviceMonitorObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
annotations: {{- toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
{{- if $values.selector -}}
|
||||
{{- tpl ($values.selector | toYaml) $ | nindent 4}}
|
||||
{{- if $serviceMonitorObject.selector -}}
|
||||
{{- tpl ($serviceMonitorObject.selector | toYaml) $rootContext | nindent 4}}
|
||||
{{- else }}
|
||||
matchLabels:
|
||||
app.kubernetes.io/service: {{ tpl $values.serviceName $ }}
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/service: {{ tpl $serviceMonitorObject.serviceName $rootContext }}
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
|
||||
{{- end }}
|
||||
endpoints: {{- toYaml (required (printf "endpoints are required for serviceMonitor %v" $serviceMonitorName) $values.endpoints) | nindent 4 }}
|
||||
endpoints: {{- toYaml $serviceMonitorObject.endpoints | nindent 4 }}
|
||||
{{- end }}
|
||||
|
|
|
@ -3,66 +3,54 @@ This template serves as the blueprint for the StatefulSet objects that are creat
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.statefulset" -}}
|
||||
{{- $strategy := default "RollingUpdate" .Values.controller.strategy -}}
|
||||
{{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") -}}
|
||||
{{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) -}}
|
||||
{{- end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $statefulsetObject := .object -}}
|
||||
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/component" $statefulsetObject.identifier)
|
||||
($statefulsetObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($statefulsetObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }}
|
||||
labels: {{- . | nindent 4 }}
|
||||
name: {{ $statefulsetObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }}
|
||||
annotations: {{- . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
|
||||
replicas: {{ .Values.controller.replicas }}
|
||||
podManagementPolicy: {{ default "OrderedReady" .Values.controller.podManagementPolicy }}
|
||||
revisionHistoryLimit: {{ $statefulsetObject.revisionHistoryLimit }}
|
||||
replicas: {{ $statefulsetObject.replicas }}
|
||||
podManagementPolicy: {{ default "OrderedReady" $statefulsetObject.statefulset.podManagementPolicy }}
|
||||
updateStrategy:
|
||||
type: {{ $strategy }}
|
||||
{{- if and (eq $strategy "RollingUpdate") .Values.controller.rollingUpdate.partition }}
|
||||
type: {{ $statefulsetObject.strategy }}
|
||||
{{- if and (eq $statefulsetObject.strategy "RollingUpdate") $statefulsetObject.rollingUpdate.partition }}
|
||||
rollingUpdate:
|
||||
partition: {{ .Values.controller.rollingUpdate.partition }}
|
||||
partition: {{ $statefulsetObject.rollingUpdate.partition }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }}
|
||||
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
|
||||
app.kubernetes.io/component: {{ $statefulsetObject.identifier }}
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
|
||||
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject)) }}
|
||||
annotations: {{ . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject)) }}
|
||||
labels: {{ . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
|
||||
volumeClaimTemplates:
|
||||
{{- range $index, $volumeClaimTemplate := .Values.volumeClaimTemplates }}
|
||||
- metadata:
|
||||
name: {{ $volumeClaimTemplate.name }}
|
||||
{{- with ($volumeClaimTemplate.labels | default dict) }}
|
||||
labels: {{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with ($volumeClaimTemplate.annotations | default dict) }}
|
||||
annotations: {{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ required (printf "accessMode is required for volumeClaimTemplate %v" $volumeClaimTemplate.name) $volumeClaimTemplate.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ required (printf "size is required for PVC %v" $volumeClaimTemplate.name) $volumeClaimTemplate.size | quote }}
|
||||
{{- if $volumeClaimTemplate.storageClass }}
|
||||
storageClassName: {{ if (eq "-" $volumeClaimTemplate.storageClass) }}""{{- else }}{{ $volumeClaimTemplate.storageClass | quote }}{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject) | nindent 6 }}
|
||||
{{- with (include "bjw-s.common.lib.statefulset.volumeclaimtemplates" (dict "rootContext" $rootContext "statefulsetObject" $statefulsetObject)) }}
|
||||
volumeClaimTemplates: {{ . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue