Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-upgrade health checks (#98) #106

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions playbooks/roles/ocp-upgrade/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
---

- name: Fetch cluster operators details
shell: "oc get co"
register: oplog
until: "'AVAILABLE' in oplog.stdout"
retries: 3
delay: 3

- name: Process cluster operators details
shell: |
echo "{{ oplog.stdout }}" | awk '/PROGRESSING/,EOF {print $4}' | grep 'True' | wc -l
echo "{{ oplog.stdout }}" | awk '/DEGRADED/,EOF {print $5}' | grep 'True' | wc -l
register: opcount

- name: Fail upgrade process incase cluster state is unhealthy
fail:
msg: The current cluster state is unhealthy, upgrading it is not recommended. Please run 'oc get co' command for more details or try upgrade after sometime.
when: opcount.stdout_lines[0]|int > 0 or opcount.stdout_lines[1]|int > 0

- name: Upgrade ocp to a stable version
block:
- name: Set upgrade channel
Expand Down