diff --git a/charts/wiki/Chart.yaml b/charts/wiki/Chart.yaml index 8938d76e1..3e9c05e42 100644 --- a/charts/wiki/Chart.yaml +++ b/charts/wiki/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.7 description: A Helm chart for wiki static content name: wiki type: application -version: 0.3.99 +version: 0.4.0 diff --git a/charts/wiki/templates/pdb.yaml b/charts/wiki/templates/pdb.yaml new file mode 100644 index 000000000..81398dd4d --- /dev/null +++ b/charts/wiki/templates/pdb.yaml @@ -0,0 +1,18 @@ +{{- if .Values.poddisruptionbudget.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "wiki.fullname" . }} + labels: + {{- include "wiki.labels" . | nindent 4 }} +spec: + {{- with .Values.poddisruptionbudget.minAvailable }} + minAvailable: {{ . }} + {{- end }} + {{- with .Values.poddisruptionbudget.maxUnavailable }} + maxUnavailable: {{ . }} + {{- end }} + selector: + matchLabels: + app: {{ include "wiki.fullname" . }} +{{- end }} diff --git a/charts/wiki/templates/tests/test-connection.yaml b/charts/wiki/templates/tests/test-connection.yaml deleted file mode 100644 index c0d06cbc6..000000000 --- a/charts/wiki/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "wiki.fullname" . }}-test-connection" - labels: - {{- include "wiki.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "wiki.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/charts/wiki/tests/custom_values_test.yaml b/charts/wiki/tests/custom_values_test.yaml new file mode 100644 index 000000000..d21bd2417 --- /dev/null +++ b/charts/wiki/tests/custom_values_test.yaml @@ -0,0 +1,18 @@ +suite: Tests with custom values +templates: + - pdb.yaml +tests: + - it: should ensure the pdb has correct spec + set: + poddisruptionbudget.enabled: true + poddisruptionbudget.minAvailable: 2 + poddisruptionbudget.maxUnavailable: 1 + asserts: + - isKind: + of: PodDisruptionBudget + - equal: + path: spec.minAvailable + value: 2 + - equal: + path: spec.selector.matchLabels.app + value: "RELEASE-NAME-wiki" diff --git a/charts/wiki/tests/defaults_test.yaml b/charts/wiki/tests/defaults_test.yaml new file mode 100644 index 000000000..8b8f74624 --- /dev/null +++ b/charts/wiki/tests/defaults_test.yaml @@ -0,0 +1,9 @@ +suite: default tests +templates: + - pdb.yaml +tests: + - it: should not generate any pdb with default values + template: pdb.yaml + asserts: + - hasDocuments: + count: 0 diff --git a/charts/wiki/values.yaml b/charts/wiki/values.yaml index 5a1510cea..4d2c52592 100644 --- a/charts/wiki/values.yaml +++ b/charts/wiki/values.yaml @@ -66,3 +66,7 @@ autoscaling: nodeSelector: {} tolerations: [] affinity: {} +poddisruptionbudget: + enabled: false + minAvailable: 1 + maxUnavailable: 1