Skip to content

Commit

Permalink
Helm: Fix upgrade bug (#457)
Browse files Browse the repository at this point in the history
* Fix upgrade bug

* Fix unit tests
  • Loading branch information
nwmac authored Aug 26, 2020
1 parent 3502fb5 commit d2d2223
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
17 changes: 11 additions & 6 deletions deploy/kubernetes/console/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
14 changes: 8 additions & 6 deletions deploy/kubernetes/console/tests/custom_annotations_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit d2d2223

Please sign in to comment.