Skip to content

Commit ea12e85

Browse files
Merge pull request #627 from akrzos/wait_to_stable
Add wait until cluster is stable prior to post-cluster-install tasks
2 parents af58f7f + 38d33c1 commit ea12e85

File tree

4 files changed

+21
-34
lines changed

4 files changed

+21
-34
lines changed

ansible/roles/mno-post-cluster-install/defaults/main/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ http_store_port: 8081
1313
registry_host: "{{ groups['bastion'][0] }}"
1414
registry_port: 5000
1515

16+
# Wait until cluster is stable vars
17+
wait_until_cluster_stable: true
18+
minimum_stable_period: 2m
19+
wait_until_cluster_stable_timeout: 20m
20+
1621
# Deploy performance-dashboards
1722
setup_performance_dashboards: false
1823

ansible/roles/mno-post-cluster-install/tasks/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
- name: kubeconfig
2727
dest: kubeconfig.backup
2828

29+
- name: Wait until cluster is stable
30+
shell: |
31+
KUBECONFIG={{ bastion_cluster_config_dir }}/kubeconfig oc adm wait-for-stable-cluster --minimum-stable-period={{ minimum_stable_period }} --timeout={{ wait_until_cluster_stable_timeout }}
32+
when: wait_until_cluster_stable
33+
2934
- name: Apply a label to the worker node(s)
3035
shell: |
3136
KUBECONFIG={{ bastion_cluster_config_dir }}/kubeconfig oc label no --overwrite -l node-role.kubernetes.io/worker jetlag=true

ansible/roles/sno-post-cluster-install/defaults/main/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
assisted_installer_host: "{{ groups['bastion'][0] }}"
66
assisted_installer_port: 8090
77

8+
# Wait until cluster is stable vars
9+
wait_until_cluster_stable: true
10+
minimum_stable_period: 2m
11+
wait_until_cluster_stable_timeout: 20m
12+
813
# Deploy openshift-gitops-operator
914
setup_openshift_gitops: false
1015
gitops_channel: stable

ansible/roles/sno-post-cluster-install/tasks/main.yml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
- name: kubeconfig
2828
dest: kubeconfig.backup
2929

30+
- name: Wait until cluster is stable
31+
shell: |
32+
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc adm wait-for-stable-cluster --minimum-stable-period={{ minimum_stable_period }} --timeout={{ wait_until_cluster_stable_timeout }}
33+
when: wait_until_cluster_stable
34+
3035
- name: Apply a label to the SNO node
3136
shell: |
3237
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc label no --all --overwrite jetlag=true
33-
register: jetlag_label
34-
retries: 120
35-
delay: 2
36-
until: not jetlag_label.failed
3738
3839
- name: Place templated configuration items
3940
template:
@@ -58,68 +59,39 @@
5859
- name: Add kube-burner sa
5960
shell: |
6061
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc create sa kubeburner
61-
register: kubeburner_sa
62-
retries: 120
63-
delay: 2
64-
until: not kubeburner_sa.failed
6562
when: setup_kube_burner_sa | default(true) | bool
6663

6764
- name: Add cluster-admin role to kube-burner sa
6865
shell: |
6966
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc adm policy add-cluster-role-to-user -z kubeburner cluster-admin
70-
register: kubeburner_role
71-
retries: 120
72-
delay: 2
73-
until: not kubeburner_role.failed
7467
when: setup_kube_burner_sa | default(true) | bool
7568

7669
- name: Disable default OperatorHub sources on bastion registry clusters
7770
shell: |
7871
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
79-
register: operator_hub_disable
80-
retries: 120
81-
delay: 2
82-
until: not operator_hub_disable.failed
83-
when:
84-
- use_bastion_registry | default(false)
72+
when: use_bastion_registry | default(false)
8573

8674
- name: Create openshift-marketplace namespace for ocp 4.15 and higher releases DUs
8775
shell: |
8876
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc apply -f {{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/openshift-marketplace-ns.yaml
89-
register: marketplace_ns
90-
retries: 120
91-
delay: 2
92-
until: not marketplace_ns.failed
9377
when:
9478
- use_bastion_registry | default(false)
9579
- openshift_version is version('4.15', ">=")
9680

9781
- name: Apply olm-mirror imageContentSourcePolicy on bastion registry clusters
9882
shell: |
9983
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc apply -f {{ bastion_cluster_config_dir }}/olm-mirror-{{ operator_index_name }}-{{ operator_index_tag }}/imageContentSourcePolicy.yaml
100-
register: icsp_apply
101-
retries: 120
102-
delay: 2
103-
until: not icsp_apply.failed
10484
when: use_bastion_registry | default(false)
10585

10686
# Part of DU Profile (Not completely in du_profile_tasks.yml)
10787
- name: Annotate catalogSource.yaml to pin opm to reserved cores for DUs
10888
shell: |
10989
yq -i '.metadata.annotations."target.workload.openshift.io/management" = "{\"effect\": \"PreferredDuringScheduling\"}"' {{ bastion_cluster_config_dir }}/olm-mirror-{{ operator_index_name }}-{{ operator_index_tag }}/catalogSource.yaml
110-
register: catsource_annotate
111-
retries: 120
112-
delay: 2
113-
until: not catsource_annotate.failed
11490
when: use_bastion_registry | default(false) and du_profile
11591

11692
- name: Apply olm-mirror catalogSource on bastion registry clusters
11793
shell: |
11894
KUBECONFIG={{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig oc apply -f {{ bastion_cluster_config_dir }}/olm-mirror-{{ operator_index_name }}-{{ operator_index_tag }}/catalogSource.yaml
119-
register: catsource_apply
120-
retries: 120
121-
delay: 2
122-
until: not catsource_apply.failed
12395
when: use_bastion_registry | default(false)
12496

12597
- name: Install OpenShift-gitops-operator

0 commit comments

Comments
 (0)