2017-10-16 14:11:38 +08:00
|
|
|
{
|
|
|
|
"name": "cni0",
|
|
|
|
"cniVersion":"0.3.1",
|
|
|
|
"plugins":[
|
|
|
|
{
|
2019-07-10 03:42:28 +08:00
|
|
|
{% if calico_datastore == "kdd" %}
|
|
|
|
"datastore_type": "kubernetes",
|
|
|
|
"nodename": "__KUBERNETES_NODE_NAME__",
|
|
|
|
{% else %}
|
2018-08-23 22:17:18 +08:00
|
|
|
{% if cloud_provider is defined %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"nodename": "{{ calico_kubelet_name.stdout }}",
|
2020-09-17 17:44:46 +08:00
|
|
|
{% else %}
|
2018-05-14 20:13:51 +08:00
|
|
|
"nodename": "{{ calico_baremetal_nodename }}",
|
2020-09-17 17:44:46 +08:00
|
|
|
{% endif %}
|
2019-07-10 03:42:28 +08:00
|
|
|
{% endif %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"type": "calico",
|
2019-04-25 20:00:48 +08:00
|
|
|
"log_level": "info",
|
2020-09-10 18:45:46 +08:00
|
|
|
"log_file_path": "/var/log/calico/cni/cni.log",
|
2019-04-25 20:00:48 +08:00
|
|
|
{% if calico_datastore == "etcd" %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
2019-01-29 03:03:49 +08:00
|
|
|
"etcd_cert_file": "{{ calico_cert_dir }}/cert.crt",
|
|
|
|
"etcd_key_file": "{{ calico_cert_dir }}/key.pem",
|
|
|
|
"etcd_ca_cert_file": "{{ calico_cert_dir }}/ca_cert.crt",
|
2019-07-10 03:42:28 +08:00
|
|
|
{% endif %}
|
2020-09-17 17:44:46 +08:00
|
|
|
{% if calico_ipam_host_local is defined %}
|
2019-07-10 03:42:28 +08:00
|
|
|
"ipam": {
|
|
|
|
"type": "host-local",
|
|
|
|
"subnet": "usePodCidr"
|
|
|
|
},
|
|
|
|
{% else %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"ipam": {
|
2018-02-21 23:16:32 +08:00
|
|
|
"type": "calico-ipam",
|
2020-10-26 15:10:53 +08:00
|
|
|
{% if enable_dual_stack_networks %}
|
|
|
|
"assign_ipv6": "true",
|
|
|
|
"ipv6_pools": ["{{ calico_pool_cidr_ipv6 | default(kube_pods_subnet_ipv6) }}"],
|
|
|
|
{% endif %}
|
2018-02-21 23:16:32 +08:00
|
|
|
"assign_ipv4": "true",
|
2019-02-01 05:39:13 +08:00
|
|
|
"ipv4_pools": ["{{ calico_pool_cidr | default(kube_pods_subnet) }}"]
|
2017-10-16 14:11:38 +08:00
|
|
|
},
|
2019-04-25 20:00:48 +08:00
|
|
|
{% endif %}
|
2019-06-17 14:14:07 +08:00
|
|
|
{% if (calico_feature_control is defined) and (calico_feature_control|length > 0) %}
|
|
|
|
"feature_control": {
|
|
|
|
{% for fc in calico_feature_control -%}
|
|
|
|
{% set fcval = calico_feature_control[fc] -%}
|
|
|
|
"{{ fc }}": {{ (fcval | string | lower) if (fcval == true or fcval == false) else "\"" + fcval + "\"" }}{{ "," if not loop.last else "" }}
|
|
|
|
{% endfor -%}
|
|
|
|
{{- "" }}
|
|
|
|
},
|
|
|
|
{% endif %}
|
2018-08-23 22:17:18 +08:00
|
|
|
{% if enable_network_policy %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"policy": {
|
|
|
|
"type": "k8s"
|
|
|
|
},
|
2020-09-17 17:44:46 +08:00
|
|
|
{% endif %}
|
2018-08-23 22:17:18 +08:00
|
|
|
{% if calico_mtu is defined and calico_mtu is number %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"mtu": {{ calico_mtu }},
|
2020-09-17 17:44:46 +08:00
|
|
|
{% endif %}
|
2017-10-16 14:11:38 +08:00
|
|
|
"kubernetes": {
|
2020-09-25 00:04:06 +08:00
|
|
|
"kubeconfig": "__KUBECONFIG_FILEPATH__"
|
2017-10-16 14:11:38 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type":"portmap",
|
2020-09-17 17:44:46 +08:00
|
|
|
"capabilities": {
|
|
|
|
"portMappings": true
|
2017-10-16 14:11:38 +08:00
|
|
|
}
|
2021-06-07 19:58:39 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"type":"bandwidth",
|
|
|
|
"capabilities": {
|
|
|
|
"bandwidth": true
|
|
|
|
}
|
2017-10-16 14:11:38 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|