Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
add support for pod disruption budget (#13215)
Browse files Browse the repository at this point in the history
* add support for pod disruption budget

Signed-off-by: Jay Howard <[email protected]>

* support pod disruption budget parameters explicitly; bump minor version

Signed-off-by: Jay Howard <[email protected]>

* remove default values for minAvailable and maxUnavailable since they're mutually exclusive and neither is required

Signed-off-by: Jay Howard <[email protected]>
  • Loading branch information
Jay Howard authored and k8s-ci-robot committed Apr 30, 2019
1 parent 59cddbf commit 4120bbf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/kubernetes-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: kubernetes-dashboard
version: 1.4.1
version: 1.5.0
appVersion: 1.10.1
description: General-purpose web UI for Kubernetes clusters
keywords:
Expand Down
3 changes: 3 additions & 0 deletions stable/kubernetes-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ The following table lists the configurable parameters of the kubernetes-dashboar
| `serviceAccount.name` | Service account to be used. If not set and serviceAccount.create is `true` a name is generated using the fullname template. | |
| `livenessProbe.initialDelaySeconds` | Number of seconds to wait before sending first probe | 30 |
| `livenessProbe.timeoutSeconds` | Number of seconds to wait for probe response | 30 |
| `podDisruptionBudget.enabled` | Create a PodDisruptionBudget | `false` |
| `podDisruptionBudget.minAvailable` | Minimum available instances; ignored if there is no PodDisruptionBudget | |
| `podDisruptionBudget.maxUnavailable`| Maximum unavailable instances; ignored if there is no PodDisruptionBudget | |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
23 changes: 23 additions & 0 deletions stable/kubernetes-dashboard/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.podDisruptionBudget.enabled -}}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
app: {{ template "kubernetes-dashboard.name" . }}
chart: {{ template "kubernetes-dashboard.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "kubernetes-dashboard.fullname" . }}
namespace: {{ .Release.Namespace }}

spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
app: {{ template "kubernetes-dashboard.name" . }}
{{- end -}}
6 changes: 6 additions & 0 deletions stable/kubernetes-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,9 @@ livenessProbe:
initialDelaySeconds: 30
# Number of seconds to wait for probe response
timeoutSeconds: 30

podDisruptionBudget:
# https://kubernetes.io/docs/tasks/run-application/configure-pdb/
enabled: false
minAvailable:
maxUnavailable:

2 comments on commit 4120bbf

@vdboor
Copy link
Contributor

@vdboor vdboor commented on 4120bbf May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaypatrickhoward Curious, doesn't this issue break node draining with the default replicaCount's == 1?

The nginx-ingress handles this differently, from it's README:

Note that the PodDisruptionBudget resource will only be defined if the replicaCount is greater than one, else it would make it impossible to evacuate a node. See gh issue #7127 for more info.

@jaypatrickhoward
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test that specifically, but probably yes. By default the podDisruptionBudget is disabled, though, so unless a user explicitly enables it they should be okay. I think a PDB can also be created without setting a value for minAvailable or maxUnavailable; not sure what the behavior there is. Maybe in that case it's a NoOp?

Please sign in to comment.