2018-08-23 14:17:18 +00:00
|
|
|
---
|
2019-04-15 11:24:04 +00:00
|
|
|
- name: Calico | Copy calicoctl binary from download dir
|
|
|
|
copy:
|
|
|
|
src: "{{ local_release_dir }}/calicoctl"
|
|
|
|
dest: "{{ bin_dir }}/calicoctl"
|
|
|
|
mode: 0755
|
|
|
|
remote_src: yes
|
|
|
|
|
2018-08-23 14:17:18 +00:00
|
|
|
- name: Calico | Write Calico cni config
|
|
|
|
template:
|
|
|
|
src: "cni-calico.conflist.j2"
|
2020-09-24 16:04:06 +00:00
|
|
|
dest: "/etc/cni/net.d/calico.conflist.template"
|
2018-08-23 14:17:18 +00:00
|
|
|
owner: kube
|
2019-04-19 13:01:54 +00:00
|
|
|
register: calico_conflist
|
|
|
|
notify: reset_calico_cni
|
2018-08-23 14:17:18 +00:00
|
|
|
|
|
|
|
- name: Calico | Create calico certs directory
|
|
|
|
file:
|
|
|
|
dest: "{{ calico_cert_dir }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0750
|
|
|
|
owner: root
|
|
|
|
group: root
|
2019-07-15 08:59:06 +00:00
|
|
|
when: calico_datastore == "etcd"
|
2018-08-23 14:17:18 +00:00
|
|
|
|
|
|
|
- name: Calico | Link etcd certificates for calico-node
|
|
|
|
file:
|
|
|
|
src: "{{ etcd_cert_dir }}/{{ item.s }}"
|
|
|
|
dest: "{{ calico_cert_dir }}/{{ item.d }}"
|
|
|
|
state: hard
|
2021-04-26 22:37:03 +00:00
|
|
|
mode: 0640
|
2018-08-23 14:17:18 +00:00
|
|
|
force: yes
|
|
|
|
with_items:
|
2019-04-19 13:01:54 +00:00
|
|
|
- {s: "{{ kube_etcd_cacert_file }}", d: "ca_cert.crt"}
|
|
|
|
- {s: "{{ kube_etcd_cert_file }}", d: "cert.crt"}
|
|
|
|
- {s: "{{ kube_etcd_key_file }}", d: "key.pem"}
|
2019-07-15 08:59:06 +00:00
|
|
|
when: calico_datastore == "etcd"
|
2018-08-23 14:17:18 +00:00
|
|
|
|
2019-10-17 14:02:38 +00:00
|
|
|
- name: Calico | Generate typha certs
|
|
|
|
include_tasks: typha_certs.yml
|
|
|
|
when:
|
|
|
|
- typha_secure
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-10-17 14:02:38 +00:00
|
|
|
|
2019-04-15 11:24:04 +00:00
|
|
|
- name: Calico | Install calicoctl wrapper script
|
2018-08-23 14:17:18 +00:00
|
|
|
template:
|
2019-07-08 09:20:03 +00:00
|
|
|
src: "calicoctl.{{ calico_datastore }}.sh.j2"
|
2019-04-15 11:24:04 +00:00
|
|
|
dest: "{{ bin_dir }}/calicoctl.sh"
|
2018-08-23 14:17:18 +00:00
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
|
|
|
- name: Calico | wait for etcd
|
|
|
|
uri:
|
|
|
|
url: "{{ etcd_access_addresses.split(',') | first }}/health"
|
|
|
|
validate_certs: no
|
2019-06-20 18:12:51 +00:00
|
|
|
client_cert: "{{ calico_cert_dir }}/cert.crt"
|
|
|
|
client_key: "{{ calico_cert_dir }}/key.pem"
|
2018-08-23 14:17:18 +00:00
|
|
|
register: result
|
|
|
|
until: result.status == 200 or result.status == 401
|
|
|
|
retries: 10
|
|
|
|
delay: 5
|
|
|
|
run_once: true
|
2019-07-15 08:59:06 +00:00
|
|
|
when: calico_datastore == "etcd"
|
2018-08-23 14:17:18 +00:00
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Check if calico network pool has already been configured
|
|
|
|
# noqa 306 - grep will exit 1 if no match found
|
2018-08-23 14:17:18 +00:00
|
|
|
shell: >
|
2019-04-15 11:24:04 +00:00
|
|
|
{{ bin_dir }}/calicoctl.sh get ippool | grep -w "{{ calico_pool_cidr | default(kube_pods_subnet) }}" | wc -l
|
2020-09-03 06:55:40 +00:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2018-08-23 14:17:18 +00:00
|
|
|
register: calico_conf
|
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: calico_conf.rc == 0
|
2018-08-23 14:17:18 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
2019-02-26 04:09:30 +00:00
|
|
|
changed_when: false
|
2019-07-15 08:59:06 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-08-23 14:17:18 +00:00
|
|
|
|
2019-01-31 21:39:13 +00:00
|
|
|
- name: Calico | Ensure that calico_pool_cidr is within kube_pods_subnet when defined
|
|
|
|
assert:
|
|
|
|
that: "[calico_pool_cidr] | ipaddr(kube_pods_subnet) | length == 1"
|
|
|
|
msg: "{{ calico_pool_cidr }} is not within or equal to {{ kube_pods_subnet }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-01-31 21:39:13 +00:00
|
|
|
- 'calico_conf.stdout == "0"'
|
|
|
|
- calico_pool_cidr is defined
|
|
|
|
|
2020-10-26 07:10:53 +00:00
|
|
|
- name: Calico | Check if calico IPv6 network pool has already been configured
|
|
|
|
# noqa 306 - grep will exit 1 if no match found
|
|
|
|
shell: >
|
|
|
|
{{ bin_dir }}/calicoctl.sh get ippool | grep -w "{{ calico_pool_cidr_ipv6 | default(kube_pods_subnet_ipv6) }}" | wc -l
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
register: calico_conf_ipv6
|
|
|
|
retries: 4
|
|
|
|
until: calico_conf_ipv6.rc == 0
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
changed_when: false
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-10-26 07:10:53 +00:00
|
|
|
- enable_dual_stack_networks
|
|
|
|
|
|
|
|
- name: Calico | Ensure that calico_pool_cidr_ipv6 is within kube_pods_subnet_ipv6 when defined
|
|
|
|
assert:
|
|
|
|
that: "[calico_pool_cidr_ipv6] | ipaddr(kube_pods_subnet_ipv6) | length == 1"
|
|
|
|
msg: "{{ calico_pool_cidr_ipv6 }} is not within or equal to {{ kube_pods_subnet_ipv6 }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-10-26 07:10:53 +00:00
|
|
|
- calico_conf_ipv6.stdout is defined and calico_conf_ipv6.stdout == "0"
|
|
|
|
- calico_pool_cidr_ipv6 is defined
|
|
|
|
- enable_dual_stack_networks
|
|
|
|
|
2021-03-19 00:06:36 +00:00
|
|
|
- block:
|
|
|
|
- name: Calico | Create calico manifests for kdd
|
|
|
|
assemble:
|
|
|
|
src: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds"
|
|
|
|
dest: "{{ kube_config_dir }}/kdd-crds.yml"
|
2021-04-21 17:45:51 +00:00
|
|
|
delimiter: "---\n"
|
2021-03-19 00:06:36 +00:00
|
|
|
regexp: ".*\\.yaml"
|
|
|
|
remote_src: true
|
|
|
|
|
|
|
|
- name: Calico | Create Calico Kubernetes datastore resources
|
|
|
|
kube:
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
filename: "{{ kube_config_dir }}/kdd-crds.yml"
|
|
|
|
state: "latest"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-07-08 09:20:03 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-07-08 09:20:03 +00:00
|
|
|
- calico_datastore == "kdd"
|
|
|
|
|
2020-09-24 16:04:06 +00:00
|
|
|
- name: Calico | Configure calico network pool
|
2020-09-03 06:55:40 +00:00
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
2019-03-06 20:42:48 +00:00
|
|
|
{ "kind": "IPPool",
|
|
|
|
"apiVersion": "projectcalico.org/v3",
|
|
|
|
"metadata": {
|
|
|
|
"name": "{{ calico_pool_name }}",
|
|
|
|
},
|
|
|
|
"spec": {
|
2020-09-03 06:55:40 +00:00
|
|
|
"blockSize": {{ calico_pool_blocksize | default(kube_network_node_prefix) }},
|
2019-03-06 20:42:48 +00:00
|
|
|
"cidr": "{{ calico_pool_cidr | default(kube_pods_subnet) }}",
|
2020-03-12 08:20:37 +00:00
|
|
|
"ipipMode": "{{ calico_ipip_mode }}",
|
|
|
|
"vxlanMode": "{{ calico_vxlan_mode }}",
|
2020-09-03 06:55:40 +00:00
|
|
|
"natOutgoing": {{ nat_outgoing|default(false) and not peer_with_router|default(false) }} }}
|
2019-03-06 20:42:48 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-03-06 20:42:48 +00:00
|
|
|
- 'calico_conf.stdout == "0"'
|
2018-09-11 12:14:10 +00:00
|
|
|
|
2020-10-26 07:10:53 +00:00
|
|
|
- name: Calico | Configure calico ipv6 network pool (version >= v3.3.0)
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
|
|
|
stdin: >
|
|
|
|
{ "kind": "IPPool",
|
|
|
|
"apiVersion": "projectcalico.org/v3",
|
|
|
|
"metadata": {
|
|
|
|
"name": "{{ calico_pool_name }}-ipv6",
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"blockSize": {{ calico_pool_blocksize_ipv6 | default(kube_network_node_prefix_ipv6) }},
|
|
|
|
"cidr": "{{ calico_pool_cidr_ipv6 | default(kube_pods_subnet_ipv6) }}",
|
|
|
|
"ipipMode": "{{ calico_ipip_mode_ipv6 }}",
|
|
|
|
"vxlanMode": "{{ calico_vxlan_mode_ipv6 }}",
|
|
|
|
"natOutgoing": {{ nat_outgoing_ipv6|default(false) and not peer_with_router_ipv6|default(false) }} }}
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-10-26 07:10:53 +00:00
|
|
|
- calico_conf_ipv6.stdout is defined and calico_conf_ipv6.stdout == "0"
|
|
|
|
- enable_dual_stack_networks | bool
|
|
|
|
|
2020-11-25 13:34:39 +00:00
|
|
|
- name: Populate Service External IPs
|
|
|
|
set_fact:
|
|
|
|
_service_external_ips: "{{ _service_external_ips|default([]) + [ {'cidr': item} ] }}"
|
|
|
|
with_items: "{{ calico_advertise_service_external_ips }}"
|
|
|
|
run_once: yes
|
|
|
|
|
2021-05-12 12:22:17 +00:00
|
|
|
- name: Populate Service LoadBalancer IPs
|
|
|
|
set_fact:
|
|
|
|
_service_loadbalancer_ips: "{{ _service_loadbalancer_ips|default([]) + [ {'cidr': item} ] }}"
|
|
|
|
with_items: "{{ calico_advertise_service_loadbalancer_ips }}"
|
|
|
|
run_once: yes
|
|
|
|
|
2018-08-23 14:17:18 +00:00
|
|
|
- name: "Determine nodeToNodeMesh needed state"
|
|
|
|
set_fact:
|
|
|
|
nodeToNodeMeshEnabled: "false"
|
|
|
|
when:
|
|
|
|
- peer_with_router|default(false) or peer_with_calico_rr|default(false)
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2018-08-23 14:17:18 +00:00
|
|
|
run_once: yes
|
|
|
|
|
2020-12-18 06:54:25 +00:00
|
|
|
- name: Calico | Set up BGP Configuration
|
2020-09-03 06:55:40 +00:00
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{ "kind": "BGPConfiguration",
|
|
|
|
"apiVersion": "projectcalico.org/v3",
|
|
|
|
"metadata": {
|
|
|
|
"name": "default",
|
|
|
|
},
|
|
|
|
"spec": {
|
2021-03-29 15:38:45 +00:00
|
|
|
"listenPort": {{ calico_bgp_listen_port }},
|
2020-09-03 06:55:40 +00:00
|
|
|
"logSeverityScreen": "Info",
|
2020-12-18 06:54:25 +00:00
|
|
|
{% if not calico_no_global_as_num|default(false) %}"asNumber": {{ global_as_num }},{% endif %}
|
2020-09-03 06:55:40 +00:00
|
|
|
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled|default('true') }} ,
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
{% if calico_advertise_cluster_ips|default(false) %}"serviceClusterIPs": [{"cidr": "{{ kube_service_addresses }}" }],{% endif %}
|
2021-05-12 12:22:17 +00:00
|
|
|
{% if calico_version is version('v3.18.0', '>') and calico_advertise_service_loadbalancer_ips|length > 0 %}"serviceLoadBalancerIPs": {{ _service_loadbalancer_ips }},{% endif %}
|
2020-12-18 06:54:25 +00:00
|
|
|
"serviceExternalIPs": {{ _service_external_ips|default([]) }} }}
|
2019-04-16 16:31:11 +00:00
|
|
|
changed_when: false
|
2018-09-11 12:14:10 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-08-23 14:17:18 +00:00
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Configure peering with router(s) at global scope
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{"apiVersion": "projectcalico.org/v3",
|
|
|
|
"kind": "BGPPeer",
|
|
|
|
"metadata": {
|
2021-05-11 14:05:36 +00:00
|
|
|
"name": "global-{{ item.name | default(item.router_id|replace(':','-')) }}"
|
2020-09-03 06:55:40 +00:00
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"asNumber": "{{ item.as }}",
|
|
|
|
"peerIP": "{{ item.router_id }}"
|
|
|
|
}}
|
2020-04-21 14:20:56 +00:00
|
|
|
register: output
|
2019-07-15 08:59:06 +00:00
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: output.rc == 0
|
2019-07-15 08:59:06 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ peers|selectattr('scope','defined')|selectattr('scope','equalto', 'global')|list|default([]) }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-07-15 08:59:06 +00:00
|
|
|
- peer_with_router|default(false)
|
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Configure peering with route reflectors at global scope
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
# revert when it's already a string
|
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{"apiVersion": "projectcalico.org/v3",
|
|
|
|
"kind": "BGPPeer",
|
|
|
|
"metadata": {
|
|
|
|
"name": "peer-to-rrs"
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"nodeSelector": "!has(i-am-a-route-reflector)",
|
|
|
|
"peerSelector": "has(i-am-a-route-reflector)"
|
|
|
|
}}
|
2020-04-21 14:20:56 +00:00
|
|
|
register: output
|
2019-08-08 14:37:22 +00:00
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: output.rc == 0
|
2019-08-08 14:37:22 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
with_items:
|
2021-04-29 12:20:50 +00:00
|
|
|
- "{{ groups['calico_rr'] | default([]) }}"
|
2019-08-08 14:37:22 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-08-08 14:37:22 +00:00
|
|
|
- peer_with_calico_rr|default(false)
|
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Configure route reflectors to peer with each other
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
# revert when it's already a string
|
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{"apiVersion": "projectcalico.org/v3",
|
|
|
|
"kind": "BGPPeer",
|
|
|
|
"metadata": {
|
|
|
|
"name": "rr-mesh"
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"nodeSelector": "has(i-am-a-route-reflector)",
|
|
|
|
"peerSelector": "has(i-am-a-route-reflector)"
|
|
|
|
}}
|
2020-04-21 14:20:56 +00:00
|
|
|
register: output
|
2019-08-08 14:37:22 +00:00
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: output.rc == 0
|
2019-08-08 14:37:22 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
with_items:
|
2021-04-29 12:20:50 +00:00
|
|
|
- "{{ groups['calico_rr'] | default([]) }}"
|
2019-08-08 14:37:22 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-08-08 14:37:22 +00:00
|
|
|
- peer_with_calico_rr|default(false)
|
|
|
|
|
2019-07-15 08:59:06 +00:00
|
|
|
- name: Calico | Create calico manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
|
|
|
with_items:
|
|
|
|
- {name: calico-config, file: calico-config.yml, type: cm}
|
|
|
|
- {name: calico-node, file: calico-node.yml, type: ds}
|
|
|
|
- {name: calico, file: calico-node-sa.yml, type: sa}
|
|
|
|
- {name: calico, file: calico-cr.yml, type: clusterrole}
|
|
|
|
- {name: calico, file: calico-crb.yml, type: clusterrolebinding}
|
|
|
|
register: calico_node_manifests
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-07-15 08:59:06 +00:00
|
|
|
- rbac_enabled or item.type not in rbac_resources
|
|
|
|
|
|
|
|
- name: Calico | Create calico manifests for typha
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
|
|
|
with_items:
|
|
|
|
- {name: calico, file: calico-typha.yml, type: typha}
|
|
|
|
register: calico_node_typha_manifest
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-07-15 08:59:06 +00:00
|
|
|
- typha_enabled and calico_datastore == "kdd"
|
|
|
|
|
|
|
|
- name: Start Calico resources
|
|
|
|
kube:
|
|
|
|
name: "{{ item.item.name }}"
|
|
|
|
namespace: "kube-system"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
|
|
|
|
state: "latest"
|
|
|
|
with_items:
|
|
|
|
- "{{ calico_node_manifests.results }}"
|
|
|
|
- "{{ calico_node_typha_manifest.results }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-07-15 08:59:06 +00:00
|
|
|
- not item is skipped
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.item.file }}"
|
|
|
|
|
|
|
|
- name: Wait for calico kubeconfig to be created
|
|
|
|
wait_for:
|
|
|
|
path: /etc/cni/net.d/calico-kubeconfig
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname not in groups['kube_control_plane']
|
2019-07-15 08:59:06 +00:00
|
|
|
- calico_datastore == "kdd"
|
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Configure node asNumber for per node peering
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{"apiVersion": "projectcalico.org/v3",
|
|
|
|
"kind": "Node",
|
|
|
|
"metadata": {
|
|
|
|
"name": "{{ inventory_hostname }}"
|
2020-06-29 19:39:59 +00:00
|
|
|
},
|
2020-09-03 06:55:40 +00:00
|
|
|
"spec": {
|
|
|
|
"bgp": {
|
|
|
|
"asNumber": "{{ local_as }}"
|
|
|
|
},
|
|
|
|
"orchRefs":[{"nodeName":"{{ inventory_hostname }}","orchestrator":"k8s"}]
|
|
|
|
}}
|
2020-04-21 14:20:56 +00:00
|
|
|
register: output
|
2018-10-16 06:44:49 +00:00
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: output.rc == 0
|
2018-10-16 06:44:49 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
when:
|
|
|
|
- peer_with_router|default(false)
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2018-10-16 06:44:49 +00:00
|
|
|
- local_as is defined
|
2021-04-29 12:20:50 +00:00
|
|
|
- groups['calico_rr'] | default([]) | length == 0
|
2018-10-16 06:44:49 +00:00
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Configure peering with router(s) at node scope
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
2021-02-03 15:22:29 +00:00
|
|
|
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
calico: fix warnings (#7121)
TASK [network_plugin/calico : Calico | Configure calico network pool] **********
task path: /builds/kargo-ci/kubernetes-sigs-kubespray/roles/network_plugin/calico/tasks/install.yml:138
Friday 08 January 2021 17:10:12 +0000 (0:00:01.521) 0:11:36.885 ********
[WARNING]: The value {'kind': 'IPPool', 'apiVersion': 'projectcalico.org/v3',
'metadata': {'name': 'default-pool'}, 'spec': {'blockSize': 24, 'cidr':
'10.233.64.0/18', 'ipipMode': 'Always', 'vxlanMode': 'Never', 'natOutgoing':
True}} (type dict) in a string field was converted to "{'kind': 'IPPool',
'apiVersion': 'projectcalico.org/v3', 'metadata': {'name': 'default-pool'},
'spec': {'blockSize': 24, 'cidr': '10.233.64.0/18', 'ipipMode': 'Always',
'vxlanMode': 'Never', 'natOutgoing': True}}" (type string). If this does not
look like what you expect, quote the entire value to ensure it does not change.
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2021-01-09 00:01:05 +00:00
|
|
|
vars:
|
2020-09-03 06:55:40 +00:00
|
|
|
stdin: >
|
|
|
|
{"apiVersion": "projectcalico.org/v3",
|
|
|
|
"kind": "BGPPeer",
|
|
|
|
"metadata": {
|
2021-05-11 14:05:36 +00:00
|
|
|
"name": "{{ inventory_hostname }}-{{ item.name | default(item.router_id|replace(':','-')) }}"
|
2020-09-03 06:55:40 +00:00
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"asNumber": "{{ item.as }}",
|
|
|
|
"node": "{{ inventory_hostname }}",
|
|
|
|
"peerIP": "{{ item.router_id }}"
|
|
|
|
}}
|
2020-04-21 14:20:56 +00:00
|
|
|
register: output
|
2018-08-23 14:17:18 +00:00
|
|
|
retries: 4
|
2020-04-21 14:20:56 +00:00
|
|
|
until: output.rc == 0
|
2018-08-23 14:17:18 +00:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
with_items:
|
2018-10-24 05:19:50 +00:00
|
|
|
- "{{ peers|selectattr('scope','undefined')|list|default([]) | union(peers|selectattr('scope','defined')|selectattr('scope','equalto', 'node')|list|default([])) }}"
|
2018-08-23 14:17:18 +00:00
|
|
|
when:
|
2018-10-16 22:32:26 +00:00
|
|
|
- peer_with_router|default(false)
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|