Skip to content
Snippets Groups Projects
Unverified Commit 418fc007 authored by cyril-corbon's avatar cyril-corbon Committed by GitHub
Browse files

fix: kube-dns service deletion (#8565)

parent 25371779
No related branches found
No related tags found
No related merge requests found
---
- name: Kubernetes Apps | Register coredns deployment annotation `createdby`
command: "{{ kubectl }} get deploy -n kube-system coredns -o jsonpath='{ .spec.template.metadata.annotations.createdby }'"
register: createdby_annotation
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`
command: "{{ kubectl }} get svc -n kube-system kube-dns -o jsonpath='{ .metadata.annotations.createdby }'"
register: createdby_annotation_svc
changed_when: false
ignore_errors: true # noqa ignore-errors
when:
......@@ -18,7 +27,7 @@
when:
- dns_mode in ['coredns', 'coredns_dual']
- inventory_hostname == groups['kube_control_plane'][0]
- createdby_annotation.stdout != 'kubespray'
- createdby_annotation_deploy.stdout != 'kubespray'
- name: Kubernetes Apps | Delete kubeadm Kube-DNS service
kube:
......@@ -30,3 +39,4 @@
when:
- dns_mode in ['coredns', 'coredns_dual']
- inventory_hostname == groups['kube_control_plane'][0]
- createdby_annotation_svc.stdout != 'kubespray'
......@@ -11,6 +11,7 @@ metadata:
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
createdby: 'kubespray'
spec:
selector:
k8s-app: kube-dns{{ coredns_ordinal_suffix }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment