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.

69 lines
2.0 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. "log_file_path": "/var/log/calico/cni/cni.log",
  19. {% if calico_datastore == "etcd" %}
  20. "etcd_endpoints": "{{ etcd_access_addresses }}",
  21. "etcd_cert_file": "{{ calico_cert_dir }}/cert.crt",
  22. "etcd_key_file": "{{ calico_cert_dir }}/key.pem",
  23. "etcd_ca_cert_file": "{{ calico_cert_dir }}/ca_cert.crt",
  24. {% endif %}
  25. {% if calico_ipam_host_local is defined %}
  26. "ipam": {
  27. "type": "host-local",
  28. "subnet": "usePodCidr"
  29. },
  30. {% else %}
  31. "ipam": {
  32. "type": "calico-ipam",
  33. {% if enable_dual_stack_networks %}
  34. "assign_ipv6": "true",
  35. "ipv6_pools": ["{{ calico_pool_cidr_ipv6 | default(kube_pods_subnet_ipv6) }}"],
  36. {% endif %}
  37. "assign_ipv4": "true",
  38. "ipv4_pools": ["{{ calico_pool_cidr | default(kube_pods_subnet) }}"]
  39. },
  40. {% endif %}
  41. {% if (calico_feature_control is defined) and (calico_feature_control|length > 0) %}
  42. "feature_control": {
  43. {% for fc in calico_feature_control -%}
  44. {% set fcval = calico_feature_control[fc] -%}
  45. "{{ fc }}": {{ (fcval | string | lower) if (fcval == true or fcval == false) else "\"" + fcval + "\"" }}{{ "," if not loop.last else "" }}
  46. {% endfor -%}
  47. {{- "" }}
  48. },
  49. {% endif %}
  50. {% if enable_network_policy %}
  51. "policy": {
  52. "type": "k8s"
  53. },
  54. {% endif %}
  55. {% if calico_mtu is defined and calico_mtu is number %}
  56. "mtu": {{ calico_mtu }},
  57. {% endif %}
  58. "kubernetes": {
  59. "kubeconfig": "__KUBECONFIG_FILEPATH__"
  60. }
  61. },
  62. {
  63. "type":"portmap",
  64. "capabilities": {
  65. "portMappings": true
  66. }
  67. }
  68. ]
  69. }