mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
feat(common): Release 3.2.0 (#318)
Signed-off-by: Gavin Mogan <git@gavinmogan.com> Co-authored-by: Gavin Mogan <git@gavinmogan.com> Co-authored-by: repo-duster[bot] <87358111+repo-duster[bot]@users.noreply.github.com>
This commit is contained in:
parent
6cbaa61a4f
commit
4a5f448abd
29 changed files with 248 additions and 53 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# common
|
||||
|
||||
 
|
||||
 
|
||||
|
||||
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/
|
||||
```
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"includeInChecksum": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"annotations": {
|
||||
"$ref": "definitions.json#/annotations"
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"includeInChecksum": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"annotations": {
|
||||
"$ref": "definitions.json#/annotations"
|
||||
},
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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) }}
|
||||
|
|
|
@ -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) }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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") }}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }}"
|
||||
|
|
|
@ -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) }}
|
||||
|
|
|
@ -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 -}}
|
||||
|
|
|
@ -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 -}}
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue