From 952bff7e6e4806446304fb42291d11faf08620ac Mon Sep 17 00:00:00 2001 From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:39:21 +0200 Subject: [PATCH] Add initContainers and container command to common chart (#260) * Add initContainers and container command to common chart * revert autolint --- charts/common/Chart.yaml | 2 +- charts/common/templates/deployment.yaml | 9 +++++++++ charts/common/values.yaml | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 9737d8df..67e4f26c 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: common description: A generic helm chart for Kubernetes type: application -version: 0.6.6 +version: 0.6.7 maintainers: - name: Parity url: https://github.com/paritytech/helm-charts diff --git a/charts/common/templates/deployment.yaml b/charts/common/templates/deployment.yaml index 73f826e8..ae00e491 100644 --- a/charts/common/templates/deployment.yaml +++ b/charts/common/templates/deployment.yaml @@ -40,12 +40,21 @@ spec: serviceAccountName: {{ include "common.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.initContainers}} + initContainers: + - name: {{ .Values.initContainers.name }} + image: {{ .Values.initContainers.image }} + command: {{ .Values.initContainers.command }} + {{- end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.command }} + command: {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.args }} args: {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/common/values.yaml b/charts/common/values.yaml index a997e7cf..83fc3aca 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -29,6 +29,10 @@ image: ## args: [] +## Override default container command +## +command: [] + ## Number of replicas for the pod ## replicaCount: 1 @@ -38,6 +42,13 @@ replicaCount: 1 ## imagePullSecrets: [] +## Define init container +## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ +# initContainers: +# - name: init-container +# image: busybox:1.28 +# command: ['sh', '-c', "sleep 30"] + ## Service account for the pod to use ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ ##