From 9f8e6b65ce6573b51684c5813efea040fd66a3cc Mon Sep 17 00:00:00 2001 From: Rogerio Varalda Date: Tue, 12 Jul 2022 18:06:14 +0200 Subject: [PATCH] Add PodDisruptionBudget for pastebin --- charts/pastebin/Chart.lock | 8 ++++---- charts/pastebin/Chart.yaml | 6 +++--- charts/pastebin/ci/test-values.yaml | 4 ++++ charts/pastebin/templates/job.yaml | 4 ++++ charts/pastebin/templates/pdb.yaml | 25 +++++++++++++++++++++++++ charts/pastebin/values.yaml | 8 +++++++- 6 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 charts/pastebin/templates/pdb.yaml diff --git a/charts/pastebin/Chart.lock b/charts/pastebin/Chart.lock index 5b502f43..d9f46d4c 100644 --- a/charts/pastebin/Chart.lock +++ b/charts/pastebin/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: cert-manager repository: https://charts.jetstack.io - version: v1.4.0 + version: v1.4.4 - name: mysql repository: https://charts.bitnami.com/bitnami - version: 8.7.1 -digest: sha256:e93fb4a8c0549f951fbccaa5ee25474c43f8b59f33f910db6605a0479c52ed1d -generated: "2021-07-09T10:15:14.758143-04:00" + version: 9.2.0 +digest: sha256:0c1b9b9df560cad0b8debd2210c9c365e0df97f49e340a84455d7fc67be5b420 +generated: "2022-07-13T10:11:24.336447+02:00" diff --git a/charts/pastebin/Chart.yaml b/charts/pastebin/Chart.yaml index e56cb42a..0a95d63b 100644 --- a/charts/pastebin/Chart.yaml +++ b/charts/pastebin/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pastebin description: A Helm chart for the Mozilla Pastebin (dpaste) application type: application -version: 0.1.3 +version: 0.1.4 keywords: - Mozilla @@ -19,10 +19,10 @@ maintainers: dependencies: - name: cert-manager - version: v1.4.0 + version: 1.4.4 condition: cert-manager.install repository: https://charts.jetstack.io - name: mysql - version: 8.7.1 + version: 9.2.0 condition: mysql.install repository: https://charts.bitnami.com/bitnami diff --git a/charts/pastebin/ci/test-values.yaml b/charts/pastebin/ci/test-values.yaml index fcf27d09..b07817b2 100644 --- a/charts/pastebin/ci/test-values.yaml +++ b/charts/pastebin/ci/test-values.yaml @@ -14,6 +14,10 @@ configMap: deployment: port: 5000 replicaCount: 1 + resources: + requests: + cpu: 50m + memory: 100Mi imagePullSecrets: - name: ecr-registry diff --git a/charts/pastebin/templates/job.yaml b/charts/pastebin/templates/job.yaml index fd2452dd..0637f95d 100644 --- a/charts/pastebin/templates/job.yaml +++ b/charts/pastebin/templates/job.yaml @@ -1,4 +1,8 @@ +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: batch/v1 +{{- else }} apiVersion: batch/v1beta1 +{{- end }} kind: CronJob metadata: name: {{ .Values.job.name }} diff --git a/charts/pastebin/templates/pdb.yaml b/charts/pastebin/templates/pdb.yaml new file mode 100644 index 00000000..c609bc3a --- /dev/null +++ b/charts/pastebin/templates/pdb.yaml @@ -0,0 +1,25 @@ +{{- if .Values.podDisruptionBudget.enabled }} +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: policy/v1 +{{- else }} +apiVersion: policy/v1beta1 +{{- end }} +kind: PodDisruptionBudget +metadata: + name: {{ .Values.podDisruptionBudget.name }} + labels: + {{- include "pastebin.labels" . | nindent 4 }} + {{- with .Values.podDisruptionBudget.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} +{{- end }} +{{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} +{{- end }} + selector: + matchLabels: + {{- include "pastebin.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/pastebin/values.yaml b/charts/pastebin/values.yaml index 99e47217..0b582de5 100644 --- a/charts/pastebin/values.yaml +++ b/charts/pastebin/values.yaml @@ -52,7 +52,7 @@ externalSecrets: image: pullPolicy: Always repository: 783633885093.dkr.ecr.us-west-2.amazonaws.com/pastebin - tag: v3.5.4 + tag: v3.5.8 imagePullSecrets: [] @@ -99,3 +99,9 @@ mysql: install: false image: tag: 5.7.33 + +podDisruptionBudget: + enabled: true + name: pastebin + labels: {} + minAvailable: 1