From 3f3c2a8749179633f378394db4d4bd18fba80337 Mon Sep 17 00:00:00 2001 From: Joseph Sirianni Date: Tue, 17 Dec 2024 16:44:06 -0500 Subject: [PATCH] feat: Optional arbitrary init containers (#192) * feat: Optional arbitrary init containers * Regen docs * fix jobs pod --- charts/bindplane/Chart.yaml | 2 +- charts/bindplane/README.md | 3 ++- .../bindplane/templates/bindplane-jobs.yaml | 7 ++++-- .../bindplane/templates/bindplane-nats.yaml | 4 ++++ charts/bindplane/templates/bindplane.yaml | 3 +++ charts/bindplane/templates/prometheus.yaml | 4 ++++ .../bindplane/templates/transform-agent.yaml | 4 ++++ charts/bindplane/values.yaml | 8 +++++++ test/cases/nats/values.yaml | 22 +++++++++++++++++++ 9 files changed, 53 insertions(+), 4 deletions(-) diff --git a/charts/bindplane/Chart.yaml b/charts/bindplane/Chart.yaml index f3549f3..d1e1cb6 100644 --- a/charts/bindplane/Chart.yaml +++ b/charts/bindplane/Chart.yaml @@ -3,7 +3,7 @@ name: bindplane description: BindPlane OP is an observability pipeline. type: application # The chart's version -version: 1.23.1 +version: 1.24.0 # The BindPlane OP tagged release. If the user does not # set the `image.tag` values option, this version is used. appVersion: 1.84.0 diff --git a/charts/bindplane/README.md b/charts/bindplane/README.md index 716135e..6986ec9 100644 --- a/charts/bindplane/README.md +++ b/charts/bindplane/README.md @@ -1,6 +1,6 @@ # bindplane -![Version: 1.23.1](https://img.shields.io/badge/Version-1.23.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.84.0](https://img.shields.io/badge/AppVersion-1.84.0-informational?style=flat-square) +![Version: 1.24.0](https://img.shields.io/badge/Version-1.24.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.84.0](https://img.shields.io/badge/AppVersion-1.84.0-informational?style=flat-square) BindPlane OP is an observability pipeline. @@ -97,6 +97,7 @@ BindPlane OP is an observability pipeline. | eventbus.pubsub.topic | string | `""` | | | eventbus.type | string | `""` | | | extraEnv | list | `[]` | Optional arbitrary environment variables to add to the BindPlane pod(s). | +| extraInitContainers | object | `{"bindplane":[],"jobs":[],"nats":[],"prometheus":[],"transform_agent":[]}` | Optional arbitrary init containers. | | extraPodLabels | object | `{}` | Optional arbitrary labels to add to the BindPlane pod(s). | | extraVolumeMounts | list | `[]` | Optional arbitrary volume mounts to add to the BindPlane pod(s). | | extraVolumes | list | `[]` | Optional arbitrary volumes to add to the BindPlane pod(s). | diff --git a/charts/bindplane/templates/bindplane-jobs.yaml b/charts/bindplane/templates/bindplane-jobs.yaml index f9670ed..c291125 100644 --- a/charts/bindplane/templates/bindplane-jobs.yaml +++ b/charts/bindplane/templates/bindplane-jobs.yaml @@ -59,8 +59,8 @@ spec: topologySpreadConstraints: {{- toYaml .Values.topologySpreadConstraints.jobs | nindent 8 }} {{- end }} - {{- if .Values.backend.postgres.sslsecret.name }} initContainers: + {{- if .Values.backend.postgres.sslsecret.name }} - name: postgres-tls image: {{ .Values.busybox_image }} command: @@ -88,7 +88,10 @@ spec: subPath: {{ .Values.backend.postgres.sslsecret.sslkeySubPath }} {{- end }} {{- end }} - {{- end }} + {{- end }} + {{- if .Values.extraInitContainers.jobs }} + {{- toYaml .Values.extraInitContainers.jobs | nindent 8 }} + {{- end }} containers: - name: server image: {{ include "bindplane.image" . }}:{{ include "bindplane.tag" . }} diff --git a/charts/bindplane/templates/bindplane-nats.yaml b/charts/bindplane/templates/bindplane-nats.yaml index 50dacc2..df17159 100644 --- a/charts/bindplane/templates/bindplane-nats.yaml +++ b/charts/bindplane/templates/bindplane-nats.yaml @@ -63,6 +63,10 @@ spec: topologySpreadConstraints: {{- toYaml .Values.topologySpreadConstraints.nats | nindent 8 }} {{- end }} + initContainers: + {{- if .Values.extraInitContainers.nats }} + {{- toYaml .Values.extraInitContainers.nats | nindent 8 }} + {{- end }} containers: - name: server image: {{ include "bindplane.image" . }}:{{ include "bindplane.tag" . }} diff --git a/charts/bindplane/templates/bindplane.yaml b/charts/bindplane/templates/bindplane.yaml index 036a654..909047b 100644 --- a/charts/bindplane/templates/bindplane.yaml +++ b/charts/bindplane/templates/bindplane.yaml @@ -114,6 +114,9 @@ spec: {{- end }} {{- end }} {{- end }} + {{- if .Values.extraInitContainers.bindplane }} + {{- toYaml .Values.extraInitContainers.bindplane | nindent 8 }} + {{- end }} containers: - name: server image: {{ include "bindplane.image" . }}:{{ include "bindplane.tag" . }} diff --git a/charts/bindplane/templates/prometheus.yaml b/charts/bindplane/templates/prometheus.yaml index 785cefe..b534320 100644 --- a/charts/bindplane/templates/prometheus.yaml +++ b/charts/bindplane/templates/prometheus.yaml @@ -79,6 +79,10 @@ spec: topologySpreadConstraints: {{- toYaml .Values.topologySpreadConstraints.prometheus | nindent 8 }} {{- end }} + initContainers: + {{- if .Values.extraInitContainers.prometheus }} + {{- toYaml .Values.extraInitContainers.prometheus | nindent 8 }} + {{- end }} containers: - name: prometheus image: {{ .Values.prometheus.image.name }}:{{ .Values.prometheus.image.tag }} diff --git a/charts/bindplane/templates/transform-agent.yaml b/charts/bindplane/templates/transform-agent.yaml index 7ab13b4..5ddb69a 100644 --- a/charts/bindplane/templates/transform-agent.yaml +++ b/charts/bindplane/templates/transform-agent.yaml @@ -47,6 +47,10 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + initContainers: + {{- if .Values.extraInitContainers.transform_agent }} + {{- toYaml .Values.extraInitContainers.transform_agent | nindent 8 }} + {{- end }} containers: - name: transform-agent image: {{ include "bindplane.transform_agent" . }}:{{ include "bindplane.transform_agent_tag" . }} diff --git a/charts/bindplane/values.yaml b/charts/bindplane/values.yaml index 94dce35..4ffeb0e 100644 --- a/charts/bindplane/values.yaml +++ b/charts/bindplane/values.yaml @@ -595,3 +595,11 @@ extraEnv: [] # -- The container image to use for the busybox init container. busybox_image: busybox:latest + +# -- Optional arbitrary init containers. +extraInitContainers: + bindplane: [] + nats: [] + jobs: [] + prometheus: [] + transform_agent: [] diff --git a/test/cases/nats/values.yaml b/test/cases/nats/values.yaml index faa8c53..6872c85 100644 --- a/test/cases/nats/values.yaml +++ b/test/cases/nats/values.yaml @@ -53,3 +53,25 @@ nats: metrics: type: prometheus + +extraInitContainers: + bindplane: + - name: busy-box-test-bindplane + image: busybox:latest + command: ['sh', '-c', 'echo hello'] + nats: + - name: busy-box-test-nats + image: busybox:latest + command: ['sh', '-c', 'echo hello'] + jobs: + - name: busy-box-test-jobs + image: busybox:latest + command: ['sh', '-c', 'echo hello'] + prometheus: + - name: busy-box-test-prometheus + image: busybox:latest + command: ['sh', '-c', 'echo hello'] + transform_agent: + - name: busy-box-test-transform-agent + image: busybox:latest + command: ['sh', '-c', 'echo hello']