Skip to content

Commit

Permalink
Add support for Calico CNI host-local IPAM plugin (kubernetes-sigs#6580)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmelbourne authored and LuckySB committed Jan 16, 2021
1 parent 350ce3d commit 8bfcd44
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
12 changes: 12 additions & 0 deletions docs/calico.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions inventory/sample/group_vars/k8s-cluster/k8s-net-calico.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
10 changes: 5 additions & 5 deletions roles/network_plugin/calico/templates/cni-calico.conflist.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -63,8 +63,8 @@
{% endif %}
{
"type":"portmap",
"capabilities":{
"portMappings":true
"capabilities": {
"portMappings": true
}
}
]
Expand Down

0 comments on commit 8bfcd44

Please sign in to comment.