From 6b180abe7b036034bcd5572fd15ba070a912ebd5 Mon Sep 17 00:00:00 2001 From: Mohammad Abdolirad Date: Fri, 10 Jan 2025 16:00:33 +0100 Subject: [PATCH] Add PVC template & update dependencies --- README.md | 2 +- charts/helmet/Chart.lock | 8 +-- charts/helmet/Chart.yaml | 8 +-- charts/helmet/README.md | 4 +- charts/helmet/templates/_app.yaml | 2 + charts/helmet/templates/_configmap.yaml | 20 ++----- charts/helmet/templates/_deployment.yaml | 56 +++++++++--------- charts/helmet/templates/_hpa.yaml | 5 +- charts/helmet/templates/_ingress.yaml | 16 ++---- charts/helmet/templates/_podmonitor.yaml | 14 ++--- charts/helmet/templates/_pvc.yaml | 30 ++++++++++ charts/helmet/templates/_secret.yaml | 20 ++----- charts/helmet/templates/_service.yaml | 19 ++----- charts/helmet/templates/_serviceaccount.yaml | 20 ++----- charts/helmet/templates/_servicemonitor.yaml | 16 ++---- charts/helmet/templates/_tls-secrets.yaml | 5 +- charts/helmet/templates/_tls-selfsigned.yaml | 5 +- charts/helmet/values.yaml | 60 +++++++++++++++++++- 18 files changed, 169 insertions(+), 141 deletions(-) create mode 100644 charts/helmet/templates/_pvc.yaml diff --git a/README.md b/README.md index 4f3c390..1b74146 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Useful Helm Client Commands: ## License -Copyright © 2022 Company.info +Copyright © 2025 Company.info Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/charts/helmet/Chart.lock b/charts/helmet/Chart.lock index 8a5d0e3..21e0571 100644 --- a/charts/helmet/Chart.lock +++ b/charts/helmet/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common - repository: https://charts.bitnami.com/bitnami - version: 2.6.0 -digest: sha256:b729437099044744a7ed5decf9e458569558e9a7a1f084bba521fd0edc084fd4 -generated: "2023-07-25T12:04:37.195150444+02:00" + repository: oci://registry-1.docker.io/bitnamicharts + version: 2.29.0 +digest: sha256:824fbf9084fc3bf5c0407a389ed657a833141809bdcc0273e0cce0eafb1fd12d +generated: "2025-01-10T14:10:24.569071763+01:00" diff --git a/charts/helmet/Chart.yaml b/charts/helmet/Chart.yaml index f519b73..6b76e2c 100644 --- a/charts/helmet/Chart.yaml +++ b/charts/helmet/Chart.yaml @@ -3,8 +3,8 @@ name: helmet description: Helmet is a library Helm Chart for grouping common logics. This chart is not deployable by itself. home: https://github.com/companyinfo/helm-charts/blob/main/charts/helmet type: library -version: "0.11.0" -appVersion: "0.11.0" +version: "0.12.0" +appVersion: "0.12.0" keywords: - common - helper @@ -15,5 +15,5 @@ maintainers: url: https://company.info dependencies: - name: common - version: "2.6.0" - repository: "https://charts.bitnami.com/bitnami" + version: "2.29.0" + repository: "oci://registry-1.docker.io/bitnamicharts" diff --git a/charts/helmet/README.md b/charts/helmet/README.md index 92d3330..8f8b6f1 100644 --- a/charts/helmet/README.md +++ b/charts/helmet/README.md @@ -22,7 +22,7 @@ dependency on what we call the `Helmet` library. ## Prerequisites -- Kubernetes 1.19+ +- Kubernetes 1.23+ - Helm 3.9.0+ ## Getting started @@ -32,7 +32,7 @@ dependency on what we call the `Helmet` library. dependencies: - name: helmet - version: 0.11.0 + version: 0.12.0 repository: https://charts.companyinfo.dev import-values: # <== It is mandatory if you want to import the Helmet default values. - defaults diff --git a/charts/helmet/templates/_app.yaml b/charts/helmet/templates/_app.yaml index 54acee1..fb6eaa2 100644 --- a/charts/helmet/templates/_app.yaml +++ b/charts/helmet/templates/_app.yaml @@ -7,6 +7,8 @@ {{ include "helmet.deployment" . }} {{- end }} +{{ include "helmet.persistence" . }} + {{ include "helmet.hpa" . }} {{ include "helmet.ingress" . }} diff --git a/charts/helmet/templates/_configmap.yaml b/charts/helmet/templates/_configmap.yaml index 83c8327..fe2b750 100644 --- a/charts/helmet/templates/_configmap.yaml +++ b/charts/helmet/templates/_configmap.yaml @@ -5,21 +5,11 @@ kind: ConfigMap metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.configMap.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.configMap.labels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.configMap.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.configMap.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.configMap.annotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.configMap.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.configMap.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.configMap.data }} data: diff --git a/charts/helmet/templates/_deployment.yaml b/charts/helmet/templates/_deployment.yaml index 2ae4f8d..0c9783f 100644 --- a/charts/helmet/templates/_deployment.yaml +++ b/charts/helmet/templates/_deployment.yaml @@ -5,43 +5,31 @@ kind: Deployment metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.labels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + {{- $podLabels := include "common.tplvalues.merge" (dict "values" .Values.podLabels .Values.commonLabels "context" .) | fromYaml }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} {{- if .Values.updateStrategy }} strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} {{- end }} template: metadata: annotations: - {{- if .Values.podAnnotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} - {{- end }} + {{- if .Values.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} helm.sh/revision: {{ .Release.Revision | quote }} - labels: {{- include "common.labels.standard" . | nindent 8 }} - {{- if .Values.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} spec: {{- if .Values.initContainers }} initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} @@ -94,7 +82,7 @@ spec: {{- if .Values.resources }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- end }} - {{- if or .Values.configMap.mounted .Values.extraVolumeMounts }} + {{- if or .Values.configMap.mounted .Values.extraVolumeMounts .Values.persistence.enabled }} volumeMounts: {{- if .Values.configMap.mounted }} - name: {{ include "common.names.fullname" . }} @@ -103,6 +91,13 @@ spec: subPath: {{ .Values.configMap.subPath }} {{- end }} {{- end }} + {{- if .Values.persistence.enabled }} + - name: data + mountPath: {{ .Values.persistence.mountPath }} + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }} {{- end }} @@ -110,18 +105,23 @@ spec: {{- if .Values.sidecars }} {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }} {{- end }} - {{- if or .Values.configMap.mounted .Values.extraVolumes }} + {{- if or .Values.configMap.mounted .Values.extraVolumes .Values.persistence.enabled }} volumes: {{- if .Values.configMap.mounted }} - name: {{ include "common.names.fullname" . }} configMap: name: {{ include "common.names.fullname" . }} {{- end }} + {{- if .Values.persistence.enabled }} + - name: data + persistentVolumeClaim: + claimName: {{ default (include "common.names.fullname" .) .Values.persistence.existingClaim }} + {{- end }} {{- if .Values.extraVolumes }} {{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $) | nindent 8 }} {{- end }} {{- end }} - {{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | indent 6 }} + {{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | nindent 6 }} {{- if .Values.hostAliases }} hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} {{- end }} @@ -130,10 +130,10 @@ spec: {{- else if or .Values.podAffinityPreset .Values.podAntiAffinityPreset .Values.nodeAffinityPreset.type }} affinity: {{- if not (empty .Values.podAffinityPreset) }} - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }} {{- end }} {{- if not (empty .Values.podAntiAffinityPreset) }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }} {{- end }} {{- if not (empty .Values.nodeAffinityPreset.type) }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} diff --git a/charts/helmet/templates/_hpa.yaml b/charts/helmet/templates/_hpa.yaml index 3693b46..1a92841 100644 --- a/charts/helmet/templates/_hpa.yaml +++ b/charts/helmet/templates/_hpa.yaml @@ -6,10 +6,7 @@ kind: HorizontalPodAutoscaler metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/charts/helmet/templates/_ingress.yaml b/charts/helmet/templates/_ingress.yaml index ced1bcc..82e6bd9 100644 --- a/charts/helmet/templates/_ingress.yaml +++ b/charts/helmet/templates/_ingress.yaml @@ -6,18 +6,10 @@ kind: Ingress metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.commonAnnotations .Values.ingress.annotations }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.ingress.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.ingress.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} spec: {{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }} diff --git a/charts/helmet/templates/_podmonitor.yaml b/charts/helmet/templates/_podmonitor.yaml index 02a4824..6f92976 100644 --- a/charts/helmet/templates/_podmonitor.yaml +++ b/charts/helmet/templates/_podmonitor.yaml @@ -10,15 +10,11 @@ metadata: {{- else }} namespace: {{ include "common.names.namespace" . | quote }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.podMonitor.labels }} - {{- include "common.tplvalues.render" (dict "value" .Values.podMonitor.labels "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.podMonitor.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.podMonitor.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} spec: {{- if .Values.podMonitor.jobLabel }} diff --git a/charts/helmet/templates/_pvc.yaml b/charts/helmet/templates/_pvc.yaml new file mode 100644 index 0000000..76eeadf --- /dev/null +++ b/charts/helmet/templates/_pvc.yaml @@ -0,0 +1,30 @@ +{{- define "helmet.persistence" -}} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if or .Values.persistence.annotations .Values.commonAnnotations }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.persistence.annotations .Values.commonAnnotations) "context" .) }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- if .Values.persistence.selector }} + selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 4 }} + {{- end }} + {{- if .Values.persistence.dataSource }} + dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 4 }} + {{- end }} + {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 2 }} +{{- end -}} +{{- end -}} diff --git a/charts/helmet/templates/_secret.yaml b/charts/helmet/templates/_secret.yaml index 1073ed7..7232d47 100644 --- a/charts/helmet/templates/_secret.yaml +++ b/charts/helmet/templates/_secret.yaml @@ -5,21 +5,11 @@ kind: Secret metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.secret.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.secret.labels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.secret.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.secret.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.secret.annotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.secret.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.secret.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} type: {{ .Values.secret.type }} {{- if .Values.secret.data }} diff --git a/charts/helmet/templates/_service.yaml b/charts/helmet/templates/_service.yaml index 869e388..5d585d8 100644 --- a/charts/helmet/templates/_service.yaml +++ b/charts/helmet/templates/_service.yaml @@ -5,18 +5,10 @@ kind: Service metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.service.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.service.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.service.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} spec: type: {{ .Values.service.type }} @@ -39,5 +31,6 @@ spec: externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} ports: {{- include "common.tplvalues.render" (dict "value" .Values.service.ports "context" $) | nindent 4 }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := include "common.tplvalues.merge" (dict "values" .Values.podLabels .Values.commonLabels "context" .) | fromYaml }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} {{- end -}} diff --git a/charts/helmet/templates/_serviceaccount.yaml b/charts/helmet/templates/_serviceaccount.yaml index cc2c4a5..862cba1 100644 --- a/charts/helmet/templates/_serviceaccount.yaml +++ b/charts/helmet/templates/_serviceaccount.yaml @@ -6,21 +6,11 @@ kind: ServiceAccount metadata: name: {{ include "helmet.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.serviceAccount.labels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.labels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.serviceAccount.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.serviceAccount.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.serviceAccount.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/charts/helmet/templates/_servicemonitor.yaml b/charts/helmet/templates/_servicemonitor.yaml index 12bd8d4..74ab351 100644 --- a/charts/helmet/templates/_servicemonitor.yaml +++ b/charts/helmet/templates/_servicemonitor.yaml @@ -10,15 +10,11 @@ metadata: {{- else }} namespace: {{ include "common.names.namespace" . | quote }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.serviceMonitor.labels }} - {{- include "common.tplvalues.render" (dict "value" .Values.serviceMonitor.labels "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- $labels := include "common.tplvalues.merge" (dict "values" .Values.serviceMonitor.labels .Values.commonLabels "context" .) | fromYaml }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.serviceMonitor.annotations .Values.commonAnnotations "context" .) | fromYaml }} + {{- if $annotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} {{- end }} spec: {{- if .Values.serviceMonitor.jobLabel }} @@ -50,7 +46,7 @@ spec: - {{ include "common.names.namespace" . | quote }} {{- end }} selector: - matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} {{- if .Values.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.serviceMonitor.selector "context" $) | nindent 6 }} {{- end }} diff --git a/charts/helmet/templates/_tls-secrets.yaml b/charts/helmet/templates/_tls-secrets.yaml index 2672407..571bef6 100644 --- a/charts/helmet/templates/_tls-secrets.yaml +++ b/charts/helmet/templates/_tls-secrets.yaml @@ -8,10 +8,7 @@ kind: Secret metadata: name: {{ .name }} namespace: {{ include "common.names.namespace" $ | quote }} - labels: {{- include "common.labels.standard" $ | nindent 4 }} - {{- if $.Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }} {{- if $.Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/charts/helmet/templates/_tls-selfsigned.yaml b/charts/helmet/templates/_tls-selfsigned.yaml index ce7aa32..2e4c588 100644 --- a/charts/helmet/templates/_tls-selfsigned.yaml +++ b/charts/helmet/templates/_tls-selfsigned.yaml @@ -9,10 +9,7 @@ kind: Secret metadata: name: {{ include "common.tplvalues.render" (dict "value" (printf "%s-tls" .Values.ingress.hostname) "context" $) }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/charts/helmet/values.yaml b/charts/helmet/values.yaml index 7609f34..50751c4 100644 --- a/charts/helmet/values.yaml +++ b/charts/helmet/values.yaml @@ -16,7 +16,19 @@ exports: ## - myRegistryKeySecretName ## imagePullSecrets: [] - storageClass: "" + defaultStorageClass: "" + ## Compatibility adaptations for Kubernetes platforms + ## + compatibility: + ## Compatibility adaptations for Openshift + ## + openshift: + ## @param global.compatibility.openshift.adaptSecurityContext Adapt the securityContext sections of the deployment to make them compatible with Openshift restricted-v2 SCC: remove runAsUser, runAsGroup and fsGroup and let the platform use their allowed default IDs. Possible values: auto (apply if the detected running cluster is Openshift), force (perform the adaptation always), disabled (do not perform adaptation) + ## + adaptSecurityContext: auto + ## @param global.compatibility.omitEmptySeLinuxOptions If set to true, removes the seLinuxOptions from the securityContexts when it is set to an empty object + ## + omitEmptySeLinuxOptions: false ## @section Common parameters @@ -607,6 +619,52 @@ exports: ## extraRules: [] + ## Enable persistence using Persistent Volume Claims + ## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/ + ## + persistence: + ## @param persistence.enabled Enable persistence using Persistent Volume Claims + ## + enabled: false + ## @param persistence.mountPath Path to mount the volume at. + ## + mountPath: /data + ## @param persistence.subPath The subdirectory of the volume to mount to, useful in dev environments and one PV for multiple services + ## + subPath: "" + ## @param persistence.storageClass Storage class of backing PVC + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + storageClass: "" + ## @param persistence.annotations Persistent Volume Claim annotations + ## + annotations: {} + ## @param persistence.accessModes Persistent Volume Access Modes + ## + accessModes: + - ReadWriteOnce + ## @param persistence.size Size of data volume + ## + size: 8Gi + ## @param persistence.existingClaim The name of an existing PVC to use for persistence + ## + existingClaim: "" + ## @param persistence.selector Selector to match an existing Persistent Volume for WordPress data PVC + ## If set, the PVC can't have a PV dynamically provisioned for it + ## E.g. + ## selector: + ## matchLabels: + ## app: my-app + ## + selector: {} + ## @param persistence.dataSource Custom PVC data source + ## + dataSource: {} + ## APP service parameters ## service: