2018-03-13 19:00:05 +08:00
|
|
|
---
|
2021-02-09 22:02:40 +08:00
|
|
|
- name: Kubernetes Apps | Register coredns deployment annotation `createdby`
|
2022-01-05 18:26:32 +08:00
|
|
|
command: "{{ kubectl }} get deploy -n kube-system coredns -o jsonpath='{ .spec.template.metadata.annotations.createdby }'"
|
2022-02-21 18:48:11 +08:00
|
|
|
register: createdby_annotation_deploy
|
|
|
|
changed_when: false
|
2022-11-11 11:58:09 +08:00
|
|
|
check_mode: false
|
2022-02-21 18:48:11 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
|
|
|
when:
|
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
|
|
|
|
|
|
|
- name: Kubernetes Apps | Register coredns service annotation `createdby`
|
2022-05-12 23:33:14 +08:00
|
|
|
command: "{{ kubectl }} get svc -n kube-system coredns -o jsonpath='{ .metadata.annotations.createdby }'"
|
2022-02-21 18:48:11 +08:00
|
|
|
register: createdby_annotation_svc
|
2021-02-09 22:02:40 +08:00
|
|
|
changed_when: false
|
2022-11-11 11:58:09 +08:00
|
|
|
check_mode: false
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2021-02-09 22:02:40 +08:00
|
|
|
when:
|
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2021-02-09 22:02:40 +08:00
|
|
|
|
2018-03-13 19:00:05 +08:00
|
|
|
- name: Kubernetes Apps | Delete kubeadm CoreDNS
|
|
|
|
kube:
|
|
|
|
name: "coredns"
|
2018-03-30 19:29:13 +08:00
|
|
|
namespace: "kube-system"
|
2018-03-13 19:00:05 +08:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "deploy"
|
|
|
|
state: absent
|
|
|
|
when:
|
2019-05-08 04:20:36 +08:00
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2022-02-21 18:48:11 +08:00
|
|
|
- createdby_annotation_deploy.stdout != 'kubespray'
|
2019-05-08 04:20:36 +08:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Delete kubeadm Kube-DNS service
|
|
|
|
kube:
|
|
|
|
name: "kube-dns"
|
|
|
|
namespace: "kube-system"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "svc"
|
|
|
|
state: absent
|
|
|
|
when:
|
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2022-02-21 18:48:11 +08:00
|
|
|
- createdby_annotation_svc.stdout != 'kubespray'
|