You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

  1. {
  2. "name": "cni0",
  3. "cniVersion":"0.3.1",
  4. "plugins":[
  5. {
  6. {% if calico_datastore == "kdd" %}
  7. "datastore_type": "kubernetes",
  8. "nodename": "__KUBERNETES_NODE_NAME__",
  9. {% else %}
  10. {% if cloud_provider is defined %}
  11. "nodename": "{{ calico_kubelet_name.stdout }}",
  12. {% else %}
  13. "nodename": "{{ calico_baremetal_nodename }}",
  14. {% endif %}
  15. {% endif %}
  16. "type": "calico",
  17. "log_level": "info",
  18. {% if calico_datastore == "etcd" %}
  19. "etcd_endpoints": "{{ etcd_access_addresses }}",
  20. "etcd_cert_file": "{{ calico_cert_dir }}/cert.crt",
  21. "etcd_key_file": "{{ calico_cert_dir }}/key.pem",
  22. "etcd_ca_cert_file": "{{ calico_cert_dir }}/ca_cert.crt",
  23. {% endif %}
  24. {% if calico_datastore == "kdd" and calico_version is version('v3.6.0', '<') %}
  25. "ipam": {
  26. "type": "host-local",
  27. "subnet": "usePodCidr"
  28. },
  29. {% else %}
  30. "ipam": {
  31. "type": "calico-ipam",
  32. "assign_ipv4": "true",
  33. "ipv4_pools": ["{{ calico_pool_cidr | default(kube_pods_subnet) }}"]
  34. },
  35. {% endif %}
  36. {% if (calico_feature_control is defined) and (calico_feature_control|length > 0) %}
  37. "feature_control": {
  38. {% for fc in calico_feature_control -%}
  39. {% set fcval = calico_feature_control[fc] -%}
  40. "{{ fc }}": {{ (fcval | string | lower) if (fcval == true or fcval == false) else "\"" + fcval + "\"" }}{{ "," if not loop.last else "" }}
  41. {% endfor -%}
  42. {{- "" }}
  43. },
  44. {% endif %}
  45. {% if enable_network_policy %}
  46. "policy": {
  47. "type": "k8s"
  48. },
  49. {%- endif %}
  50. {% if calico_mtu is defined and calico_mtu is number %}
  51. "mtu": {{ calico_mtu }},
  52. {%- endif %}
  53. "kubernetes": {
  54. "kubeconfig": "{% if calico_version is version('v3.3.0', '>=') %}__KUBECONFIG_FILEPATH__{% else %}{{ kube_config_dir }}/node-kubeconfig.yaml{% endif %}"
  55. }
  56. },
  57. {
  58. "type":"portmap",
  59. "capabilities":{
  60. "portMappings":true
  61. }
  62. }
  63. ]
  64. }