From de19e083c9581bf6432a702bb1c467dba1805fde Mon Sep 17 00:00:00 2001 From: Praveen Adusumilli <47391951+adusumillipraveen@users.noreply.github.com> Date: Wed, 20 Mar 2019 12:21:28 +0000 Subject: [PATCH] Adding Pod Disruption Budgets (PDB) to Java Chart (#41) * Adding PDB for chart --- README.md | 3 +++ java/Chart.yaml | 2 +- java/templates/pdb.yaml | 16 ++++++++++++++++ java/values.yaml | 3 +++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 java/templates/pdb.yaml diff --git a/README.md b/README.md index b91f8f0..0fd6ef9 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,9 @@ The following table lists the configurable parameters of the Java chart and thei | `secrets` | Mappings of environment variables to service objects or pre-configured kubernetes secrets | nil | | `keyVaults` | Mappings of keyvaults to be mounted as flexvolumes (see Example Configuration) | nil | | `applicationInsightsInstrumentKey` | Instrumentation Key for App Insights , It is mapped to `AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY` as environment variable | `00000000-0000-0000-0000-000000000000` +| `pdb.enabled` | To enable PodDisruptionBudget on the pods for handling disruptions | `true` | +| `pdb.maxUnavailable` | To configure the number of pods from the set that can be unavailable after the eviction. It can be either an absolute number or a percentage. pdb.minAvailable takes precedence over this if not nil | `50%` means evictions are allowed as long as no more than 50% of the desired replicas are unhealthy. It will allow disruption if you have only 1 replica.| +| `pdb.minAvailable` | To configure the number of pods from that set that must still be available after the eviction, even in the absence of the evicted pod. minAvailable can be either an absolute number or a percentage. This takes precedence over pdb.maxUnavailable if not nil. | `nil`| ## Adding Azure Key Vault Secrets Key vault secrets can be mounted to the container filesystem using what's called a [keyvault-flexvolume](https://github.com/Azure/kubernetes-keyvault-flexvol). A flexvolume is just a kubernetes volume from the user point of view. This means that the keyvault secrets are accessible as files after they have been mounted. diff --git a/java/Chart.yaml b/java/Chart.yaml index 530cc21..143619e 100644 --- a/java/Chart.yaml +++ b/java/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: A Helm chart for HMCTS Java Microservices name: java -version: 1.1.1 +version: 1.1.2 icon: https://github.com/hmcts/chart-java/raw/master/images/icons8-java-50.png keywords: - java diff --git a/java/templates/pdb.yaml b/java/templates/pdb.yaml new file mode 100644 index 0000000..c641211 --- /dev/null +++ b/java/templates/pdb.yaml @@ -0,0 +1,16 @@ +{{ if .Values.pdb.enabled }} +--- +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "hmcts.releaseName" . }} +spec: + {{ if .Values.pdb.minAvailable }} + minAvailable: {{ .Values.pdb.minAvailable }} + {{- else -}} + maxUnavailable: {{ .Values.pdb.maxUnavailable }} + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ template "hmcts.releaseName" . }} +{{- end }} diff --git a/java/values.yaml b/java/values.yaml index 9e01d05..6f3452b 100644 --- a/java/values.yaml +++ b/java/values.yaml @@ -18,3 +18,6 @@ livenessPeriod: 15 livenessFailureThreshold: 3 applicationInsightsInstrumentKey: '00000000-0000-0000-0000-000000000000' useInterpodAntiAffinity: false +pdb: + enabled: true + maxUnavailable: 50%