Skip to content

Commit

Permalink
Merge pull request #4339 from cloudfoundry/helm-recreate-pods
Browse files Browse the repository at this point in the history
Helm: Remove need for --recreate-pods when upgrading
  • Loading branch information
richard-cox authored Jun 2, 2020
2 parents 0741ba6 + 799124c commit 5a76775
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions deploy/ci/automation/helmtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ CHART_FILE="${KUBE_FOLDER}/console-${DEV_IMAGE_VERSION}.tgz"
echo "Chart file path: ${CHART_FILE}"

log "Upgrading using latest Helm Chart"
helm upgrade ${NAME} "${CHART_FILE}" --recreate-pods --debug --set consoleVersion=${DEV_IMAGE_VERSION} --set imagePullPolicy=Always
helm upgrade ${NAME} "${CHART_FILE}" --debug --set consoleVersion=${DEV_IMAGE_VERSION} --set imagePullPolicy=Always

checkVersion console-${DEV_IMAGE_VERSION}
waitForHelmRelease
Expand All @@ -177,7 +177,7 @@ sed -i.bak -e 's/appVersion: '"${DEV_IMAGE_VERSION}"'/appVersion: 0.2.0/g' "${HE
cat "${HELM_TMP}/Chart.yaml"

log "Upgrading using latest Helm Chart (checking chart upgrade)"
helm upgrade ${NAME} "${HELM_TMP}" --recreate-pods --debug --set imagePullPolicy=Always
helm upgrade ${NAME} "${HELM_TMP}" --debug --set imagePullPolicy=Always

waitForHelmRelease
checkVersion console-0.2.0
Expand All @@ -204,7 +204,7 @@ helm install ${HELM_REPO_NAME}/console --name ${NAME} --namespace ${NAMESPACE}
waitForHelmRelease

log "Upgrading using --reuse-values"
helm upgrade ${NAME} "${HELM_TMP}" --recreate-pods --debug --reuse-values
helm upgrade ${NAME} "${HELM_TMP}" --debug --reuse-values

waitForHelmRelease
# Should have used same values as before
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ $ helm repo update
To update an instance, the following assumes your instance is called `my-console`, and overrides have been specified in a file called `overrides.yaml`.

```
$ helm upgrade -f overrides.yaml my-console stratos/console --recreate-pods
$ helm upgrade -f overrides.yaml my-console stratos/console
```

After the upgrade, perform a `helm list` to ensure your console is the latest version.
Expand Down
1 change: 1 addition & 0 deletions deploy/kubernetes/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pushd "${DEST_HELM_CHART_PATH}" > /dev/null
rm -rf "${DEST_HELM_CHART_PATH}/**/*.orig"

# Run customization script if there is one
# This can do things like provide a custom __stratos.tpl file
if [ -f "${STRATOS_PATH}/custom-src/deploy/kubernetes/customize-helm.sh" ]; then
printf "${YELLOW}${BOLD}Applying Helm Chart customizations${RESET}\n"
"${STRATOS_PATH}/custom-src/deploy/kubernetes/customize-helm.sh" "${DEST_HELM_CHART_PATH}"
Expand Down
4 changes: 1 addition & 3 deletions deploy/kubernetes/console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,9 @@ helm repo update
To update an instance, the following assumes your instance is called `my-console`:

```
helm upgrade my-console stratos/console --recreate-pods
helm upgrade my-console stratos/console
```

> Note: You *must* use the `--recreate-pods` flag when upgrading
After the upgrade, perform a `helm list` to ensure your console is the latest version.

## Uninstalling
Expand Down
5 changes: 5 additions & 0 deletions deploy/kubernetes/console/templates/__stratos.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Customizations for the Helm Chart

# Extra env vars for the Jetstream Pod in deployment.yaml
{{- define "stratosJetstreamEnv" }}
{{- end }}
2 changes: 2 additions & 0 deletions deploy/kubernetes/console/templates/config-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ spec:
{{- end }}
containers:
- env:
- name: STRATOS_IMAGE_REF
value: "{{.Values.consoleVersion}}:{{ .Release.Revision }}"
- name: "STRATOS_VOLUME_MIGRATION"
value: "true"
- name: "IS_UPGRADE"
Expand Down
2 changes: 2 additions & 0 deletions deploy/kubernetes/console/templates/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ spec:
image: {{.Values.kube.registry.hostname}}/{{.Values.kube.organization}}/{{.Values.images.mariadb}}:{{.Values.consoleVersion}}
imagePullPolicy: {{.Values.imagePullPolicy}}
env:
- name: STRATOS_IMAGE_REF
value: "{{.Values.consoleVersion}}:{{ .Release.Revision }}"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
5 changes: 5 additions & 0 deletions deploy/kubernetes/console/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ spec:
name: https
protocol: TCP
env:
- name: STRATOS_IMAGE_REF
value: "{{.Values.consoleVersion}}:{{ .Release.Revision }}"
- name: CONSOLE_CERT_PATH
value: "/{{ .Release.Name }}-cert-volume"
volumeMounts:
Expand All @@ -75,6 +77,8 @@ spec:
imagePullPolicy: {{.Values.imagePullPolicy}}
name: proxy
env:
- name: STRATOS_IMAGE_REF
value: "{{.Values.consoleVersion}}:{{ .Release.Revision }}"
- name: STRATOS_HELM_RELEASE
value: "{{ .Release.Name }}"
- name: DB_USER
Expand Down Expand Up @@ -277,6 +281,7 @@ spec:
- name: UI_LIST_ALLOW_LOAD_MAXED
value: {{ default "false" .Values.console.ui.listAllowLoadMaxed | quote }}
{{- end }}
{{- include "stratosJetstreamEnv" . | indent 8 }}
readinessProbe:
httpGet:
path: /pp/v1/ping
Expand Down

0 comments on commit 5a76775

Please sign in to comment.