From 99b79f22f8ddbf2063cbf9f389e718e494aa576f Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 13 Jan 2022 02:46:27 +0100
Subject: [PATCH] feat(coredns): Add PDB for coredns

In order to keep coredns always available, we deploy a PDB, just in case
:)
---
 infrastructure/coredns/kustomization.yaml       |  5 +++++
 infrastructure/coredns/poddisruptionbudget.yaml | 10 ++++++++++
 infrastructure/kustomization.yaml               |  1 +
 3 files changed, 16 insertions(+)
 create mode 100644 infrastructure/coredns/kustomization.yaml
 create mode 100644 infrastructure/coredns/poddisruptionbudget.yaml

diff --git a/infrastructure/coredns/kustomization.yaml b/infrastructure/coredns/kustomization.yaml
new file mode 100644
index 000000000..53a3b2384
--- /dev/null
+++ b/infrastructure/coredns/kustomization.yaml
@@ -0,0 +1,5 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+namespace: kube-system
+resources:
+  - poddisruptionbudget.yaml
diff --git a/infrastructure/coredns/poddisruptionbudget.yaml b/infrastructure/coredns/poddisruptionbudget.yaml
new file mode 100644
index 000000000..ee1521c93
--- /dev/null
+++ b/infrastructure/coredns/poddisruptionbudget.yaml
@@ -0,0 +1,10 @@
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: coredns
+  namespace: kube-system
+spec:
+  minAvailable: 1
+  selector:
+    matchLabels:
+      k8s-app: kube-dns
diff --git a/infrastructure/kustomization.yaml b/infrastructure/kustomization.yaml
index c95fc467a..1957d4935 100644
--- a/infrastructure/kustomization.yaml
+++ b/infrastructure/kustomization.yaml
@@ -1,6 +1,7 @@
 apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 resources:
+  - coredns
   - kyverno
   - firewall
   - metallb
-- 
GitLab