From 34c4601d86ffa05f7d1803d98c7b6fabb2cb0dc1 Mon Sep 17 00:00:00 2001 From: Matt W <768067+diranged@users.noreply.github.com> Date: Fri, 23 Apr 2021 09:58:31 -0700 Subject: [PATCH] [simple-app] Introduce an optional PodDisruptionBudget resource (#7) --- charts/simple-app/Chart.yaml | 2 +- charts/simple-app/README.md | 3 ++- .../simple-app/templates/poddisruptionbudget.yaml | 13 +++++++++++++ charts/simple-app/values.yaml | 3 +++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 charts/simple-app/templates/poddisruptionbudget.yaml diff --git a/charts/simple-app/Chart.yaml b/charts/simple-app/Chart.yaml index 2ff0fb2a..a037b612 100644 --- a/charts/simple-app/Chart.yaml +++ b/charts/simple-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: simple-app description: Default Microservice Helm Chart type: application -version: 0.2.2 +version: 0.3.0 appVersion: latest maintainers: - name: diranged diff --git a/charts/simple-app/README.md b/charts/simple-app/README.md index bf36de29..98dffe5f 100644 --- a/charts/simple-app/README.md +++ b/charts/simple-app/README.md @@ -2,7 +2,7 @@ Default Microservice Helm Chart -![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) [deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ [hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ @@ -44,6 +44,7 @@ defaults for you like the Kubernetes [Horizontal Pod Autoscaler][hpa]. | nameOverride | string | `""` | | | nodeSelector | object | `{}` | | | podAnnotations | object | `{}` | | +| podDisruptionBudget | object | `{}` | Set up a PodDisruptionBudget for the Deployment | | podSecurityContext | object | `{}` | | | ports | list | `[{"containerPort":80,"name":"http","protocol":"TCP"},{"containerPort":443,"name":"https","protocol":"TCP"}]` | A list of Port objects that are exposed by the service. These ports are applied to the main container, or the proxySidecar container (if enabled). The port list is also used to generate Network Policies that allow ingress into the pods. | | proxySidecar.enabled | bool | `false` | (Boolean) Enables injecting a pre-defined reverse proxy sidecar container into the Pod containers list. | diff --git a/charts/simple-app/templates/poddisruptionbudget.yaml b/charts/simple-app/templates/poddisruptionbudget.yaml new file mode 100644 index 00000000..a1ee49cb --- /dev/null +++ b/charts/simple-app/templates/poddisruptionbudget.yaml @@ -0,0 +1,13 @@ +{{- if .Values.podDisruptionBudget -}} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "simple-app.fullname" . }} + labels: + {{- include "simple-app.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "simple-app.selectorLabels" . | nindent 8 }} + {{ toYaml .Values.podDisruptionBudget | nindent 2 }} +{{- end }} diff --git a/charts/simple-app/values.yaml b/charts/simple-app/values.yaml index 6fce6006..f3b712e3 100644 --- a/charts/simple-app/values.yaml +++ b/charts/simple-app/values.yaml @@ -1,6 +1,9 @@ # -- The number of Pods to start up by default replicaCount: 1 +# -- Set up a PodDisruptionBudget for the Deployment +podDisruptionBudget: {} + image: # -- (String) The Docker image name and repository for your application repository: nginx