From 8650a93c6f5b83e5a4ce8edbf651f8bddafb4244 Mon Sep 17 00:00:00 2001 From: Joseph Sirianni Date: Thu, 12 Dec 2024 16:12:58 -0500 Subject: [PATCH] feat: Support pod terminationGracePeriodSeconds (#182) * support configurable termination grace period * Add to test deployment --- charts/bindplane/README.md | 6 ++++++ charts/bindplane/templates/bindplane-jobs.yaml | 2 +- charts/bindplane/templates/bindplane-nats.yaml | 2 +- charts/bindplane/templates/bindplane.yaml | 2 +- charts/bindplane/templates/prometheus.yaml | 1 + charts/bindplane/templates/transform-agent.yaml | 2 +- charts/bindplane/values.yaml | 14 ++++++++++++++ test/cases/all/values.yaml | 7 +++++++ 8 files changed, 32 insertions(+), 4 deletions(-) diff --git a/charts/bindplane/README.md b/charts/bindplane/README.md index d5e96bb..c5aa188 100644 --- a/charts/bindplane/README.md +++ b/charts/bindplane/README.md @@ -167,6 +167,12 @@ BindPlane OP is an observability pipeline. | resources.requests.cpu | string | `"1000m"` | CPU request. | | resources.requests.memory | string | `"1000Mi"` | Memory request. | | service.annotations | object | `{}` | Custom annotations which will be added to the service object. Useful for specifying things such as `cloud.google.com/backend-config`. | +| terminationGracePeriodSeconds | object | `{"bindplane":60,"jobs":60,"nats":60,"prometheus":60,"transform_agent":60}` | Configure the terminationGracePeriodSeconds for BindPlane, BindPlane NATS, BindPlane Jobs, and BindPlane Prometheus pods. | +| terminationGracePeriodSeconds.bindplane | int | `60` | This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane deployment pods. | +| terminationGracePeriodSeconds.jobs | int | `60` | This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane Jobs pod. | +| terminationGracePeriodSeconds.nats | int | `60` | This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane NATS statefulset or deployment pods, if NATS is enabled. | +| terminationGracePeriodSeconds.prometheus | int | `60` | This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane Prometheus pod. | +| terminationGracePeriodSeconds.transform_agent | int | `60` | This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane transform agent pod. | | tolerations | object | `{}` | The Pod's tolerations | | topologySpreadConstraints.bindplane | list | `[]` | spec.template.spec.topologySpreadConstraints on the BindPlane deployment pods. | | topologySpreadConstraints.jobs | list | `[]` | This is for configuring spec.template.spec.topologySpreadConstraints on the BindPlane Jobs pod. | diff --git a/charts/bindplane/templates/bindplane-jobs.yaml b/charts/bindplane/templates/bindplane-jobs.yaml index 381bf78..92d814b 100644 --- a/charts/bindplane/templates/bindplane-jobs.yaml +++ b/charts/bindplane/templates/bindplane-jobs.yaml @@ -570,7 +570,7 @@ spec: preStop: exec: command: ["sh", "-c", "sleep 5",] - terminationGracePeriodSeconds: 60 + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds.jobs }} volumes: {{- if eq .Values.eventbus.type "pubsub" }} {{- if .Values.eventbus.pubsub.credentials.secret }} diff --git a/charts/bindplane/templates/bindplane-nats.yaml b/charts/bindplane/templates/bindplane-nats.yaml index 5d43898..50dacc2 100644 --- a/charts/bindplane/templates/bindplane-nats.yaml +++ b/charts/bindplane/templates/bindplane-nats.yaml @@ -433,7 +433,7 @@ spec: preStop: exec: command: ["sh", "-c", "sleep 5",] - terminationGracePeriodSeconds: 60 + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds.nats }} volumes: - name: data emptyDir: {} diff --git a/charts/bindplane/templates/bindplane.yaml b/charts/bindplane/templates/bindplane.yaml index 44af158..977fc2c 100644 --- a/charts/bindplane/templates/bindplane.yaml +++ b/charts/bindplane/templates/bindplane.yaml @@ -625,7 +625,7 @@ spec: name: {{ include "bindplane.fullname" . }}-prometheus-data {{- end }} {{- end }} - terminationGracePeriodSeconds: 60 + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds.bindplane }} volumes: {{- if eq .Values.eventbus.type "pubsub" }} {{- if .Values.eventbus.pubsub.credentials.secret }} diff --git a/charts/bindplane/templates/prometheus.yaml b/charts/bindplane/templates/prometheus.yaml index fcd6956..785cefe 100644 --- a/charts/bindplane/templates/prometheus.yaml +++ b/charts/bindplane/templates/prometheus.yaml @@ -119,6 +119,7 @@ spec: - mountPath: /etc/prometheus/web.yml subPath: web.yml name: config + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds.prometheus }} volumes: - name: config configMap: diff --git a/charts/bindplane/templates/transform-agent.yaml b/charts/bindplane/templates/transform-agent.yaml index a90bbc4..7ab13b4 100644 --- a/charts/bindplane/templates/transform-agent.yaml +++ b/charts/bindplane/templates/transform-agent.yaml @@ -74,4 +74,4 @@ spec: securityContext: {{- toYaml . | nindent 12 }} {{- end }} - terminationGracePeriodSeconds: 60 + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds.transform_agent }} diff --git a/charts/bindplane/values.yaml b/charts/bindplane/values.yaml index cbcbdea..94dce35 100644 --- a/charts/bindplane/values.yaml +++ b/charts/bindplane/values.yaml @@ -461,6 +461,20 @@ priorityClassName: # -- This is for configuring spec.template.spec.priorityClassName on the BindPlane transform agent pod. transform_agent: "" +# -- Configure the terminationGracePeriodSeconds for BindPlane, BindPlane NATS, BindPlane Jobs, and BindPlane Prometheus pods. +terminationGracePeriodSeconds: + # -- This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane deployment pods. + bindplane: 60 + # -- This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane NATS statefulset or deployment + # pods, if NATS is enabled. + nats: 60 + # -- This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane Jobs pod. + jobs: 60 + # -- This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane Prometheus pod. + prometheus: 60 + # -- This is for configuring spec.template.spec.terminationGracePeriodSeconds on the BindPlane transform agent pod. + transform_agent: 60 + # -- Configure the nodeSelector for BindPlane, BindPlane NATS, BindPlane Jobs, and BindPlane Prometheus pods. nodeSelector: # -- This is for configuring spec.template.spec.nodeSelector on the BindPlane deployment pod when using the bbolt backend. diff --git a/test/cases/all/values.yaml b/test/cases/all/values.yaml index 61530ba..c48a137 100644 --- a/test/cases/all/values.yaml +++ b/test/cases/all/values.yaml @@ -179,3 +179,10 @@ priorityClassName: jobs: "high-priority" prometheus: "high-priority" transform_agent: "high-priority" + +terminationGracePeriodSeconds: + bindplane: 30 + nats: 31 + jobs: 32 + prometheus: 33 + transform_agent: 34