From 2156de114a4bec5c3d21e7d80a6ce5b00bca9cf7 Mon Sep 17 00:00:00 2001 From: lobiyed mohammed karim Date: Wed, 25 Oct 2023 14:52:12 +0200 Subject: [PATCH] add pdb --- roles/kubernetes-apps/ansible/tasks/coredns.yml | 1 + .../templates/coredns-poddisruptionbudget.yml.j2 | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 roles/kubernetes-apps/ansible/templates/coredns-poddisruptionbudget.yml.j2 diff --git a/roles/kubernetes-apps/ansible/tasks/coredns.yml b/roles/kubernetes-apps/ansible/tasks/coredns.yml index d8f85477486..72b0a2b49fd 100644 --- a/roles/kubernetes-apps/ansible/tasks/coredns.yml +++ b/roles/kubernetes-apps/ansible/tasks/coredns.yml @@ -8,6 +8,7 @@ - { name: coredns, file: coredns-clusterrole.yml, type: clusterrole } - { name: coredns, file: coredns-clusterrolebinding.yml, type: clusterrolebinding } - { name: coredns, file: coredns-config.yml, type: configmap } + - { name: coredns, file: coredns-poddisruptionbudget.yml, type: poddisruptionbudget } - { name: coredns, file: coredns-deployment.yml, type: deployment } - { name: coredns, file: coredns-sa.yml, type: sa } - { name: coredns, file: coredns-svc.yml, type: svc } diff --git a/roles/kubernetes-apps/ansible/templates/coredns-poddisruptionbudget.yml.j2 b/roles/kubernetes-apps/ansible/templates/coredns-poddisruptionbudget.yml.j2 new file mode 100644 index 00000000000..41be1f7be0a --- /dev/null +++ b/roles/kubernetes-apps/ansible/templates/coredns-poddisruptionbudget.yml.j2 @@ -0,0 +1,10 @@ +{%- if deployment.enabled and podDisruptionBudget -%} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: coredns{{ coredns_ordinal_suffix }} +spec: + maxUnavailable: {{ max_unavailable }} + selector: + matchLabels: + k8s-app: kube-dns{{ coredns_ordinal_suffix }}