2017-09-04 16:29:51 +08:00
|
|
|
kind: ConfigMap
|
|
|
|
apiVersion: v1
|
|
|
|
metadata:
|
|
|
|
name: calico-config
|
2018-03-30 19:29:13 +08:00
|
|
|
namespace: kube-system
|
2017-09-04 16:29:51 +08:00
|
|
|
data:
|
2019-04-25 20:00:48 +08:00
|
|
|
{% if calico_datastore == "etcd" %}
|
2017-10-04 20:27:55 +08:00
|
|
|
etcd_endpoints: "{{ etcd_access_addresses }}"
|
2017-09-04 16:29:51 +08:00
|
|
|
etcd_ca: "/calico-secrets/ca_cert.crt"
|
|
|
|
etcd_cert: "/calico-secrets/cert.crt"
|
|
|
|
etcd_key: "/calico-secrets/key.pem"
|
2019-10-17 22:02:38 +08:00
|
|
|
{% elif calico_datastore == "kdd" and typha_enabled %}
|
2019-04-25 20:00:48 +08:00
|
|
|
# To enable Typha, set this to "calico-typha" *and* set a non-zero value for Typha replicas
|
|
|
|
# below. We recommend using Typha if you have more than 50 nodes. Above 100 nodes it is
|
|
|
|
# essential.
|
|
|
|
typha_service_name: "calico-typha"
|
|
|
|
{% endif %}
|
2022-03-18 09:05:39 +08:00
|
|
|
{% if calico_network_backend == 'bird' %}
|
2017-09-04 16:29:51 +08:00
|
|
|
cluster_type: "kubespray,bgp"
|
|
|
|
calico_backend: "bird"
|
2022-03-18 09:05:39 +08:00
|
|
|
{% else %}
|
|
|
|
cluster_type: "kubespray"
|
|
|
|
calico_backend: "{{ calico_network_backend }}"
|
2018-09-27 18:31:14 +08:00
|
|
|
{% endif %}
|
2023-07-05 11:36:54 +08:00
|
|
|
{% if inventory_hostname in groups['k8s_cluster'] and peer_with_router | default(false) %}
|
|
|
|
as: "{{ local_as | default(global_as_num) }}"
|
2018-02-06 08:38:05 +08:00
|
|
|
{% endif -%}
|
2023-06-30 17:51:45 +08:00
|
|
|
# The CNI network configuration to install on each node. The special
|
|
|
|
# values in this config will be automatically populated.
|
|
|
|
cni_network_config: |-
|
|
|
|
{
|
|
|
|
"name": "{{ calico_cni_name }}",
|
|
|
|
"cniVersion":"0.3.1",
|
|
|
|
"plugins":[
|
|
|
|
{
|
|
|
|
{% if calico_datastore == "kdd" %}
|
|
|
|
"datastore_type": "kubernetes",
|
|
|
|
"nodename": "__KUBERNETES_NODE_NAME__",
|
|
|
|
{% endif %}
|
|
|
|
"type": "calico",
|
|
|
|
"log_level": "info",
|
|
|
|
{% if calico_cni_log_file_path %}
|
|
|
|
"log_file_path": "{{ calico_cni_log_file_path }}",
|
|
|
|
{% endif %}
|
|
|
|
{% if calico_datastore == "etcd" %}
|
|
|
|
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
|
|
|
"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",
|
|
|
|
{% endif %}
|
2023-12-12 21:38:36 +08:00
|
|
|
{% if calico_ipam_host_local %}
|
2023-06-30 17:51:45 +08:00
|
|
|
"ipam": {
|
|
|
|
"type": "host-local",
|
|
|
|
"subnet": "usePodCidr"
|
|
|
|
},
|
|
|
|
{% else %}
|
|
|
|
"ipam": {
|
|
|
|
"type": "calico-ipam",
|
|
|
|
{% if enable_dual_stack_networks %}
|
|
|
|
"assign_ipv6": "true",
|
|
|
|
{% endif %}
|
|
|
|
"assign_ipv4": "true"
|
|
|
|
},
|
|
|
|
{% endif %}
|
|
|
|
{% if calico_allow_ip_forwarding %}
|
|
|
|
"container_settings": {
|
|
|
|
"allow_ip_forwarding": true
|
|
|
|
},
|
|
|
|
{% endif %}
|
2023-07-05 11:36:54 +08:00
|
|
|
{% if (calico_feature_control is defined) and (calico_feature_control | length > 0) %}
|
2023-06-30 17:51:45 +08:00
|
|
|
"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 %}
|
|
|
|
{% if enable_network_policy %}
|
|
|
|
"policy": {
|
|
|
|
"type": "k8s"
|
|
|
|
},
|
|
|
|
{% endif %}
|
|
|
|
{% if calico_mtu is defined and calico_mtu is number %}
|
|
|
|
"mtu": {{ calico_mtu }},
|
|
|
|
{% endif %}
|
|
|
|
"kubernetes": {
|
|
|
|
"kubeconfig": "__KUBECONFIG_FILEPATH__"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type":"portmap",
|
|
|
|
"capabilities": {
|
|
|
|
"portMappings": true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type":"bandwidth",
|
|
|
|
"capabilities": {
|
|
|
|
"bandwidth": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|