This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for all Cert-Manager Certificate objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.class.certificate" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $name := .name -}}
|
||||
{{- $hosts := .hosts -}}
|
||||
{{- $certificateIssuer := .certificateIssuer -}}
|
||||
{{- $certificateSecretTemplate := .secretTemplate }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.cert-manager.certificate.apiVersion" $ }}
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: {{ $root.Values.namespace | default $root.Values.global.namespace | default $root.Release.Namespace }}
|
||||
spec:
|
||||
secretName: {{ $name }}
|
||||
dnsNames:
|
||||
{{- range $hosts }}
|
||||
- {{ tpl . $root | quote }}
|
||||
{{- end }}
|
||||
privateKey:
|
||||
algorithm: ECDSA
|
||||
size: 256
|
||||
rotationPolicy: Always
|
||||
issuerRef:
|
||||
name: {{ tpl $certificateIssuer $root | quote }}
|
||||
kind: ClusterIssuer
|
||||
group: cert-manager.io
|
||||
{{- if $certificateSecretTemplate }}
|
||||
secretTemplate:
|
||||
{{- $labels := (mustMerge ($certificateSecretTemplate.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $root | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $root "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($certificateSecretTemplate.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $root | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $root "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,83 @@
|
||||
{{- define "tc.v1.common.class.cnpg.cluster" -}}
|
||||
{{- $values := .Values.cnpg -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.cnpg -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $cnpgClusterName := $values.name -}}
|
||||
{{- $cnpgClusterLabels := $values.labels -}}
|
||||
{{- $cnpgClusterAnnotations := $values.annotations -}}
|
||||
{{- $hibernation := "off" -}}
|
||||
{{- if or $values.hibernate (include "tc.v1.common.lib.util.stopAll" $) -}}
|
||||
{{- $hibernation = "on" -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.cnpg.cluster.apiVersion" $ }}
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: {{ $cnpgClusterName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($cnpgClusterLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
labels:
|
||||
cnpg.io/reload: "on"
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $annotations := (mustMerge ($cnpgClusterAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
cnpg.io/hibernation: {{ $hibernation | quote }}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
instances: {{ $values.instances | default 2 }}
|
||||
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: {{ $values.database | default "app" }}
|
||||
owner: {{ $values.user | default "app" }}
|
||||
secret:
|
||||
name: {{ $cnpgClusterName }}-user
|
||||
|
||||
primaryUpdateStrategy: {{ $values.primaryUpdateStrategy | default "unsupervised" }}
|
||||
|
||||
storage:
|
||||
pvcTemplate:
|
||||
{{- with (include "tc.v1.common.lib.storage.storageClassName" ( dict "rootCtx" $ "objectData" $values.storage )) | trim }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ tpl ($values.storage.walsize | default $.Values.fallbackDefaults.vctSize) $ | quote }}
|
||||
|
||||
walStorage:
|
||||
pvcTemplate:
|
||||
{{- with (include "tc.v1.common.lib.storage.storageClassName" ( dict "rootCtx" $ "objectData" $values.storage )) | trim }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ tpl ($values.storage.walsize | default $.Values.fallbackDefaults.vctSize) $ | quote }}
|
||||
|
||||
monitoring:
|
||||
enablePodMonitor: {{ $values.monitoring.enablePodMonitor | default true }}
|
||||
|
||||
nodeMaintenanceWindow:
|
||||
inProgress: false
|
||||
reusePVC: true
|
||||
|
||||
{{- with (include "tc.v1.common.lib.container.resources" (dict "rootCtx" $ "objectData" $values) | trim) }}
|
||||
resources:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
postgresql:
|
||||
{{- tpl ( $values.postgresql | toYaml ) $ | nindent 4 }}
|
||||
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- define "tc.v1.common.class.cnpg.pooler" -}}
|
||||
{{- $values := .Values.cnpg -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.cnpg -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $cnpgClusterName := $values.name -}}
|
||||
{{- $cnpgName := $values.cnpgName -}}
|
||||
{{- $cnpgPoolerName := $values.poolerName -}}
|
||||
{{- $cnpgClusterLabels := $values.labels -}}
|
||||
{{- $cnpgClusterAnnotations := $values.annotations -}}
|
||||
{{- $instances := $values.pooler.instances | default 2 -}}
|
||||
{{- if or $values.hibernate (include "tc.v1.common.lib.util.stopAll" $) -}}
|
||||
{{- $instances = 0 -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.cnpg.pooler.apiVersion" $ }}
|
||||
kind: Pooler
|
||||
metadata:
|
||||
name: {{ printf "%v-%v" $cnpgClusterName $values.pooler.type }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
spec:
|
||||
cluster:
|
||||
name: {{ $cnpgClusterName }}
|
||||
instances: {{ $instances }}
|
||||
type: {{ $values.pooler.type }}
|
||||
pgbouncer:
|
||||
poolMode: session
|
||||
parameters:
|
||||
max_client_conn: "1000"
|
||||
default_pool_size: "10"
|
||||
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,37 @@
|
||||
{{/* Configmap Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.configmap" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the configmap.
|
||||
labels: The labels of the configmap.
|
||||
annotations: The annotations of the configmap.
|
||||
data: The data of the configmap.
|
||||
namespace: The namespace of the configmap. (Optional)
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.configmap" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Configmap") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- tpl (toYaml $objectData.data) $rootCtx | nindent 2 }}
|
||||
{{/* This comment is here to add a new line */}}
|
||||
{{- end -}}
|
||||
52
helm-charts/dashy/charts/common/templates/class/_cronjob.tpl
Normal file
52
helm-charts/dashy/charts/common/templates/class/_cronjob.tpl
Normal file
@@ -0,0 +1,52 @@
|
||||
{{/* CronJob Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.cronjob" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the CronJob.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.cronjob" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- include "tc.v1.common.lib.workload.cronjobValidation" (dict "objectData" $objectData) }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "CronJob") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.cronjobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- $labels := (mustMerge ($objectData.podSpec.labels | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.podSpec.annotations | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.externalInterfacePodAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 12 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.pod" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 10 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{/* DaemonSet Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.deployment" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the DaemonSet.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.daemonset" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- include "tc.v1.common.lib.workload.daemonsetValidation" (dict "objectData" $objectData) }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "DaemonSet") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.daemonsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- $labels := (mustMerge ($objectData.podSpec.labels | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.podSpec.annotations | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.externalInterfacePodAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.pod" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{/* Deployment Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.deployment" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the Deployment.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.deployment" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- include "tc.v1.common.lib.workload.deploymentValidation" (dict "objectData" $objectData) }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Deployment") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.deploymentSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- $labels := (mustMerge ($objectData.podSpec.labels | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.podSpec.annotations | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.externalInterfacePodAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.pod" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{/* Endpoint Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.endpoint" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The service data, that will be used to render the Service object.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.endpoint" -}}
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Endpoint") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
subsets:
|
||||
- addresses:
|
||||
{{- include "tc.v1.common.lib.endpoint.addresses" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
ports:
|
||||
{{- include "tc.v1.common.lib.endpoint.ports" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,41 @@
|
||||
{{/* EndpointSlice Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.endpointSlice" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The service data, that will be used to render the Service object.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.endpointSlice" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
|
||||
{{- $addressType := $objectData.addressType | default "IPv4" -}}
|
||||
{{- if $objectData.addressType -}}
|
||||
{{- $addressType = tpl $addressType $rootCtx -}}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
apiVersion: discovery.k8s.io/v1
|
||||
kind: EndpointSlice
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Endpoint Slice") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- $_ := set $labels "kubernetes.io/service-name" $objectData.name -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
addressType: {{ $addressType }}
|
||||
ports:
|
||||
{{- include "tc.v1.common.lib.endpointslice.ports" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 }}
|
||||
endpoints:
|
||||
{{- include "tc.v1.common.lib.endpointslice.endpoints" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,58 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for horizontal pod autoscaler objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.class.hpa" -}}
|
||||
{{- $targetName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $hpaName := $fullName -}}
|
||||
{{- $values := .Values.hpa -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.hpa -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $hpaLabels := $values.labels -}}
|
||||
{{- $hpaAnnotations := $values.annotations -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $hpaName = printf "%v-%v" $hpaName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.hpa.apiVersion" $ }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ $hpaName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($hpaLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($hpaAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ $values.targetKind | default ( include "tc.v1.common.names.controllerType" . ) }}
|
||||
name: {{ $values.target | default $targetName }}
|
||||
minReplicas: {{ $values.minReplicas | default 1 }}
|
||||
maxReplicas: {{ $values.maxReplicas | default 3 }}
|
||||
metrics:
|
||||
{{- if $values.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ $values.targetCPUUtilizationPercentage }}
|
||||
{{- end -}}
|
||||
{{- if $values.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ $values.targetMemoryUtilizationPercentage }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
157
helm-charts/dashy/charts/common/templates/class/_ingress.tpl
Normal file
157
helm-charts/dashy/charts/common/templates/class/_ingress.tpl
Normal file
@@ -0,0 +1,157 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for all Ingress objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.class.ingress" -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $ingressName := $fullName -}}
|
||||
{{- $values := .Values.ingress -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.ingress -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $ingressLabels := $values.labels -}}
|
||||
{{- $ingressAnnotations := $values.annotations -}}
|
||||
|
||||
{{- $ingressName = $values.name -}}
|
||||
|
||||
{{/* Get the name of the primary service, if any */}}
|
||||
{{- $primaryServiceName := (include "tc.v1.common.lib.util.service.primary" (dict "services" .Values.service "root" .)) -}}
|
||||
{{/* Get service values of the primary service, if any */}}
|
||||
{{- $primaryService := get .Values.service $primaryServiceName -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "tc.v1.common.lib.util.service.ports.primary" (dict "svcValues" $primaryService "svcName" $primaryServiceName )) -}}
|
||||
|
||||
{{- $mddwrNamespace := "tc-system" -}}
|
||||
{{- if $.Values.operator.traefik -}}
|
||||
{{- if $.Values.operator.traefik.namespace -}}
|
||||
{{- $mddwrNamespace = $.Values.operator.traefik.namespace -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $values.ingressClassName -}}
|
||||
|
||||
{{- if $.Values.global.ixChartContext -}}
|
||||
{{- $mddwrNamespace = (printf "ix-%s" $values.ingressClassName) -}}
|
||||
{{- else -}}
|
||||
{{- $mddwrNamespace = $values.ingressClassName -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $fixedMiddlewares := "" -}}
|
||||
{{- if $values.enableFixedMiddlewares -}}
|
||||
|
||||
{{/* If cors is enabled, replace the default fixedMiddleware with the opencors chain */}}
|
||||
{{- if $values.allowCors -}}
|
||||
{{- $corsMiddlewares := list "tc-opencors-chain" }}
|
||||
{{- $_ := set $values "fixedMiddlewares" $corsMiddlewares -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $index, $fixedMiddleware := $values.fixedMiddlewares -}}
|
||||
{{- if $index -}}
|
||||
{{- $fixedMiddlewares = ( printf "%v, %v-%v@%v" $fixedMiddlewares $mddwrNamespace $fixedMiddleware "kubernetescrd" ) -}}
|
||||
{{- else -}}
|
||||
{{- $fixedMiddlewares = ( printf "%v-%v@%v" $mddwrNamespace $fixedMiddleware "kubernetescrd" ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $middlewares := "" -}}
|
||||
{{- range $index, $middleware := $values.middlewares -}}
|
||||
{{- if $index -}}
|
||||
{{- $middlewares = ( printf "%v, %v-%v@%v" $middlewares $mddwrNamespace $middleware "kubernetescrd" ) -}}
|
||||
{{- else -}}
|
||||
{{- $middlewares = ( printf "%v-%v@%v" $mddwrNamespace $middleware "kubernetescrd" ) -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
{{- if and ( $fixedMiddlewares ) ( $middlewares ) -}}
|
||||
{{- $middlewares = ( printf "%v, %v" $fixedMiddlewares $middlewares ) -}}
|
||||
{{- else if $fixedMiddlewares -}}
|
||||
{{- $middlewares = ( printf "%s" $fixedMiddlewares ) -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.ingress.apiVersion" $ }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $ingressName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($ingressLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($ingressAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
{{- with $values.certificateIssuer }}
|
||||
cert-manager.io/cluster-issuer: {{ tpl ( toYaml . ) $ }}
|
||||
cert-manager.io/private-key-rotation-policy: Always
|
||||
{{- end }}
|
||||
"traefik.ingress.kubernetes.io/router.entrypoints": {{ $values.entrypoint | default "websecure" }}
|
||||
"traefik.ingress.kubernetes.io/router.middlewares": {{ $middlewares | quote }}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $values.ingressClassName }}
|
||||
ingressClassName: {{ $values.ingressClassName }}
|
||||
{{- end -}}
|
||||
{{- if $values.certificateIssuer }}
|
||||
tls:
|
||||
{{- range $index, $hostsValues := $values.hosts }}
|
||||
- hosts:
|
||||
- {{ tpl $hostsValues.host $ | quote }}
|
||||
secretName: {{ ( printf "%v-%v-%v" $ingressName "tls" $index ) }}
|
||||
{{- end -}}
|
||||
{{- else if $values.tls }}
|
||||
tls:
|
||||
{{- range $index, $tlsValues := $values.tls }}
|
||||
{{- $tlsName := ( printf "%v-%v" "tls" $index ) }}
|
||||
- hosts:
|
||||
{{- range $tlsValues.hosts }}
|
||||
- {{ tpl . $ | quote }}
|
||||
{{- end -}}
|
||||
{{- if $tlsValues.certificateIssuer }}
|
||||
secretName: {{ printf "%v-%v" $ingressName $tlsName }}
|
||||
{{- else if and ($tlsValues.scaleCert) ($.Values.global.ixChartContext) -}}
|
||||
{{- $cert := dict }}
|
||||
{{- $_ := set $cert "id" $tlsValues.scaleCert }}
|
||||
{{- $_ := set $cert "nameOverride" $tlsName }}
|
||||
secretName: {{ printf "%s-tls-%v" (include "tc.v1.common.lib.chart.names.fullname" $) $index }}
|
||||
{{- else if .clusterCertificate }}
|
||||
secretName: clusterissuer-templated-{{ tpl .clusterCertificate $ }}
|
||||
{{- else if .secretName }}
|
||||
secretName: {{ tpl .secretName $ | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.hosts }}
|
||||
- host: {{ tpl .host $ | 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 }}
|
||||
pathType: {{ default "Prefix" .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $service }}
|
||||
port:
|
||||
number: {{ $port }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- end -}}
|
||||
52
helm-charts/dashy/charts/common/templates/class/_job.tpl
Normal file
52
helm-charts/dashy/charts/common/templates/class/_job.tpl
Normal file
@@ -0,0 +1,52 @@
|
||||
{{/* Job Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.job" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the Job.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.job" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- include "tc.v1.common.lib.workload.jobValidation" (dict "objectData" $objectData) }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Job") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.jobSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- $labels := (mustMerge ($objectData.podSpec.labels | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.podSpec.annotations | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.externalInterfacePodAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.pod" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,38 @@
|
||||
{{/* MutatingWebhookConfiguration Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.mutatingWebhookConfiguration" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the MutatingWebhookConfiguration.
|
||||
labels: The labels of the MutatingWebhookConfiguration.
|
||||
annotations: The annotations of the MutatingWebhookConfiguration.
|
||||
data: The data of the MutatingWebhookConfiguration.
|
||||
namespace: The namespace of the MutatingWebhookConfiguration. (Optional)
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.mutatingWebhookConfiguration" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: MutatingWebhookConfiguration
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Webhook") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
webhooks:
|
||||
{{- range $webhook := $objectData.webhooks -}}
|
||||
{{- include "tc.v1.common.lib.webhook" (dict "webhook" $webhook "rootCtx" $rootCtx) | trim | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{/* Network Attachment Definition Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.networkAttachmentDefinition" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the Network Attachment Definition.
|
||||
labels: The labels of the Network Attachment Definition.
|
||||
annotations: The annotations of the Network Attachment Definition.
|
||||
config: The config of the interface
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.networkAttachmentDefinition" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: k8s.cni.cncf.io/v1
|
||||
kind: NetworkAttachmentDefinition
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Network Attachment Definition") }}
|
||||
{{- $labels := (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml) | default dict -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml) | default dict -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
config: {{ $objectData.config | squote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,185 @@
|
||||
{{/*
|
||||
Blueprint for the NetworkPolicy object
|
||||
*/}}
|
||||
{{- define "tc.v1.common.class.networkpolicy" -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $networkPolicyName := $fullName -}}
|
||||
{{- $values := .Values.networkPolicy -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.networkPolicy -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $networkpolicyLabels := $values.labels -}}
|
||||
{{- $networkpolicyAnnotations := $values.annotations -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $networkPolicyName = printf "%v-%v" $networkPolicyName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.networkpolicy.apiVersion" $ }}
|
||||
metadata:
|
||||
name: {{ $networkPolicyName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($networkpolicyLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($networkpolicyAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podSelector:
|
||||
{{- if $values.podSelector }}
|
||||
{{- tpl (toYaml $values.podSelector) $ | nindent 4 }}
|
||||
{{- else if $values.targetSelector }}
|
||||
{{- $objectData := dict "targetSelector" $values.targetSelector }}
|
||||
{{- $selectedPod := fromYaml ( include "tc.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $ "objectData" $objectData)) }}
|
||||
{{- $selectedPodName := $selectedPod.shortName }}
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $ "objectType" "pod" "objectName" $selectedPodName) | indent 8 }}
|
||||
{{- else }}
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $ "objectType" "" "objectName" "") | indent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $values.policyType }}
|
||||
{{- if eq $values.policyType "ingress" }}
|
||||
policyTypes: ["Ingress"]
|
||||
{{- else if eq $values.policyType "egress" }}
|
||||
policyTypes: ["Egress"]
|
||||
|
||||
{{- else if eq $values.policyType "ingress-egress" }}
|
||||
policyTypes: ["Ingress", "Egress"]
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $values.egress }}
|
||||
egress:
|
||||
{{- range $values.egress }}
|
||||
- to:
|
||||
{{- range .to -}}
|
||||
{{- $nss := false -}}
|
||||
{{- $ipb := false -}}
|
||||
{{- if .ipBlock -}}
|
||||
{{- if .ipBlock.cidr -}}
|
||||
{{- $ipb = true }}
|
||||
- ipBlock:
|
||||
cidr: {{ .ipBlock.cidr }}
|
||||
{{- if .ipBlock.except }}
|
||||
except:
|
||||
{{- range .ipBlock.except }}
|
||||
- {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and ( .namespaceSelector ) ( not $ipb ) -}}
|
||||
{{- if or ( .namespaceSelector.matchLabels ) ( .namespaceSelector.matchExpressions ) -}}
|
||||
{{- $nss = true }}
|
||||
- namespaceSelector:
|
||||
{{- if .namespaceSelector.matchLabels }}
|
||||
matchLabels:
|
||||
{{- .namespaceSelector.matchLabels | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- if .namespaceSelector.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{- .namespaceSelector.matchExpressions | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and ( .podSelector ) ( not $ipb ) -}}
|
||||
{{- if or ( .podSelector.matchLabels ) ( .podSelector.matchExpressions ) -}}
|
||||
{{- if $nss }}
|
||||
podSelector:
|
||||
{{- else }}
|
||||
- podSelector:
|
||||
{{- end -}}
|
||||
{{- if .podSelector.matchLabels }}
|
||||
matchLabels:
|
||||
{{- .podSelector.matchLabels | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- if .podSelector.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{- .podSelector.matchExpressions | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .ports }}
|
||||
ports:
|
||||
{{- . | toYaml | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $values.ingress }}
|
||||
ingress:
|
||||
{{- range $values.ingress }}
|
||||
- from:
|
||||
{{- range .from -}}
|
||||
{{- $nss := false -}}
|
||||
{{- $ipb := false -}}
|
||||
{{- if .ipBlock -}}
|
||||
{{- if .ipBlock.cidr -}}
|
||||
{{- $ipb = true }}
|
||||
- ipBlock:
|
||||
cidr: {{ .ipBlock.cidr }}
|
||||
{{- if .ipBlock.except }}
|
||||
except:
|
||||
{{- range .ipBlock.except }}
|
||||
- {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and ( .namespaceSelector ) ( not $ipb ) -}}
|
||||
{{- if or ( .namespaceSelector.matchLabels ) ( .namespaceSelector.matchExpressions ) -}}
|
||||
{{- $nss = true }}
|
||||
- namespaceSelector:
|
||||
{{- if .namespaceSelector.matchLabels }}
|
||||
matchLabels:
|
||||
{{- .namespaceSelector.matchLabels | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- if .namespaceSelector.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{- .namespaceSelector.matchExpressions | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and ( .podSelector ) ( not $ipb ) -}}
|
||||
{{- if or ( .podSelector.matchLabels ) ( .podSelector.matchExpressions ) -}}
|
||||
{{- if $nss }}
|
||||
podSelector:
|
||||
{{- else }}
|
||||
- podSelector:
|
||||
{{- end }}
|
||||
{{- if .podSelector.matchLabels }}
|
||||
matchLabels:
|
||||
{{- .podSelector.matchLabels | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- if .podSelector.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{- .podSelector.matchExpressions | toYaml | nindent 12 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .ports }}
|
||||
ports:
|
||||
{{- . | toYaml | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,54 @@
|
||||
{{/* poddisruptionbudget Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.podDisruptionBudget" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the podDisruptionBudget.
|
||||
labels: The labels of the podDisruptionBudget.
|
||||
annotations: The annotations of the podDisruptionBudget.
|
||||
data: The data of the podDisruptionBudget.
|
||||
namespace: The namespace of the podDisruptionBudget. (Optional)
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.podDisruptionBudget" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Pod Disruption Budget") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- if $objectData.customLabels -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $objectData.customLabels) | trim) }}
|
||||
{{- . | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $selectedPod := fromJson (include "tc.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Pod Disruption Budget")) }}
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $selectedPod.shortName) | nindent 6 }}
|
||||
{{- end -}}
|
||||
{{- if hasKey $objectData "minAvailable" }}
|
||||
minAvailable: {{ tpl (toString $objectData.minAvailable) $rootCtx }}
|
||||
{{- end -}}
|
||||
{{- if hasKey $objectData "maxUnavailable" }}
|
||||
maxUnavailable: {{ tpl (toString $objectData.maxUnavailable) $rootCtx }}
|
||||
{{- end -}}
|
||||
{{- with $objectData.unhealthyPodEvictionPolicy }}
|
||||
unhealthyPodEvictionPolicy: {{ tpl . $rootCtx }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,47 @@
|
||||
{{- define "tc.v1.common.class.podmonitor" -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $podmonitorName := $fullName -}}
|
||||
{{- $values := .Values.podmonitor -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.metrics -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $podmonitorLabels := $values.labels -}}
|
||||
{{- $podmonitorAnnotations := $values.annotations -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $podmonitorName = printf "%v-%v" $podmonitorName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.podmonitor.apiVersion" $ }}
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ $podmonitorName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($podmonitorLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $annotations := (mustMerge ($podmonitorAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
jobLabel: app.kubernetes.io/name
|
||||
selector:
|
||||
{{- if $values.selector }}
|
||||
{{- tpl (toYaml $values.selector) $ | nindent 4 }}
|
||||
{{- else }}
|
||||
{{- $objectData := dict "targetSelector" $values.targetSelector }}
|
||||
{{- $selectedPod := fromYaml ( include "tc.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $ "objectData" $objectData)) }}
|
||||
{{- $selectedPodName := $selectedPod.shortName }}
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $ "objectType" "pod" "objectName" $selectedPodName) | indent 6 }}
|
||||
{{- end }}
|
||||
podMetricsEndpoints:
|
||||
{{- tpl (toYaml $values.endpoints) $ | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{- define "tc.v1.common.class.prometheusrule" -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $prometheusruleName := $fullName -}}
|
||||
{{- $values := .Values.prometheusrule -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.metrics -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $prometheusruleLabels := $values.labels -}}
|
||||
{{- $prometheusruleAnnotations := $values.annotations -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $prometheusruleName = printf "%v-%v" $prometheusruleName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.prometheusrule.apiVersion" $ }}
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ $prometheusruleName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($prometheusruleLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $annotations := (mustMerge ($prometheusruleAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
{{- range $name, $groupValues := .groups }}
|
||||
- name: {{ $prometheusruleName }}-{{ $name }}
|
||||
rules:
|
||||
{{- with $groupValues.rules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $groupValues.additionalrules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $id, $groupValues := .additionalgroups }}
|
||||
- name: {{ $prometheusruleName }}-{{ if $groupValues.name }}{{ $groupValues.name }}{{ else }}{{ $id }}{{ end }}
|
||||
rules:
|
||||
{{- with $groupValues.rules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $groupValues.additionalrules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
57
helm-charts/dashy/charts/common/templates/class/_pvc.tpl
Normal file
57
helm-charts/dashy/charts/common/templates/class/_pvc.tpl
Normal file
@@ -0,0 +1,57 @@
|
||||
{{/* PVC Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.pvc" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the PVC.
|
||||
labels: The labels of the PVC.
|
||||
annotations: The annotations of the PVC.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.pvc" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
|
||||
{{- $pvcRetain := $rootCtx.Values.fallbackDefaults.pvcRetain -}}
|
||||
{{- if (kindIs "bool" $objectData.retain) -}}
|
||||
{{- $pvcRetain = $objectData.retain -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $pvcSize := $rootCtx.Values.fallbackDefaults.pvcSize -}}
|
||||
{{- with $objectData.size -}}
|
||||
{{- $pvcSize = tpl . $rootCtx -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Persistent Volume Claim") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- if $pvcRetain -}}
|
||||
{{- $_ := set $annotations "\"helm.sh/resource-policy\"" "keep" -}}
|
||||
{{- end -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- include "tc.v1.common.lib.pvc.accessModes" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "PVC") | trim | nindent 4 }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ $pvcSize }}
|
||||
{{- with $objectData.volumeName }}
|
||||
volumeName: {{ tpl . $rootCtx }}
|
||||
{{- end -}}
|
||||
{{- with (include "tc.v1.common.lib.storage.storageClassName" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "PVC") | trim) }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
64
helm-charts/dashy/charts/common/templates/class/_rbac.tpl
Normal file
64
helm-charts/dashy/charts/common/templates/class/_rbac.tpl
Normal file
@@ -0,0 +1,64 @@
|
||||
{{/* RBAC Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.rbac" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the rbac.
|
||||
labels: The labels of the rbac.
|
||||
annotations: The annotations of the rbac.
|
||||
clusterWide: Whether the rbac is cluster wide or not.
|
||||
rules: The rules of the rbac.
|
||||
subjects: The subjects of the rbac.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.rbac" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: {{ ternary "ClusterRole" "Role" $objectData.clusterWide }}
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
{{- if not $objectData.clusterWide }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "RBAC") }}
|
||||
{{- end }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- include "tc.v1.common.lib.rbac.rules" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: {{ ternary "ClusterRoleBinding" "RoleBinding" $objectData.clusterWide }}
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
{{- if not $objectData.clusterWide }}
|
||||
namespace: {{ $rootCtx.Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: {{ ternary "ClusterRole" "Role" $objectData.clusterWide }}
|
||||
name: {{ $objectData.name }}
|
||||
subjects:
|
||||
{{- include "tc.v1.common.lib.rbac.serviceAccount" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 }}
|
||||
{{- include "tc.v1.common.lib.rbac.subjects" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 }}
|
||||
{{- end -}}
|
||||
87
helm-charts/dashy/charts/common/templates/class/_route.tpl
Normal file
87
helm-charts/dashy/charts/common/templates/class/_route.tpl
Normal file
@@ -0,0 +1,87 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for all Route objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.class.route" -}}
|
||||
{{- $values := .Values.route -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.route -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $routeLabels := $values.labels -}}
|
||||
{{- $routeAnnotations := $values.annotations -}}
|
||||
|
||||
{{- $fullName := include "tc.v1.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" -}}
|
||||
|
||||
{{/* Get the name of the primary service, if any */}}
|
||||
{{- $primaryServiceName := (include "tc.v1.common.lib.util.service.primary" (dict "services" .Values.service "root" .)) -}}
|
||||
{{/* Get service values of the primary service, if any */}}
|
||||
{{- $primaryService := get .Values.service $primaryServiceName -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "tc.v1.common.lib.util.service.ports.primary" (dict "svcValues" $primaryService "svcName" $primaryServiceName )) }}
|
||||
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1alpha2
|
||||
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") -}}
|
||||
{{- fail (printf "Not a valid route kind (%s)" $routeKind) -}}
|
||||
{{- end }}
|
||||
kind: {{ $routeKind }}
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($routeLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($routeAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
parentRefs:
|
||||
{{- range $values.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 }}
|
||||
{{- if .sectionName }}
|
||||
sectionName: {{ .sectionName | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $values.hostnames }}
|
||||
hostnames:
|
||||
{{- with $values.hostnames }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.rules }}
|
||||
- backendRefs:
|
||||
{{- range .backendRefs }}
|
||||
- group: {{ default "" .group | quote}}
|
||||
kind: {{ default "Service" .kind }}
|
||||
name: {{ default $defaultServiceName .name }}
|
||||
namespace: {{ default $.Release.Namespace .namespace }}
|
||||
port: {{ default $defaultServicePort.port .port }}
|
||||
weight: {{ default 1 .weight }}
|
||||
{{- end }}
|
||||
{{- if (eq $routeKind "HTTPRoute") }}
|
||||
{{- with .matches }}
|
||||
matches:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
58
helm-charts/dashy/charts/common/templates/class/_secret.tpl
Normal file
58
helm-charts/dashy/charts/common/templates/class/_secret.tpl
Normal file
@@ -0,0 +1,58 @@
|
||||
{{/* Secret Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the secret.
|
||||
labels: The labels of the secret.
|
||||
annotations: The annotations of the secret.
|
||||
type: The type of the secret.
|
||||
data: The data of the secret.
|
||||
namespace: The namespace of the secret. (Optional)
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.secret" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- $secretType := "Opaque" -}}
|
||||
|
||||
{{- if eq $objectData.type "certificate" -}}
|
||||
{{- $secretType = "kubernetes.io/tls" -}}
|
||||
{{- else if eq $objectData.type "imagePullSecret" -}}
|
||||
{{- $secretType = "kubernetes.io/dockerconfigjson" -}}
|
||||
{{- else if $objectData.type -}}
|
||||
{{- $secretType = $objectData.type -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: {{ $secretType }}
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Secret") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- if (mustHas $objectData.type (list "certificate" "imagePullSecret")) }}
|
||||
data:
|
||||
{{- if eq $objectData.type "certificate" }}
|
||||
tls.crt: {{ $objectData.data.certificate | trim | b64enc }}
|
||||
tls.key: {{ $objectData.data.privatekey | trim | b64enc }}
|
||||
{{- else if eq $objectData.type "imagePullSecret" }}
|
||||
.dockerconfigjson: {{ $objectData.data | trim | b64enc }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
stringData:
|
||||
{{- tpl (toYaml $objectData.data) $rootCtx | nindent 2 }}
|
||||
{{/* This comment is here to add a new line */}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
115
helm-charts/dashy/charts/common/templates/class/_service.tpl
Normal file
115
helm-charts/dashy/charts/common/templates/class/_service.tpl
Normal file
@@ -0,0 +1,115 @@
|
||||
{{/* Service Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.service" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The service data, that will be used to render the Service object.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.service" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
|
||||
{{- $svcType := $objectData.type | default $rootCtx.Values.fallbackDefaults.serviceType -}}
|
||||
|
||||
{{/* Init variables */}}
|
||||
{{- $hasHTTPSPort := false -}}
|
||||
{{- $hasHostPort := false -}}
|
||||
{{- $hostNetwork := false -}}
|
||||
{{- $podValues := dict -}}
|
||||
|
||||
{{- range $portName, $port := $objectData.ports -}}
|
||||
{{- if $port.enabled -}}
|
||||
{{- if eq (tpl ($port.protocol | default "") $rootCtx) "https" -}}
|
||||
{{- $hasHTTPSPort = true -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (hasKey $port "hostPort") $port.hostPort -}}
|
||||
{{- $hasHostPort = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $specialTypes := (list "ExternalName" "ExternalIP") -}}
|
||||
{{/* External Name / External IP does not rely on any pod values */}}
|
||||
{{- if not (mustHas $svcType $specialTypes) -}}
|
||||
{{/* Get Pod Values based on the selector (or the absence of it) */}}
|
||||
{{- $podValues = fromJson (include "tc.v1.common.lib.helpers.getSelectedPodValues" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Service")) -}}
|
||||
|
||||
{{- if $podValues -}}
|
||||
{{/* Get Pod hostNetwork configuration */}}
|
||||
{{- $hostNetwork = include "tc.v1.common.lib.pod.hostNetwork" (dict "rootCtx" $rootCtx "objectData" $podValues) -}}
|
||||
{{/* When hostNetwork is set on the pod, force ClusterIP, so services wont try to bind the same ports on the host */}}
|
||||
{{- if or (and (kindIs "bool" $hostNetwork) $hostNetwork) (and (kindIs "string" $hostNetwork) (eq $hostNetwork "true")) -}}
|
||||
{{- $svcType = "ClusterIP" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* When hostPort is defined, force ClusterIP aswell */}}
|
||||
{{- if $hasHostPort -}}
|
||||
{{- $svcType = "ClusterIP" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $objectData "type" $svcType }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Service") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "service" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- if eq $objectData.type "LoadBalancer" -}}
|
||||
{{- include "tc.v1.common.lib.service.metalLBAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData "annotations" $annotations) -}}
|
||||
{{- end -}}
|
||||
{{- if $hasHTTPSPort -}}
|
||||
{{- include "tc.v1.common.lib.service.traefikAnnotations" (dict "rootCtx" $rootCtx "annotations" $annotations) -}}
|
||||
{{- end -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if eq $objectData.type "ClusterIP" -}}
|
||||
{{- include "tc.v1.common.lib.service.spec.clusterIP" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
|
||||
{{- else if eq $objectData.type "LoadBalancer" -}}
|
||||
{{- include "tc.v1.common.lib.service.spec.loadBalancer" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
|
||||
{{- else if eq $objectData.type "NodePort" -}}
|
||||
{{- include "tc.v1.common.lib.service.spec.nodePort" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
|
||||
{{- else if eq $objectData.type "ExternalName" -}}
|
||||
{{- include "tc.v1.common.lib.service.spec.externalName" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
|
||||
{{- else if eq $objectData.type "ExternalIP" -}}
|
||||
{{- include "tc.v1.common.lib.service.spec.externalIP" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 2 -}}
|
||||
{{- end -}}
|
||||
{{- with (include "tc.v1.common.lib.service.ports" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
|
||||
ports:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- if not (mustHas $objectData.type $specialTypes) }}
|
||||
selector:
|
||||
{{- if $objectData.selectorLabels }}
|
||||
{{- tpl ( toYaml $objectData.selectorLabels) $rootCtx | nindent 4 }}
|
||||
{{- else }}
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $podValues.shortName) | trim | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if eq $objectData.type "ExternalIP" -}}
|
||||
{{- $useSlice := true -}}
|
||||
{{- if kindIs "bool" $objectData.useSlice -}}
|
||||
{{- $useSlice = $objectData.useSlice -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $useSlice -}}
|
||||
{{- include "tc.v1.common.class.endpointSlice" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 0 }}
|
||||
{{- else -}}
|
||||
{{- include "tc.v1.common.class.endpoint" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{/* Service Account Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.serviceAccount" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the serviceAccount.
|
||||
labels: The labels of the serviceAccount.
|
||||
annotations: The annotations of the serviceAccount.
|
||||
autoMountToken: Whether to mount the ServiceAccount token or not.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.serviceAccount" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Service Account") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ $objectData.automountServiceAccountToken | default false }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,47 @@
|
||||
{{- define "tc.v1.common.class.servicemonitor" -}}
|
||||
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
||||
{{- $servicemonitorName := $fullName -}}
|
||||
{{- $values := .Values.servicemonitor -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.metrics -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $servicemonitorLabels := $values.labels -}}
|
||||
{{- $servicemonitorAnnotations := $values.annotations -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $servicemonitorName = printf "%v-%v" $servicemonitorName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: {{ include "tc.v1.common.capabilities.servicemonitor.apiVersion" $ }}
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ $servicemonitorName }}
|
||||
namespace: {{ $.Values.namespace | default $.Values.global.namespace | default $.Release.Namespace }}
|
||||
{{- $labels := (mustMerge ($servicemonitorLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- $annotations := (mustMerge ($servicemonitorAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
jobLabel: app.kubernetes.io/name
|
||||
selector:
|
||||
{{- if $values.selector }}
|
||||
{{- tpl (toYaml $values.selector) $ | nindent 4 }}
|
||||
{{- else }}
|
||||
{{- $objectData := dict "targetSelector" $values.targetSelector }}
|
||||
{{- $selectedService := fromYaml ( include "tc.v1.common.lib.helpers.getSelectedServiceValues" (dict "rootCtx" $ "objectData" $objectData)) }}
|
||||
{{- $selectedServiceName := $selectedService.shortName }}
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $ "objectType" "service" "objectName" $selectedServiceName) | indent 6 }}
|
||||
{{- end }}
|
||||
endpoints:
|
||||
{{- tpl (toYaml $values.endpoints) $ | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,59 @@
|
||||
{{/* StatefulSet Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.deployment" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData: The object data to be used to render the StatefulSet.
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.statefulset" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData -}}
|
||||
{{- include "tc.v1.common.lib.workload.statefulsetValidation" (dict "objectData" $objectData) }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "StatefulSet") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.statefulsetSpec" (dict "rootCtx" $rootCtx "objectData" $objectData) | indent 2 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | trim | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- $labels := (mustMerge ($objectData.podSpec.labels | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podLabels" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.selectorLabels" (dict "rootCtx" $rootCtx "objectType" "pod" "objectName" $objectData.shortName) | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.podSpec.annotations | default dict)
|
||||
(include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.externalInterfacePodAnnotations" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml)
|
||||
(include "tc.v1.common.lib.metadata.podAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "tc.v1.common.lib.workload.pod" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim | nindent 6 }}
|
||||
{{- with (include "tc.v1.common.lib.storage.volumeClaimTemplates" (dict "rootCtx" $rootCtx "objectData" $objectData) | trim) }}
|
||||
volumeClaimTemplates:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,38 @@
|
||||
{{/* ValidatingWebhookconfiguration Class */}}
|
||||
{{/* Call this template:
|
||||
{{ include "tc.v1.common.class.validatingWebhookconfiguration" (dict "rootCtx" $ "objectData" $objectData) }}
|
||||
|
||||
rootCtx: The root context of the chart.
|
||||
objectData:
|
||||
name: The name of the validatingWebhookconfiguration.
|
||||
labels: The labels of the validatingWebhookconfiguration.
|
||||
annotations: The annotations of the validatingWebhookconfiguration.
|
||||
data: The data of the validatingWebhookconfiguration.
|
||||
namespace: The namespace of the validatingWebhookconfiguration. (Optional)
|
||||
*/}}
|
||||
|
||||
{{- define "tc.v1.common.class.validatingWebhookconfiguration" -}}
|
||||
|
||||
{{- $rootCtx := .rootCtx -}}
|
||||
{{- $objectData := .objectData }}
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingWebhookConfiguration
|
||||
metadata:
|
||||
name: {{ $objectData.name }}
|
||||
namespace: {{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Webhook") }}
|
||||
{{- $labels := (mustMerge ($objectData.labels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
|
||||
labels:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
|
||||
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
|
||||
annotations:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end }}
|
||||
webhooks:
|
||||
{{- range $webhook := $objectData.webhooks -}}
|
||||
{{- include "tc.v1.common.lib.webhook" (dict "webhook" $webhook "rootCtx" $rootCtx) | trim | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user