mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-18 06:47:46 -02:30
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.
This commit is contained in:
@@ -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
|
|
||||||
@@ -32,6 +32,21 @@
|
|||||||
clusterIP: "{{ skydns_server }}"
|
clusterIP: "{{ skydns_server }}"
|
||||||
when: dns_mode in ['coredns', 'coredns_dual']
|
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
|
- name: Kubernetes Apps | Start Resources
|
||||||
kube:
|
kube:
|
||||||
name: "{{ item.item.name }}"
|
name: "{{ item.item.name }}"
|
||||||
@@ -41,7 +56,6 @@
|
|||||||
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
|
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
|
||||||
state: "latest"
|
state: "latest"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ coredns_secondary_manifests.results | default({}) }}"
|
|
||||||
- "{{ nodelocaldns_manifests.results | default({}) }}"
|
- "{{ nodelocaldns_manifests.results | default({}) }}"
|
||||||
- "{{ nodelocaldns_second_manifests.results | default({}) }}"
|
- "{{ nodelocaldns_second_manifests.results | default({}) }}"
|
||||||
when:
|
when:
|
||||||
|
|||||||
Reference in New Issue
Block a user