mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-20 04:30:10 -03:30
Rename ansible groups to use _ instead of - (#7552)
* rename ansible groups to use _ instead of -
k8s-cluster -> k8s_cluster
k8s-node -> k8s_node
calico-rr -> calico_rr
no-floating -> no_floating
Note: kube-node,k8s-cluster groups in upgrade CI
need clean-up after v2.16 is tagged
* ensure old groups are mapped to the new ones
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
nodeToNodeMeshEnabled: "false"
|
||||
when:
|
||||
- peer_with_router|default(false) or peer_with_calico_rr|default(false)
|
||||
- inventory_hostname in groups['k8s-cluster']
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
run_once: yes
|
||||
|
||||
- name: Calico | Set up BGP Configuration
|
||||
@@ -264,7 +264,7 @@
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
with_items:
|
||||
- "{{ groups['calico-rr'] | default([]) }}"
|
||||
- "{{ groups['calico_rr'] | default([]) }}"
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- peer_with_calico_rr|default(false)
|
||||
@@ -290,7 +290,7 @@
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
with_items:
|
||||
- "{{ groups['calico-rr'] | default([]) }}"
|
||||
- "{{ groups['calico_rr'] | default([]) }}"
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- peer_with_calico_rr|default(false)
|
||||
@@ -368,9 +368,9 @@
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
when:
|
||||
- peer_with_router|default(false)
|
||||
- inventory_hostname in groups['k8s-cluster']
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
- local_as is defined
|
||||
- groups['calico-rr'] | default([]) | length == 0
|
||||
- groups['calico_rr'] | default([]) | length == 0
|
||||
|
||||
- name: Calico | Configure peering with router(s) at node scope
|
||||
command:
|
||||
@@ -396,4 +396,4 @@
|
||||
- "{{ peers|selectattr('scope','undefined')|list|default([]) | union(peers|selectattr('scope','defined')|selectattr('scope','equalto', 'node')|list|default([])) }}"
|
||||
when:
|
||||
- peer_with_router|default(false)
|
||||
- inventory_hostname in groups['k8s-cluster']
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
|
||||
@@ -22,6 +22,6 @@ data:
|
||||
cluster_type: "kubespray,bgp"
|
||||
calico_backend: "bird"
|
||||
{% endif %}
|
||||
{% if inventory_hostname in groups['k8s-cluster'] and peer_with_router|default(false) %}
|
||||
{% if inventory_hostname in groups['k8s_cluster'] and peer_with_router|default(false) %}
|
||||
as: "{{ local_as|default(global_as_num) }}"
|
||||
{% endif -%}
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kube_router_annotations_master is defined and inventory_hostname in groups['kube_control_plane']
|
||||
|
||||
- name: kube-router | Add annotations on kube-node
|
||||
- name: kube-router | Add annotations on kube_node
|
||||
command: "{{ bin_dir }}/kubectl annotate --overwrite node {{ ansible_hostname }} {{ item }}"
|
||||
with_items:
|
||||
- "{{ kube_router_annotations_node }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kube_router_annotations_node is defined and inventory_hostname in groups['kube-node']
|
||||
when: kube_router_annotations_node is defined and inventory_hostname in groups['kube_node']
|
||||
|
||||
- name: kube-router | Add common annotations on all servers
|
||||
command: "{{ bin_dir }}/kubectl annotate --overwrite node {{ ansible_hostname }} {{ item }}"
|
||||
with_items:
|
||||
- "{{ kube_router_annotations_all }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kube_router_annotations_all is defined and inventory_hostname in groups['k8s-cluster']
|
||||
when: kube_router_annotations_all is defined and inventory_hostname in groups['k8s_cluster']
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% for host in groups['kube-node'] %}
|
||||
{% for host in groups['kube_node'] %}
|
||||
{% if hostvars[host]['access_ip'] is defined %}
|
||||
{% if hostvars[host]['node_pod_cidr'] != node_pod_cidr %}
|
||||
{{ hostvars[host]['node_pod_cidr'] }} via {{ hostvars[host]['access_ip'] }}
|
||||
|
||||
@@ -4,7 +4,7 @@ Name=mac0
|
||||
[Network]
|
||||
Address={{ node_pod_cidr|ipaddr('net')|ipaddr(1)|ipaddr('address') }}/{{ node_pod_cidr|ipaddr('prefix') }}
|
||||
|
||||
{% for host in groups['kube-node'] %}
|
||||
{% for host in groups['kube_node'] %}
|
||||
{% if hostvars[host]['access_ip'] is defined %}
|
||||
{% if hostvars[host]['node_pod_cidr'] != node_pod_cidr %}
|
||||
[Route]
|
||||
|
||||
@@ -5,7 +5,7 @@ iface mac0 inet static
|
||||
netmask {{ node_pod_cidr|ipaddr('netmask') }}
|
||||
broadcast {{ node_pod_cidr|ipaddr('broadcast') }}
|
||||
pre-up ip link add link {{ macvlan_interface }} mac0 type macvlan mode bridge
|
||||
{% for host in groups['kube-node'] %}
|
||||
{% for host in groups['kube_node'] %}
|
||||
{% if hostvars[host]['access_ip'] is defined %}
|
||||
{% if hostvars[host]['node_pod_cidr'] != node_pod_cidr %}
|
||||
post-up ip route add {{ hostvars[host]['node_pod_cidr'] }} via {{ hostvars[host]['access_ip'] }}
|
||||
@@ -15,7 +15,7 @@ iface mac0 inet static
|
||||
{% if enable_nat_default_gateway %}
|
||||
post-up iptables -t nat -I POSTROUTING -s {{ node_pod_cidr|ipaddr('net') }} -o {{ node_default_gateway_interface }} -j MASQUERADE
|
||||
{% endif %}
|
||||
{% for host in groups['kube-node'] %}
|
||||
{% for host in groups['kube_node'] %}
|
||||
{% if hostvars[host]['access_ip'] is defined %}
|
||||
{% if hostvars[host]['node_pod_cidr'] != node_pod_cidr %}
|
||||
post-down ip route del {{ hostvars[host]['node_pod_cidr'] }} via {{ hostvars[host]['access_ip'] }}
|
||||
|
||||
Reference in New Issue
Block a user