From 0d1352a60512c8649c9bd9dcb54b09ac6a0c7562 Mon Sep 17 00:00:00 2001 From: Claudio Poli Date: Tue, 21 Jan 2025 12:34:49 +0100 Subject: [PATCH] feat(nextjs): add support for initContainers in Helm chart to allow pre-startup tasks chore(nextjs): bump chart version from 1.1.5 to 1.1.6 to reflect new feature addition --- charts/nextjs/Chart.yaml | 2 +- charts/nextjs/templates/web-deployment.yaml | 4 ++++ charts/nextjs/values.yaml | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/charts/nextjs/Chart.yaml b/charts/nextjs/Chart.yaml index 631dc31..7ea2abd 100644 --- a/charts/nextjs/Chart.yaml +++ b/charts/nextjs/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: nextjs description: Generic Helm chart for Nextjs apps on Kubernetes type: application -version: 1.1.5 +version: 1.1.6 appVersion: '1.0.0' icon: https://icoretech.github.io/helm/charts/nextjs/logo.png keywords: diff --git a/charts/nextjs/templates/web-deployment.yaml b/charts/nextjs/templates/web-deployment.yaml index 8fee5da..0013133 100644 --- a/charts/nextjs/templates/web-deployment.yaml +++ b/charts/nextjs/templates/web-deployment.yaml @@ -29,6 +29,10 @@ spec: imagePullSecrets: - name: {{ .Values.web.imagePullSecrets }} {{- end }} + {{- if .Values.web.initContainers }} + initContainers: + {{ toYaml .Values.web.initContainers | nindent 8 }} + {{- end }} containers: - name: {{ include "app.web.name" . }} image: "{{ .Values.web.image }}" diff --git a/charts/nextjs/values.yaml b/charts/nextjs/values.yaml index 94b6023..95f0295 100644 --- a/charts/nextjs/values.yaml +++ b/charts/nextjs/values.yaml @@ -14,6 +14,22 @@ web: maxUnavailable: 0 maxSurge: 1 + # optional array of additional initcontainers + initContainers: [] + # Example usage: + # initContainers: + # - name: init-mydb + # image: busybox:1.36 + # command: ["/bin/sh"] + # args: ["-c", "echo Setting up DB; sleep 5"] + # volumeMounts: + # - name: next-data + # mountPath: /data + # - name: wait-for-service + # image: busybox:1.36 + # command: ["/bin/sh"] + # args: ["-c", "until nc -z some-service 5432; do sleep 3; done"] + # optional array of additional containers extraContainers: [] # Example usage: