Skip to content

Commit

Permalink
allow configurable name for cni pods so we're waiting for the right ones
Browse files Browse the repository at this point in the history
  • Loading branch information
ghormoon committed Mar 30, 2024
1 parent 6147bef commit b448560
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions group_vars/all/ClusterConfiguration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
3 changes: 3 additions & 0 deletions group_vars/all/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions roles/helm/tasks/charts_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@
- name: CALICO BLOCK
block:

- name: Calico - Wait few seconds for deployments to start - wait to make sure calico-node is getting started - required for containerd...
- name: Calico - Wait few seconds for deployments to start - wait to make sure {{ ClusterConfiguration.networking.cni_pod_name }} is getting started - required for containerd...
pause: seconds=30
changed_when: false

- name: Calico - wait for calico-node pod to appear - required for containerd cni bug...
- name: Calico - wait for {{ ClusterConfiguration.networking.cni_pod_name }} 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.networking.cni_pod_name }} || true "
register: command_result
until: command_result.stdout != ""
retries: 30
delay: 7
changed_when: false

- name: Calico - wait for calico-node pods to become Running - required for containerd cni bug...
- name: Calico - wait for {{ ClusterConfiguration.networking.cni_pod_name }} 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.networking.cni_pod_name }} | grep -v -w 'Running' || true "
register: command_result
until: command_result.stdout == ""
retries: 30
delay: 7
changed_when: false

- name: Calico - Wait few seconds for calico-node is Running 1/1 - required for containerd...
- name: Calico - Wait few seconds for {{ ClusterConfiguration.networking.cni_pod_name }} is Running 1/1 - required for containerd...
pause: seconds=20
changed_when: false

Expand Down

0 comments on commit b448560

Please sign in to comment.