Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Add a Pod Disruption Budget on kube-dns #1467

Merged
merged 3 commits into from
Oct 26, 2018
Merged
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
28 changes: 28 additions & 0 deletions core/controlplane/config/templates/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,18 @@ write_files:
kubectl delete --cascade=true --ignore-not-found=true -f $(echo "$@" | tr ' ' ',')
}

# forceapply - remove and retry if apply fails (does not rely on the kubectl --force method)
# this is needed for allowing the updating of pod disruption budgets
forceapply() {
set +e
if ! kubectl apply -f $(echo "$@" | tr ' ' ','); then
set -e
kubectl delete --ignore-not-found=true -f $(echo "$@" | tr ' ' ',')
kubectl create -f $(echo "$@" | tr ' ' ',')
fi
set -e
}

while ! kubectl get ns kube-system; do
echo Waiting until kube-system created.
sleep 3
Expand Down Expand Up @@ -932,6 +944,9 @@ write_files:
{{ if .KubeResourcesAutosave.Enabled }}"${mfdir}/kube-resources-autosave-de.yaml"{{ end }} \
{{ if .KubernetesDashboard.Enabled }}"${mfdir}/kubernetes-dashboard-de.yaml"{{ end }}

# Pod Disruption Budgets
forceapply "${mfdir}/kube-dns-pdb.yaml"

# Services
applyall \
"${mfdir}/heapster-svc.yaml" \
Expand Down Expand Up @@ -3872,6 +3887,19 @@ write_files:
port: 53
protocol: TCP

- path: /srv/kubernetes/manifests/kube-dns-pdb.yaml
content: |
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: kube-dns
namespace: kube-system
spec:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns

- path: /srv/kubernetes/manifests/heapster-sa.yaml
content: |
apiVersion: v1
Expand Down