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