From d2d2223f6d385b7160361ace370c11e7382b673a Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Wed, 26 Aug 2020 15:15:00 +0100 Subject: [PATCH] Helm: Fix upgrade bug (#457) * Fix upgrade bug * Fix unit tests --- .../console/templates/deployment.yaml | 17 +++++++++++------ .../console/tests/custom_annotations_test.yaml | 14 ++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/deploy/kubernetes/console/templates/deployment.yaml b/deploy/kubernetes/console/templates/deployment.yaml index 6fd4fd2985..2cd00464d0 100644 --- a/deploy/kubernetes/console/templates/deployment.yaml +++ b/deploy/kubernetes/console/templates/deployment.yaml @@ -4,12 +4,13 @@ apiVersion: apps/v1 {{- else }} apiVersion: apps/v1beta1 {{- end }} -kind: StatefulSet +kind: Deployment metadata: name: stratos -{{- if .Values.console.statefulSetAnnotations }} +{{- if .Values.console.deploymentAnnotations }} annotations: -{{ toYaml .Values.console.statefulSetAnnotations | indent 4 }} + checksum/config: {{ default (randAlphaNum 5 | quote) .Values.console.checksum }} +{{ toYaml .Values.console.deploymentAnnotations | indent 4 }} {{- end }} labels: app.kubernetes.io/name: "stratos" @@ -19,12 +20,16 @@ metadata: helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" app: "{{ .Release.Name }}" component: stratos -{{- if .Values.console.statefulSetExtraLabels }} -{{ toYaml .Values.console.statefulSetExtraLabels | indent 4 }} +{{- if .Values.console.deploymentExtraLabels }} +{{ toYaml .Values.console.deploymentExtraLabels | indent 4 }} {{- end }} spec: - serviceName: stratos replicas: 1 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 selector: matchLabels: app.kubernetes.io/name: "stratos" diff --git a/deploy/kubernetes/console/tests/custom_annotations_test.yaml b/deploy/kubernetes/console/tests/custom_annotations_test.yaml index 39a06a3787..451ffcd8c0 100644 --- a/deploy/kubernetes/console/tests/custom_annotations_test.yaml +++ b/deploy/kubernetes/console/tests/custom_annotations_test.yaml @@ -67,28 +67,30 @@ tests: value: r23453463456 template: database.yaml -# Stateful set +# Stratos Deployment - - it: statefulset should not have annotaions unless configured + - it: stratos deploymentment should not have annotaions unless configured asserts: - isNull: path: metadata.annotations template: deployment.yaml - it: statefulset should support custom annotations set: - console.statefulSetAnnotations: + console.checksum: checksum-test + console.deploymentAnnotations: test-annotation: 172623 test-annotation2: r23453463456 asserts: - equal: path: metadata.annotations value: + checksum/config: checksum-test test-annotation: 172623 test-annotation2: r23453463456 template: deployment.yaml - - it: statefulset should support custom labels + - it: stratos deploymentment should support custom labels set: - console.statefulSetExtraLabels: + console.deploymentExtraLabels: test-label: 172623 test-label2: r23453463456 asserts: @@ -99,7 +101,7 @@ tests: path: metadata.labels.test-label2 value: r23453463456 template: deployment.yaml - - it: statefulset should support custom labels and annotations on its pods + - it: stratos deploymentment should support custom labels and annotations on its pods set: console.podExtraLabels: test-label: 172623