Allow pods on the control plane immediately if possible

This commit is contained in:
Michael McCulloch 2024-02-08 06:14:50 -07:00
parent 0b2aae72b9
commit 756747a678
3 changed files with 39 additions and 15 deletions

View File

@ -5,3 +5,29 @@
args:
creates: /etc/kubernetes/kubelet.conf
tags: ["skip_ansible_lint"]
- name: Ensure .kube directory exists.
file:
path: ~/.kube
state: directory
mode: 0755
- name: Symlink the kubectl admin.conf to ~/.kube/conf.
file:
src: /etc/kubernetes/admin.conf
dest: ~/.kube/config
state: link
mode: 0644
- name: Allow pods on control plane (if configured).
command: "kubectl taint nodes {{ inventory_hostname }} node-role.kubernetes.io/control-plane-"
register: taint_removed
until: >
("untainted" in taint_removed.stdout) or
("not found" in taint_removed.stderr)
changed_when: "'untainted' in taint_removed.stdout"
failed_when: false
retries: 100
delay: 5
when:
- kubernetes_allow_pods_on_control_plane | bool

View File

@ -87,6 +87,19 @@
state: link
mode: 0644
- name: Allow pods on control plane (if configured).
command: "kubectl taint nodes {{ inventory_hostname }} node-role.kubernetes.io/control-plane-"
register: taint_removed
until: >
("untainted" in taint_removed.stdout) or
("not found" in taint_removed.stderr)
changed_when: "'untainted' in taint_removed.stdout"
failed_when: false
retries: 100
delay: 5
when:
- kubernetes_allow_pods_on_control_plane | bool
- name: Write Cilium Helm values to file
copy:
dest: "/tmp/cilium_helm.yaml"

View File

@ -101,18 +101,3 @@
- inventory_hostname != groups['k8s_control_plane'][0]
- inventory_hostname == item
loop: "{{ groups['k8s_control_plane'] }}"
- name: Allow pods on control plane (if configured).
command: "kubectl taint nodes {{ item }} node-role.kubernetes.io/control-plane-"
register: taint_removed
until: >
("untainted" in taint_removed.stdout) or
("not found" in taint_removed.stderr)
changed_when: "'untainted' in taint_removed.stdout"
failed_when: false
retries: 100
delay: 5
loop: "{{ groups['k8s_control_plane'] }}"
when:
- kubernetes_allow_pods_on_control_plane | bool
- inventory_hostname == groups['k8s_control_plane'][0]