feat(install): wait for cluster to be ready before continuing

!4
This commit is contained in:
2023-10-31 15:42:07 +09:30
parent abc01ce48c
commit 76e48fd965
2 changed files with 24 additions and 1 deletions

View File

@ -46,10 +46,12 @@ The roles workflow is as follows
1. Create required config files needed for installation
1. _(kubernetes prime only)_ Add install required config files
1. _(kubernetes prime master only)_ Add install required config files
1. Install kubernetes
1. _(kubernetes prime master only)_ Wait for kubernetes to be ready. Playbook is paused until `true`
1. Configure Kubernetes
If the playbook is setup as per [our recommendation](ansible.md) step 2 onwards is first done on master nodes then worker nodes.

View File

@ -7,6 +7,7 @@
aptInstall:
- name: curl
- name: iptables
- name: jq
- name: Create Required directories
@ -183,6 +184,26 @@
and
not Kubernetes_Master | default(false) | bool
- name: Wait for kubernets to be ready
ansible.builtin.shell:
cmd: |
set -o pipefail
if [ `which jq` ]; then echo $(kubectl get no $(hostname) -o json | jq .status.conditions[4].status | tr -d '"'); else echo jq command not found; exit 127; fi
executable: /bin/bash
register: kubernetes_ready_check
retries: 30
delay: 10
until: >
kubernetes_ready_check.stdout | default(false) | bool
or
kubernetes_ready_check.rc != 0
changed_when: false
failed_when: kubernetes_ready_check.rc != 0
when: >
kubernetes_config.cluster.prime.name == inventory_hostname
- name: Set Kubernetes Final Install Fact
ansible.builtin.set_fact:
kubernetes_installed: true