Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pdb to coredns #10557

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions roles/kubernetes-apps/ansible/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ coredns_default_zone_cache_block: |
cache 30
coredns_host_network: false
coredns_port: 53

coredns_pod_disruption_budget: false
# value for coredns pdb
coredns_pod_disruption_budget_max_unavailable: "30%"

# coredns_additional_configs adds any extra configuration to coredns
# coredns_additional_configs: |
# whoami
Expand Down
4 changes: 4 additions & 0 deletions roles/kubernetes-apps/ansible/tasks/coredns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- { name: dns-autoscaler, file: dns-autoscaler.yml, type: deployment }
- { name: dns-autoscaler, file: dns-autoscaler-clusterrole.yml, type: clusterrole }
- { name: dns-autoscaler, file: dns-autoscaler-clusterrolebinding.yml, type: clusterrolebinding }
- { name: coredns, file: coredns-poddisruptionbudget.yml, type: poddisruptionbudget, condition: coredns_pod_disruption_budget }
- { name: dns-autoscaler, file: dns-autoscaler-sa.yml, type: sa }
register: coredns_manifests
vars:
Expand All @@ -22,6 +23,7 @@
- dns_mode in ['coredns', 'coredns_dual']
- inventory_hostname == groups['kube_control_plane'][0]
- enable_dns_autoscaler or item.name != 'dns-autoscaler'
- item.condition | default(True)
tags:
- coredns

Expand All @@ -34,6 +36,7 @@
- { 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, file: coredns-poddisruptionbudget.yml, type: poddisruptionbudget, condition: coredns_pod_disruption_budget }
register: coredns_secondary_manifests
vars:
clusterIP: "{{ skydns_server_secondary }}"
Expand All @@ -42,5 +45,6 @@
- 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: coredns{{ coredns_ordinal_suffix }}
spec:
maxUnavailable: {{ coredns_pod_disruption_budget_max_unavailable }}
selector:
matchLabels:
k8s-app: kube-dns{{ coredns_ordinal_suffix }}