From 4d7703da11d6c58feded97722691cd58fa0f9d0b Mon Sep 17 00:00:00 2001 From: Jiri 'Ghormoon' Novak Date: Fri, 29 Mar 2024 23:07:56 +0100 Subject: [PATCH] allow configurable name for cni pods so we're waiting for the right ones --- group_vars/all/ClusterConfiguration.yml | 1 + group_vars/all/network.yml | 3 +++ roles/helm/tasks/charts_deploy.yml | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/group_vars/all/ClusterConfiguration.yml b/group_vars/all/ClusterConfiguration.yml index 7418af1..920b9e0 100644 --- a/group_vars/all/ClusterConfiguration.yml +++ b/group_vars/all/ClusterConfiguration.yml @@ -29,6 +29,7 @@ ClusterConfiguration: kubernetesVersion: "v{{ KUBERNETES_VERSION }}" # dns: networking: + cni_pod_name: "{{ POD_CNI_NAME }}" # dnsDomain: cluster.local serviceSubnet: "{{ SERVICE_NETWORK_CIDR }}" # podSubnet: "" diff --git a/group_vars/all/network.yml b/group_vars/all/network.yml index c5643c6..96a4073 100644 --- a/group_vars/all/network.yml +++ b/group_vars/all/network.yml @@ -42,6 +42,9 @@ custom: master: true # when true, actions like wait/join will be done against dns name instead of IP node: false # when true, the join command will have --node-name set to fqdn. When false, k8s will set based on how node machine answers to the hostname command +# Name of CNI pods to wait for during deployment. defualt is calico-node, but might be eg antrea-agent or others if you replace your CNI +POD_CNI_NAME: "calico-node" + ############## THE BELOW SECTION IS NO LONGER RELEVANT, as NETWORK comes via HELM CHARTS (e.g. tigera-operator from calico) #Define network for K8S services SERVICE_NETWORK_CIDR: 10.96.0.0/12 diff --git a/roles/helm/tasks/charts_deploy.yml b/roles/helm/tasks/charts_deploy.yml index a1c4287..ef26ae8 100644 --- a/roles/helm/tasks/charts_deploy.yml +++ b/roles/helm/tasks/charts_deploy.yml @@ -66,7 +66,7 @@ - name: Calico - wait for calico-node pod to appear - required for containerd cni bug... environment: KUBECONFIG: /etc/kubernetes/admin.conf - shell: "kubectl get --all-namespaces pods --no-headers | grep calico-node || true " + shell: "kubectl get --all-namespaces pods --no-headers | grep {{ ClusterConfiguration.network.cni_pod_name }} || true " register: command_result until: command_result.stdout != "" retries: 30 @@ -76,7 +76,7 @@ - name: Calico - wait for calico-node pods to become Running - required for containerd cni bug... environment: KUBECONFIG: /etc/kubernetes/admin.conf - shell: "kubectl get --all-namespaces pods --no-headers | grep calico-node | grep -v -w 'Running' || true " + shell: "kubectl get --all-namespaces pods --no-headers | grep {{ ClusterConfiguration.network.cni_pod_name }} | grep -v -w 'Running' || true " register: command_result until: command_result.stdout == "" retries: 30