Skip to content

Commit

Permalink
remove no longer present etcd nodes from APIEndpoints list in kubeadm…
Browse files Browse the repository at this point in the history
…-config configmap (kubernetes-sigs#8244)
  • Loading branch information
Alvaro-Campesino authored and sakuraiyuta committed Apr 16, 2022
1 parent c3adee7 commit b7b50be
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions roles/remove-node/remove-etcd-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@
when:
- inventory_hostname in groups['etcd']
- etcd_member_id.stdout | length > 0

# Delete node from kubeadm-config
- name: Update kubeadm-config configmap removing control-plane no longer existing endpoints
vars:
kubeadm_config_cm_content: "{{ lookup('kubernetes.core.k8s', kind='ConfigMap', namespace='kube-system', resource_name='kubeadm-config', kubeconfig=keos_kubeconfig_path) }}"
kubernetes.core.k8s:
kubeconfig: "{{ keos_kubeconfig_path }}"
definition:
api_version: v1
kind: ConfigMap
metadata:
name: kubeadm-config-test
namespace: default
data:
ClusterStatus: "{{ kubeadm_config_cm_content.data.ClusterStatus | regex_replace( node |default(kube_node) + ':\n' + ' *advertiseAddress: ([0-9]{1,3}.){3}[0-9]{1,3}\n' + ' *bindPort: [0-9]{1,5}' , '') }}"

0 comments on commit b7b50be

Please sign in to comment.