Browse Source

Convert CoreDNS Secondary to kubectl_apply_stdin

Note that we're reapplying the RBAC/Sa/Config from coredns which is not
strictly necessary, but harmless, when the secondary is enabled.
pull/11700/head
Max Gautier 6 months ago
parent
commit
4b7125f5be
Failed to extract signature
2 changed files with 15 additions and 23 deletions
  1. 22
      roles/kubernetes-apps/ansible/tasks/coredns.yml
  2. 16
      roles/kubernetes-apps/ansible/tasks/main.yml

22
roles/kubernetes-apps/ansible/tasks/coredns.yml

@ -1,22 +0,0 @@
---
- name: Kubernetes Apps | Lay Down Secondary CoreDNS Template
template:
src: "{{ item.src }}.j2"
dest: "{{ kube_config_dir }}/{{ item.file }}"
mode: "0644"
with_items:
- { name: coredns, src: coredns-deployment.yml, file: coredns-deployment-secondary.yml, type: deployment }
- { name: coredns, src: coredns-svc.yml, file: coredns-svc-secondary.yml, type: svc }
- { name: dns-autoscaler, src: dns-autoscaler.yml, file: coredns-autoscaler-secondary.yml, type: deployment }
- { name: coredns, src: coredns-poddisruptionbudget.yml, file: coredns-poddisruptionbudget-secondary.yml, type: poddisruptionbudget, condition: coredns_pod_disruption_budget }
register: coredns_secondary_manifests
vars:
clusterIP: "{{ skydns_server_secondary }}"
coredns_ordinal_suffix: "-secondary"
when:
- dns_mode == 'coredns_dual'
- inventory_hostname == groups['kube_control_plane'][0]
- enable_dns_autoscaler or item.name != 'dns-autoscaler'
- item.condition | default(True)
tags:
- coredns

16
roles/kubernetes-apps/ansible/tasks/main.yml

@ -32,6 +32,21 @@
clusterIP: "{{ skydns_server }}"
when: dns_mode in ['coredns', 'coredns_dual']
- name: Kubernetes Apps | CoreDNS Secondary
command:
cmd: "{{ kubectl_apply_stdin }}"
stdin: "{{ lookup('template', item) }}"
delegate_to: "{{ groups['kube_control_plane'][0] }}"
run_once: true
loop: "{{ coredns_manifests | flatten }}"
tags:
- coredns
vars:
clusterIP: "{{ skydns_server_secondary }}"
coredns_ordinal_suffix: "-secondary"
when:
- dns_mode == 'coredns_dual'
- name: Kubernetes Apps | Start Resources
kube:
name: "{{ item.item.name }}"
@ -41,7 +56,6 @@
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
state: "latest"
with_items:
- "{{ coredns_secondary_manifests.results | default({}) }}"
- "{{ nodelocaldns_manifests.results | default({}) }}"
- "{{ nodelocaldns_second_manifests.results | default({}) }}"
when:

Loading…
Cancel
Save