Compare commits

...

2 Commits

Author SHA1 Message Date
k8s-infra-cherrypick-robot
4d45cb0f74 kubeadm_patches: remove old patches on inventory change (#13020)
Currently, if changing the inventory variable `kubeadm_patches`, new
patches will be created, but the existing ones will also be left on the
filesystem, and applied by kubeadm ; this means that removed or changed
configuration can linger.

Cleanup old patches (which are the difference between existing patches
on filesystem and the one created for the current runs).

Co-authored-by: Max Gautier <mg@max.gautier.name>
2026-02-19 09:37:37 +05:30
k8s-infra-cherrypick-robot
7b0e730624 Undefined check for apiserver_loadbalancer_domain_name in apiserver_sans (#13014)
Co-authored-by: Chad Swenson <chadswen@gmail.com>
2026-02-16 16:02:01 +05:30
2 changed files with 22 additions and 2 deletions

View File

@@ -36,7 +36,7 @@
- "localhost"
- "127.0.0.1"
- "::1"
- "{{ apiserver_loadbalancer_domain_name }}"
- "{{ apiserver_loadbalancer_domain_name | d('') }}"
- "{{ loadbalancer_apiserver.address | d('') }}"
- "{{ supplementary_addresses_in_ssl_keys }}"
- "{{ groups['kube_control_plane'] | map('extract', hostvars, 'main_access_ip') }}"

View File

@@ -3,9 +3,19 @@
file:
path: "{{ kubeadm_patches_dir }}"
state: directory
mode: "0640"
mode: "0750"
when: kubeadm_patches | length > 0
- name: Kubeadm | List existing kubeadm patches
find:
paths:
- "{{ kubeadm_patches_dir }}"
file_type: file
use_regex: true
patterns:
- '^(kube-apiserver|kube-controller-manager|kube-scheduler|etcd|kubeletconfiguration)[0-9]+\+(strategic|json|merge).yaml$'
register: existing_kubeadm_patches
- name: Kubeadm | Copy kubeadm patches from inventory files
copy:
content: "{{ item.patch | to_yaml }}"
@@ -15,3 +25,13 @@
loop: "{{ kubeadm_patches }}"
loop_control:
index_var: suffix
register: current_kubeadm_patches
- name: Kubeadm | Delete old patches
loop: "{{ existing_kubeadm_patches.files | map(attribute='path') |
difference(
current_kubeadm_patches.results | map(attribute='dest')
) }}"
file:
state: absent
path: "{{ item }}"