From 4a5f448abd181456fbb3979e8d0642adb75dd747 Mon Sep 17 00:00:00 2001 From: Bernd Schorgers Date: Thu, 23 May 2024 11:54:12 +0200 Subject: [PATCH] feat(common): Release 3.2.0 (#318) Signed-off-by: Gavin Mogan Co-authored-by: Gavin Mogan Co-authored-by: repo-duster[bot] <87358111+repo-duster[bot]@users.noreply.github.com> --- .github/workflows/charts-test.yaml | 12 +++--- .../tests/configmap/pod_metadata_test.yaml | 4 ++ .../tests/ingress/metadata_test.yaml | 31 +++++++++++++++ .../tests/networkpolicy/names_test.yaml | 39 +++++++++++++++++++ .../tests/secret/pod_metadata_test.yaml | 4 ++ .../serviceMonitor/servicemonitor_test.yaml | 5 ++- charts/library/common/Chart.yaml | 22 +++++++---- charts/library/common/README.md | 4 +- charts/library/common/schemas/configmap.json | 4 ++ .../library/common/schemas/controllers.json | 6 +++ charts/library/common/schemas/secret.json | 4 ++ .../common/templates/classes/_configmap.tpl | 10 ++++- .../common/templates/classes/_cronjob.tpl | 13 ++++++- .../common/templates/classes/_daemonset.tpl | 10 ++++- .../common/templates/classes/_deployment.tpl | 10 ++++- .../common/templates/classes/_ingress.tpl | 10 ++++- .../library/common/templates/classes/_job.tpl | 13 ++++++- .../templates/classes/_networkpolicy.tpl | 10 ++++- .../library/common/templates/classes/_pvc.tpl | 10 ++++- .../common/templates/classes/_route.tpl | 10 ++++- .../common/templates/classes/_secret.tpl | 10 ++++- .../common/templates/classes/_service.tpl | 10 ++++- .../templates/classes/_serviceAccount.tpl | 10 ++++- .../templates/classes/_serviceMonitor.tpl | 10 ++++- .../common/templates/classes/_statefulset.tpl | 10 ++++- .../_enabled_networkpolicies.tpl | 2 +- .../lib/pod/metadata/_annotations.tpl | 12 +++++- charts/library/common/values.schema.json | 2 +- charts/library/common/values.yaml | 4 +- 29 files changed, 248 insertions(+), 53 deletions(-) diff --git a/.github/workflows/charts-test.yaml b/.github/workflows/charts-test.yaml index 0396c799..70821e46 100644 --- a/.github/workflows/charts-test.yaml +++ b/.github/workflows/charts-test.yaml @@ -31,13 +31,11 @@ jobs: chart: ${{ fromJSON(inputs.chartsToTest) }} k8s_version: [ - "v1.23.17", - "v1.24.17", - "v1.25.16", - "v1.26.13", - "v1.27.10", - "v1.28.6", - "v1.29.1", + "v1.26.15", + "v1.27.13", + "v1.28.9", + "v1.29.4", + "v1.30.0", ] fail-fast: false steps: diff --git a/charts/library/common-test/tests/configmap/pod_metadata_test.yaml b/charts/library/common-test/tests/configmap/pod_metadata_test.yaml index f9a680b3..9cf7a89a 100644 --- a/charts/library/common-test/tests/configmap/pod_metadata_test.yaml +++ b/charts/library/common-test/tests/configmap/pod_metadata_test.yaml @@ -16,6 +16,10 @@ tests: test_default_enabled: data: test: value 1 + test_not_in_checksum: + includeInChecksum: false + data: + test: value 1 test_disabled: enabled: false data: diff --git a/charts/library/common-test/tests/ingress/metadata_test.yaml b/charts/library/common-test/tests/ingress/metadata_test.yaml index 5170dcba..0db936d6 100644 --- a/charts/library/common-test/tests/ingress/metadata_test.yaml +++ b/charts/library/common-test/tests/ingress/metadata_test.yaml @@ -82,3 +82,34 @@ tests: global_label: test helm.sh/chart: common-test-1.0.0 test_label: test + + + - it: custom metadata with templates should pass + set: + ingress.main: + annotations: + template_annotation1: "{{ .Release.Name | lower }}" + template_annotation2: "{{ .Chart.Name | lower }}" + labels: + template_label1: "{{ .Release.Name | lower }}" + template_label2: "{{ .Chart.Name | lower }}" + asserts: + - documentIndex: &IngressDocument 1 + isKind: + of: Ingress + - documentIndex: *IngressDocument + equal: + path: metadata.annotations["template_annotation1"] + value: release-name + - documentIndex: *IngressDocument + equal: + path: metadata.annotations["template_annotation2"] + value: common-test + - documentIndex: *IngressDocument + equal: + path: metadata.labels["template_label1"] + value: release-name + - documentIndex: *IngressDocument + equal: + path: metadata.labels["template_label2"] + value: common-test diff --git a/charts/library/common-test/tests/networkpolicy/names_test.yaml b/charts/library/common-test/tests/networkpolicy/names_test.yaml index 7abe281d..8bea3596 100644 --- a/charts/library/common-test/tests/networkpolicy/names_test.yaml +++ b/charts/library/common-test/tests/networkpolicy/names_test.yaml @@ -44,3 +44,42 @@ tests: equal: path: metadata.name value: RELEASE-NAME-block-ingress + + - it: multiple networkpolicies can be enabled + set: + networkpolicies: + primary: + controller: main + policyTypes: + - Ingress + - Egress + rules: {} + secondary: + controller: main + policyTypes: + - Ingress + - Egress + rules: {} + asserts: + - hasDocuments: + count: 3 + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: &firstNetworkPolicyDocument 1 + isKind: + of: NetworkPolicy + - documentIndex: *firstNetworkPolicyDocument + equal: + path: metadata.name + value: RELEASE-NAME-primary + - documentIndex: 2 + isKind: + of: NetworkPolicy + - documentIndex: &secondNetworkPolicyDocument 2 + isKind: + of: NetworkPolicy + - documentIndex: *secondNetworkPolicyDocument + equal: + path: metadata.name + value: RELEASE-NAME-secondary diff --git a/charts/library/common-test/tests/secret/pod_metadata_test.yaml b/charts/library/common-test/tests/secret/pod_metadata_test.yaml index d5349c35..0d1d52e8 100644 --- a/charts/library/common-test/tests/secret/pod_metadata_test.yaml +++ b/charts/library/common-test/tests/secret/pod_metadata_test.yaml @@ -16,6 +16,10 @@ tests: stringData: test_1: value 1 test_2: value 2 + test_not_in_checksum: + includeInChecksum: false + stringData: + test: value 1 test_disabled: enabled: false stringData: diff --git a/charts/library/common-test/tests/serviceMonitor/servicemonitor_test.yaml b/charts/library/common-test/tests/serviceMonitor/servicemonitor_test.yaml index 9b7f26f7..901b52d7 100644 --- a/charts/library/common-test/tests/serviceMonitor/servicemonitor_test.yaml +++ b/charts/library/common-test/tests/serviceMonitor/servicemonitor_test.yaml @@ -153,7 +153,7 @@ tests: main: selector: matchExpressions: - test: "true" + - {key: k8s-app, operator: Exists} endpoints: - port: http scheme: http @@ -175,7 +175,8 @@ tests: path: spec.selector value: matchExpressions: - test: "true" + - key: k8s-app + operator: Exists - it: a serviceMonitor is created with targetLabels set: diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 87227157..85cbc372 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: common description: Function library for Helm charts type: library -version: 3.1.0 +version: 3.2.0 kubeVersion: ">=1.22.0-0" keywords: - common @@ -14,12 +14,18 @@ maintainers: email: me@bjw-s.dev annotations: artifacthub.io/changes: |- - - kind: fixed - description: |- - Fixed `default` function overriding `0` values - - kind: fixed - description: |- - Fixed missing `volumeName` field in persistence schema - kind: added description: |- - Add jobLabel and namespaceSelector to serviceMonitor + Support templating in annotation and label values for all objects + - kind: added + description: |- + Support activeDeadlineSeconds field on CronJobs and Jobs + - kind: added + description: |- + Support excluding secrets and configMaps from pod checksum annotation + - kind: fixed + description: |- + Fixed failing ServiceMonitor test + - kind: fixed + description: |- + Fixed networkPolicies not rendering correctly diff --git a/charts/library/common/README.md b/charts/library/common/README.md index c7322b5a..6d72872d 100644 --- a/charts/library/common/README.md +++ b/charts/library/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 3.1.0](https://img.shields.io/badge/Version-3.1.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) +![Version: 3.2.0](https://img.shields.io/badge/Version-3.2.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) Function library for Helm charts @@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g. # Chart.yaml dependencies: - name: common - version: 3.1.0 + version: 3.2.0 repository: https://bjw-s.github.io/helm-charts/ ``` diff --git a/charts/library/common/schemas/configmap.json b/charts/library/common/schemas/configmap.json index 15067ffc..830bebe7 100644 --- a/charts/library/common/schemas/configmap.json +++ b/charts/library/common/schemas/configmap.json @@ -7,6 +7,10 @@ "type": "boolean", "default": true }, + "includeInChecksum": { + "type": "boolean", + "default": true + }, "annotations": { "$ref": "definitions.json#/annotations" }, diff --git a/charts/library/common/schemas/controllers.json b/charts/library/common/schemas/controllers.json index 0e3f29e1..b792b8ad 100644 --- a/charts/library/common/schemas/controllers.json +++ b/charts/library/common/schemas/controllers.json @@ -229,6 +229,9 @@ "timeZone": { "type": "string" }, + "activeDeadlineSeconds": { + "type": "integer" + }, "ttlSecondsAfterFinished": { "type": "integer" } @@ -254,6 +257,9 @@ "type": "boolean", "default": false }, + "activeDeadlineSeconds": { + "type": "integer" + }, "ttlSecondsAfterFinished": { "type": "integer" } diff --git a/charts/library/common/schemas/secret.json b/charts/library/common/schemas/secret.json index 4dcefaeb..37794cac 100644 --- a/charts/library/common/schemas/secret.json +++ b/charts/library/common/schemas/secret.json @@ -7,6 +7,10 @@ "type": "boolean", "default": true }, + "includeInChecksum": { + "type": "boolean", + "default": true + }, "annotations": { "$ref": "definitions.json#/annotations" }, diff --git a/charts/library/common/templates/classes/_configmap.tpl b/charts/library/common/templates/classes/_configmap.tpl index 3aa492e6..58c07851 100644 --- a/charts/library/common/templates/classes/_configmap.tpl +++ b/charts/library/common/templates/classes/_configmap.tpl @@ -20,10 +20,16 @@ kind: ConfigMap metadata: name: {{ $configMapObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} data: {{- with $configMapObject.data }} diff --git a/charts/library/common/templates/classes/_cronjob.tpl b/charts/library/common/templates/classes/_cronjob.tpl index 110838c8..7df4b60d 100644 --- a/charts/library/common/templates/classes/_cronjob.tpl +++ b/charts/library/common/templates/classes/_cronjob.tpl @@ -28,10 +28,16 @@ kind: CronJob metadata: name: {{ $cronjobObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: suspend: {{ default false $cronJobSettings.suspend }} @@ -45,6 +51,9 @@ spec: failedJobsHistoryLimit: {{ include "bjw-s.common.lib.defaultKeepNonNullValue" (dict "value" $cronJobSettings.failedJobsHistory "default" 1) }} jobTemplate: spec: + {{- with $cronJobSettings.activeDeadlineSeconds }} + activeDeadlineSeconds: {{ . }} + {{- end }} {{- with $cronJobSettings.ttlSecondsAfterFinished }} ttlSecondsAfterFinished: {{ . }} {{- end }} diff --git a/charts/library/common/templates/classes/_daemonset.tpl b/charts/library/common/templates/classes/_daemonset.tpl index a53823a7..60269aee 100644 --- a/charts/library/common/templates/classes/_daemonset.tpl +++ b/charts/library/common/templates/classes/_daemonset.tpl @@ -21,10 +21,16 @@ kind: DaemonSet metadata: name: {{ $daemonsetObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: revisionHistoryLimit: {{ include "bjw-s.common.lib.defaultKeepNonNullValue" (dict "value" $daemonsetObject.revisionHistoryLimit "default" 3) }} diff --git a/charts/library/common/templates/classes/_deployment.tpl b/charts/library/common/templates/classes/_deployment.tpl index cd8109ea..f618fd4f 100644 --- a/charts/library/common/templates/classes/_deployment.tpl +++ b/charts/library/common/templates/classes/_deployment.tpl @@ -21,10 +21,16 @@ kind: Deployment metadata: name: {{ $deploymentObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: revisionHistoryLimit: {{ include "bjw-s.common.lib.defaultKeepNonNullValue" (dict "value" $deploymentObject.revisionHistoryLimit "default" 3) }} diff --git a/charts/library/common/templates/classes/_ingress.tpl b/charts/library/common/templates/classes/_ingress.tpl index 797c4858..73c6a84d 100644 --- a/charts/library/common/templates/classes/_ingress.tpl +++ b/charts/library/common/templates/classes/_ingress.tpl @@ -21,10 +21,16 @@ kind: Ingress metadata: name: {{ $ingressObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: {{- if $ingressObject.className }} diff --git a/charts/library/common/templates/classes/_job.tpl b/charts/library/common/templates/classes/_job.tpl index 99cc1d2d..fd22a13c 100644 --- a/charts/library/common/templates/classes/_job.tpl +++ b/charts/library/common/templates/classes/_job.tpl @@ -23,13 +23,22 @@ kind: Job metadata: name: {{ $jobObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: suspend: {{ default false $jobSettings.suspend }} + {{- with $jobSettings.activeDeadlineSeconds }} + activeDeadlineSeconds: {{ . }} + {{- end }} {{- with $jobSettings.ttlSecondsAfterFinished }} ttlSecondsAfterFinished: {{ . }} {{- end }} diff --git a/charts/library/common/templates/classes/_networkpolicy.tpl b/charts/library/common/templates/classes/_networkpolicy.tpl index 0854d145..0f68bd08 100644 --- a/charts/library/common/templates/classes/_networkpolicy.tpl +++ b/charts/library/common/templates/classes/_networkpolicy.tpl @@ -30,10 +30,16 @@ kind: NetworkPolicy metadata: name: {{ $networkPolicyObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: podSelector: {{- toYaml $podSelector | nindent 4 }} diff --git a/charts/library/common/templates/classes/_pvc.tpl b/charts/library/common/templates/classes/_pvc.tpl index 1c6ee9c1..b8c6d2ef 100644 --- a/charts/library/common/templates/classes/_pvc.tpl +++ b/charts/library/common/templates/classes/_pvc.tpl @@ -27,10 +27,16 @@ apiVersion: v1 metadata: name: {{ $pvcObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: accessModes: diff --git a/charts/library/common/templates/classes/_route.tpl b/charts/library/common/templates/classes/_route.tpl index 9c07fa7c..bc7b3bbc 100644 --- a/charts/library/common/templates/classes/_route.tpl +++ b/charts/library/common/templates/classes/_route.tpl @@ -28,10 +28,16 @@ kind: {{ $routeKind }} metadata: name: {{ $routeObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: parentRefs: diff --git a/charts/library/common/templates/classes/_secret.tpl b/charts/library/common/templates/classes/_secret.tpl index a46fe534..4dffb7e3 100644 --- a/charts/library/common/templates/classes/_secret.tpl +++ b/charts/library/common/templates/classes/_secret.tpl @@ -28,10 +28,16 @@ type: {{ . }} metadata: name: {{ $secretObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $stringData }} stringData: {{- tpl $stringData $rootContext | nindent 2 }} diff --git a/charts/library/common/templates/classes/_service.tpl b/charts/library/common/templates/classes/_service.tpl index 35aa24f5..74576831 100644 --- a/charts/library/common/templates/classes/_service.tpl +++ b/charts/library/common/templates/classes/_service.tpl @@ -23,10 +23,16 @@ kind: Service metadata: name: {{ $serviceObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: {{- if (eq $svcType "ClusterIP") }} diff --git a/charts/library/common/templates/classes/_serviceAccount.tpl b/charts/library/common/templates/classes/_serviceAccount.tpl index 2b109ad0..dfaf9b33 100644 --- a/charts/library/common/templates/classes/_serviceAccount.tpl +++ b/charts/library/common/templates/classes/_serviceAccount.tpl @@ -20,10 +20,16 @@ kind: ServiceAccount metadata: name: {{ $serviceAccountObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} secrets: - name: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}-sa-token diff --git a/charts/library/common/templates/classes/_serviceMonitor.tpl b/charts/library/common/templates/classes/_serviceMonitor.tpl index dc3b9e85..53467423 100644 --- a/charts/library/common/templates/classes/_serviceMonitor.tpl +++ b/charts/library/common/templates/classes/_serviceMonitor.tpl @@ -15,10 +15,16 @@ kind: ServiceMonitor metadata: name: {{ $serviceMonitorObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: jobLabel: "{{ $serviceMonitorObject.name }}" diff --git a/charts/library/common/templates/classes/_statefulset.tpl b/charts/library/common/templates/classes/_statefulset.tpl index 0b7cdcc3..6ac1a538 100644 --- a/charts/library/common/templates/classes/_statefulset.tpl +++ b/charts/library/common/templates/classes/_statefulset.tpl @@ -21,10 +21,16 @@ kind: StatefulSet metadata: name: {{ $statefulsetObject.name }} {{- with $labels }} - labels: {{- toYaml . | nindent 4 -}} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} {{- with $annotations }} - annotations: {{- toYaml . | nindent 4 -}} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $rootContext }} + {{- end }} {{- end }} spec: revisionHistoryLimit: {{ include "bjw-s.common.lib.defaultKeepNonNullValue" (dict "value" $statefulsetObject.revisionHistoryLimit "default" 3) }} diff --git a/charts/library/common/templates/lib/networkpolicy/_enabled_networkpolicies.tpl b/charts/library/common/templates/lib/networkpolicy/_enabled_networkpolicies.tpl index 2e81f432..74f40f43 100644 --- a/charts/library/common/templates/lib/networkpolicy/_enabled_networkpolicies.tpl +++ b/charts/library/common/templates/lib/networkpolicy/_enabled_networkpolicies.tpl @@ -5,7 +5,7 @@ Return the enabled NetworkPolicies. {{- $rootContext := .rootContext -}} {{- $enabledNetworkPolicies := dict -}} - {{- range $name, $networkPolicy := $rootContext.Values.networkPolicy -}} + {{- range $name, $networkPolicy := $rootContext.Values.networkpolicies -}} {{- if kindIs "map" $networkPolicy -}} {{- /* Enable by default, but allow override */ -}} {{- $networkPolicyEnabled := true -}} diff --git a/charts/library/common/templates/lib/pod/metadata/_annotations.tpl b/charts/library/common/templates/lib/pod/metadata/_annotations.tpl index a8edb7a3..1f0a8def 100644 --- a/charts/library/common/templates/lib/pod/metadata/_annotations.tpl +++ b/charts/library/common/templates/lib/pod/metadata/_annotations.tpl @@ -29,7 +29,11 @@ Returns the value for annotations {{- if hasKey $configmap "enabled" -}} {{- $configMapEnabled = $configmap.enabled -}} {{- end -}} - {{- if $configMapEnabled -}} + {{- $configMapIncludeInChecksum := true -}} + {{- if hasKey $configmap "includeInChecksum" -}} + {{- $configMapIncludeInChecksum = $configmap.includeInChecksum -}} + {{- end -}} + {{- if and $configMapEnabled $configMapIncludeInChecksum -}} {{- $_ := set $configMapsFound $name (toYaml $configmap.data | sha256sum) -}} {{- end -}} {{- end -}} @@ -47,7 +51,11 @@ Returns the value for annotations {{- if hasKey $secret "enabled" -}} {{- $secretEnabled = $secret.enabled -}} {{- end -}} - {{- if $secretEnabled -}} + {{- $secretIncludeInChecksum := true -}} + {{- if hasKey $secret "includeInChecksum" -}} + {{- $secretIncludeInChecksum = $secret.includeInChecksum -}} + {{- end -}} + {{- if and $secretEnabled $secretIncludeInChecksum -}} {{- $_ := set $secretsFound $name (toYaml $secret.stringData | sha256sum) -}} {{- end -}} {{- end -}} diff --git a/charts/library/common/values.schema.json b/charts/library/common/values.schema.json index e9d7fadb..4ea561e6 100644 --- a/charts/library/common/values.schema.json +++ b/charts/library/common/values.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema", - "$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.1.0/charts/library/common/values.schema.json", + "$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.2.0/charts/library/common/values.schema.json", "type": "object", "properties": { diff --git a/charts/library/common/values.yaml b/charts/library/common/values.yaml index a4e49c35..e5d6ac11 100644 --- a/charts/library/common/values.yaml +++ b/charts/library/common/values.yaml @@ -496,10 +496,10 @@ ingress: # # -- Override the name suffix that is used for this ingress. # nameOverride: - # # -- Provide additional annotations which may be required. + # # -- Provide additional annotations which may be required. Helm templates can be used. # annotations: {} - # # -- Provide additional labels which may be required. + # # -- Provide additional labels which may be required. Helm templates can be used. # labels: {} # # -- Set the ingressClass that is used for this ingress.