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

Commit

Permalink
Merge pull request #1467 from HotelsDotCom/pdb-4-kubedns
Browse files Browse the repository at this point in the history
Add a Pod Disruption Budget on kube-dns
  • Loading branch information
mumoshu authored Oct 26, 2018
2 parents 4e883ce + 9c3ba92 commit aca24cf
Showing 1 changed file with 28 additions and 0 deletions.
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 @@ -3875,6 +3890,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

0 comments on commit aca24cf

Please sign in to comment.