-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1492 from epiphany-platform/hotfix/rabbitmq-resta…
…rt-pods Workaround restart rabbitmq pods during patching #1395
- Loading branch information
Showing
1 changed file
with
29 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 29 additions & 2 deletions
31
...data/common/ansible/playbooks/roles/upgrade/tasks/kubernetes/reconfigure-rabbitmq-app.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
--- | ||
- name: k8s/master | Patch rabbitmq's statefulset | ||
include_tasks: utils/patch-statefulset.yml | ||
vars: | ||
image_regexp: 'rabbitmq:.*' | ||
- name: Delete rabbitmq pods after patching | ||
block: | ||
- name: after-patching | Get rabbitmq namespace | ||
environment: | ||
KUBECONFIG: &KUBECONFIG /etc/kubernetes/admin.conf | ||
shell: |- | ||
kubectl get statefulsets.apps --all-namespaces -o=jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.spec.template.spec.containers[].image}{"\n"}{end}'| | ||
awk '/rabbitmq/ {print $1}' | ||
changed_when: false | ||
register: rabbit_mq_namespace | ||
args: | ||
executable: /bin/bash | ||
- name: after-patching | Get rabbitmq pod names | ||
environment: | ||
KUBECONFIG: *KUBECONFIG | ||
command: kubectl get pod -n {{ rabbit_mq_namespace.stdout }} -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}' | ||
changed_when: false | ||
register: rabbit_mq_pod_names | ||
when: | ||
- not rabbit_mq_namespace.stdout == "" | ||
- name: after-patching | Delete rabbitmq pods | ||
environment: | ||
KUBECONFIG: *KUBECONFIG | ||
command: kubectl delete pod --namespace {{ rabbit_mq_namespace.stdout }} {{ item }} | ||
changed_when: false | ||
loop: "{{ rabbit_mq_pod_names.stdout_lines }}" | ||
when: | ||
- not rabbit_mq_namespace.stdout == "" | ||
- not rabbit_mq_pod_names.stdout == "" |