Merge pull request #2362 from mattymo/calico_ignore_extra_pools_again

Use CNI to assign kube_pods_subnet for calico
This commit is contained in:
Brad Beam 2018-02-28 12:36:50 -06:00 committed by GitHub
commit afb6e7dfc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 14 deletions

View file

@ -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.

View file

@ -135,14 +135,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

View file

@ -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"
}