From e54addcc77068906c401a098528427e8cc154f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Sch=C3=B6rgers?= Date: Wed, 11 Nov 2020 22:09:17 +0100 Subject: [PATCH] [common] Allow setting strategy and replicas (#142) --- charts/common/Chart.yaml | 2 +- charts/common/templates/_deployment.tpl | 16 ++++++++++------ charts/common/templates/_statefulset.tpl | 6 +++++- charts/common/values.yaml | 6 ++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index e837d709..5aa2949a 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: common description: Function library for k8s-at-home charts type: library -version: 1.2.0 +version: 1.3.0 keywords: - k8s-at-home - common diff --git a/charts/common/templates/_deployment.tpl b/charts/common/templates/_deployment.tpl index 25b138da..f973cac7 100644 --- a/charts/common/templates/_deployment.tpl +++ b/charts/common/templates/_deployment.tpl @@ -4,16 +4,20 @@ kind: Deployment metadata: name: {{ template "common.names.fullname" . }} labels: - {{- include "common.labels" . | nindent 4 }} - {{- with .Values.controllerLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} + {{- include "common.labels" . | nindent 4 }} + {{- with .Values.controllerLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- with .Values.controllerAnnotations }} annotations: - {{- toYaml . | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: - replicas: 1 + replicas: {{ .Values.replicas }} + {{- with .Values.strategy }} + strategy: + {{- toYaml . | nindent 4 }} + {{- end }} selector: matchLabels: {{- include "common.labels.selectorLabels" . | nindent 6 }} diff --git a/charts/common/templates/_statefulset.tpl b/charts/common/templates/_statefulset.tpl index cb0f5e8c..e4348bc2 100644 --- a/charts/common/templates/_statefulset.tpl +++ b/charts/common/templates/_statefulset.tpl @@ -13,7 +13,11 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - replicas: 1 + replicas: {{ .Values.replicas }} + {{- with .Values.strategy }} + updateStrategy: + {{- toYaml . | nindent 4 }} + {{- end }} selector: matchLabels: {{- include "common.labels.selectorLabels" . | nindent 6 }} diff --git a/charts/common/values.yaml b/charts/common/values.yaml index 3dc6fb83..2a7666ff 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -5,6 +5,12 @@ controllerAnnotations: {} # Set labels on the deployment/statefulset controllerLabels: {} +replicas: 1 +strategy: + ## For Deployments, valid values are Recreate and RollingUpdate + ## For StatefulSets, valid values are OnDelete and RollingUpdate + type: RollingUpdate + # Set annotations on the pod podAnnotations: {}