From 29ea790c30c8c05730016b434f07465ac80e2a37 Mon Sep 17 00:00:00 2001 From: Olivier Levitt Date: Tue, 19 Dec 2023 04:09:06 +0100 Subject: [PATCH] Fix calico-node in etcd mode (#10438) * Calico : add ETCD endpoints to install-cni container * Calico : remove nodename from configmap in etcd mode --- roles/network_plugin/calico/templates/calico-config.yml.j2 | 6 ------ roles/network_plugin/calico/templates/calico-node.yml.j2 | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/network_plugin/calico/templates/calico-config.yml.j2 b/roles/network_plugin/calico/templates/calico-config.yml.j2 index f1a3f2e76f1..26983ecaed4 100644 --- a/roles/network_plugin/calico/templates/calico-config.yml.j2 +++ b/roles/network_plugin/calico/templates/calico-config.yml.j2 @@ -36,12 +36,6 @@ data: {% if calico_datastore == "kdd" %} "datastore_type": "kubernetes", "nodename": "__KUBERNETES_NODE_NAME__", - {% else %} - {% if cloud_provider is defined %} - "nodename": "{{ calico_kubelet_name.stdout }}", - {% else %} - "nodename": "{{ calico_baremetal_nodename }}", - {% endif %} {% endif %} "type": "calico", "log_level": "info", diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2 index f3d52201fe2..509201152c0 100644 --- a/roles/network_plugin/calico/templates/calico-node.yml.j2 +++ b/roles/network_plugin/calico/templates/calico-node.yml.j2 @@ -96,6 +96,13 @@ spec: # Prevents the container from sleeping forever. - name: SLEEP value: "false" +{% if calico_datastore == "etcd" %} + - name: ETCD_ENDPOINTS + valueFrom: + configMapKeyRef: + name: calico-config + key: etcd_endpoints +{% endif %} {% if calico_datastore == "kdd" %} # Set the hostname based on the k8s node name. - name: KUBERNETES_NODE_NAME