diff --git a/docs/calico.md b/docs/calico.md index 772dc361647..331f214e84e 100644 --- a/docs/calico.md +++ b/docs/calico.md @@ -249,3 +249,15 @@ calico_node_extra_envs: neutron security-group-rule-create --protocol 4 --direction egress k8s-a0tp4t neutron security-group-rule-create --protocol 4 --direction igress k8s-a0tp4t ``` + +### Optional : Use Calico CNI host-local IPAM plugin + +Calico currently supports two types of CNI IPAM plugins, `host-local` and `calico-ipam` (default). + +To allow Calico to determine the subnet to use from the Kubernetes API based on the `Node.podCIDR` field, enable the following setting. + +```yml +calico_ipam_host_local: true +``` + +Refer to Project Calico section [Using host-local IPAM](https://docs.projectcalico.org/reference/cni-plugin/configuration#using-host-local-ipam) for further information. diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml b/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml index 003072ab206..2c70129e54a 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml @@ -8,6 +8,9 @@ # Enables Internet connectivity from containers # nat_outgoing: true +# Enables Calico CNI "host-local" IPAM plugin +# calico_ipam_host_local: true + # add default ippool name # calico_pool_name: "default-pool" diff --git a/roles/network_plugin/calico/templates/cni-calico.conflist.j2 b/roles/network_plugin/calico/templates/cni-calico.conflist.j2 index af3e049bacb..665fce01ebd 100644 --- a/roles/network_plugin/calico/templates/cni-calico.conflist.j2 +++ b/roles/network_plugin/calico/templates/cni-calico.conflist.j2 @@ -9,9 +9,9 @@ {% else %} {% if cloud_provider is defined %} "nodename": "{{ calico_kubelet_name.stdout }}", - {% else %} +{% else %} "nodename": "{{ calico_baremetal_nodename }}", - {% endif %} +{% endif %} {% endif %} "type": "calico", "log_level": "info", @@ -22,7 +22,7 @@ "etcd_key_file": "{{ calico_cert_dir }}/key.pem", "etcd_ca_cert_file": "{{ calico_cert_dir }}/ca_cert.crt", {% endif %} -{% if calico_datastore == "kdd" and calico_version is version('v3.6.0', '<') %} +{% if calico_ipam_host_local is defined %} "ipam": { "type": "host-local", "subnet": "usePodCidr" @@ -63,8 +63,8 @@ {% endif %} { "type":"portmap", - "capabilities":{ - "portMappings":true + "capabilities": { + "portMappings": true } } ]