mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-09 11:47:47 +03:00
Test group membership with group_names
Testing for group membership with group names makes Kubespray more tolerant towards the structure of the inventory. Where 'inventory_hostname in groups["some_group"] would fail if "some_group" is not defined, '"some_group" in group_names' would not.
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh get node {{ inventory_hostname }}"
|
||||
register: output_get_node
|
||||
when:
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
- ('k8s_cluster' in group_names)
|
||||
- local_as is defined
|
||||
- groups['calico_rr'] | default([]) | length == 0
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
@@ -50,7 +50,7 @@
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
when:
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
- ('k8s_cluster' in group_names)
|
||||
- local_as is defined
|
||||
- groups['calico_rr'] | default([]) | length == 0
|
||||
- output_get_node.rc == 0
|
||||
@@ -77,7 +77,7 @@
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
when:
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
- ('k8s_cluster' in group_names)
|
||||
- local_as is defined
|
||||
- groups['calico_rr'] | default([]) | length == 0
|
||||
- output_get_node.rc != 0
|
||||
@@ -110,4 +110,4 @@
|
||||
- "{{ peers | default([]) | selectattr('scope', 'undefined') | list | union(peers | default([]) | selectattr('scope', 'defined') | selectattr('scope', 'equalto', 'node') | list ) }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when:
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
- ('k8s_cluster' in group_names)
|
||||
|
||||
Reference in New Issue
Block a user