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.

80 lines
2.2 KiB

  1. {
  2. "name": "{{ calico_cni_name }}",
  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_allow_ip_forwarding %}
  42. "container_settings": {
  43. "allow_ip_forwarding": true
  44. },
  45. {% endif %}
  46. {% if (calico_feature_control is defined) and (calico_feature_control|length > 0) %}
  47. "feature_control": {
  48. {% for fc in calico_feature_control -%}
  49. {% set fcval = calico_feature_control[fc] -%}
  50. "{{ fc }}": {{ (fcval | string | lower) if (fcval == true or fcval == false) else "\"" + fcval + "\"" }}{{ "," if not loop.last else "" }}
  51. {% endfor -%}
  52. {{- "" }}
  53. },
  54. {% endif %}
  55. {% if enable_network_policy %}
  56. "policy": {
  57. "type": "k8s"
  58. },
  59. {% endif %}
  60. {% if calico_mtu is defined and calico_mtu is number %}
  61. "mtu": {{ calico_mtu }},
  62. {% endif %}
  63. "kubernetes": {
  64. "kubeconfig": "__KUBECONFIG_FILEPATH__"
  65. }
  66. },
  67. {
  68. "type":"portmap",
  69. "capabilities": {
  70. "portMappings": true
  71. }
  72. },
  73. {
  74. "type":"bandwidth",
  75. "capabilities": {
  76. "bandwidth": true
  77. }
  78. }
  79. ]
  80. }