diff --git a/roles/etcd/defaults/main.yml b/roles/etcd/defaults/main.yml index f394e41aab672f64f7b2443d833d9403be59287d..4e122e719b5349f4387cd5a6c81f5e879cd7623b 100644 --- a/roles/etcd/defaults/main.yml +++ b/roles/etcd/defaults/main.yml @@ -32,7 +32,7 @@ etcd_memory_limit: "{% if ansible_memtotal_mb < 4096 %}512M{% else %}0{% endif % etcd_blkio_weight: 1000 -etcd_node_cert_hosts: "{{ groups['k8s-cluster'] | union(groups.get('calico-rr', [])) }}" +etcd_node_cert_hosts: "{{ groups['k8s-cluster'] | union(groups.get('calico-rr', [])) | union(groups.get('vault', [])) }}" etcd_compaction_retention: "8" diff --git a/roles/network_plugin/calico/defaults/main.yml b/roles/network_plugin/calico/defaults/main.yml index 902d0170780b8e821b1abd90d6dab265bc63124d..a44b3d315132e66227591751bbd882c819ba4f56 100644 --- a/roles/network_plugin/calico/defaults/main.yml +++ b/roles/network_plugin/calico/defaults/main.yml @@ -16,9 +16,6 @@ etcd_cert_dir: /etc/ssl/etcd/ssl # Global as_num (/calico/bgp/v1/global/as_num) global_as_num: "64512" -# Set to true if you need to configure multiple pools (this is not common) -calico_ignore_extra_pools: false - # You can set MTU value here. If left undefined or empty, it will # not be specified in calico CNI config, so Calico will use built-in # defaults. The value should be a number, not a string. diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml index b3cacaec40057219f78111ea0ada8a0c96e768c2..46a13676839ca45a3e66a2a57525a3af4a0f890c 100644 --- a/roles/network_plugin/calico/tasks/main.yml +++ b/roles/network_plugin/calico/tasks/main.yml @@ -138,14 +138,6 @@ calico_pools: "{{ calico_pools_raw.stdout | from_json }}" run_once: true -- name: Calico | Check if calico pool is properly configured - fail: - msg: 'Only one network pool must be configured and it must be the subnet {{ kube_pods_subnet }}. - Please erase calico configuration and run the playbook again ("etcdctl rm --recursive /calico/v1/ipam/v4/pool")' - when: ( calico_pools['node']['nodes'] | length > 1 and not calico_ignore_extra_pools ) or - ( not calico_pools['node']['nodes'][0]['key'] | search(".*{{ kube_pods_subnet | ipaddr('network') }}.*") ) - run_once: true - - name: Calico | Set global as_num command: "{{ bin_dir}}/calicoctl config set asNumber {{ global_as_num }}" run_once: true diff --git a/roles/network_plugin/calico/templates/cni-calico.conflist.j2 b/roles/network_plugin/calico/templates/cni-calico.conflist.j2 index 32f2bfff6394167406ad2c0d1a6dfcb2c5aa8f00..6dd51e91298449e879222d04a12d99cfbbd02836 100644 --- a/roles/network_plugin/calico/templates/cni-calico.conflist.j2 +++ b/roles/network_plugin/calico/templates/cni-calico.conflist.j2 @@ -15,16 +15,18 @@ "etcd_ca_cert_file": "{{ etcd_cert_dir }}/ca.pem", "log_level": "info", "ipam": { - "type": "calico-ipam" + "type": "calico-ipam", + "assign_ipv4": "true", + "ipv4_pools": ["{{ kube_pods_subnet }}"] }, {% if enable_network_policy %} "policy": { "type": "k8s" }, - {% endif %} + {%- endif %} {% if calico_mtu is defined and calico_mtu is number %} "mtu": {{ calico_mtu }}, - {% endif %} + {%- endif %} "kubernetes": { "kubeconfig": "{{ kube_config_dir }}/node-kubeconfig.yaml" }