From aa6edcd20dc2fd823c97970eed76d9a1b1beec46 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Fri, 23 Jun 2023 15:56:15 +0200 Subject: [PATCH 1/2] Add initContainers and container command to common chart --- charts/common/Chart.yaml | 2 +- charts/common/templates/deployment.yaml | 9 ++++ charts/common/values.yaml | 62 ++++++++++++++++--------- 3 files changed, 51 insertions(+), 22 deletions(-) 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..90231293 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,12 +42,20 @@ 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/ ## serviceAccount: create: true - annotations: {} + annotations: + {} ## uncomment if you're using workload indentity ## # iam.gke.io/gcp-service-account: 'mysa@gcp-project-id.iam.gserviceaccount.com' @@ -61,12 +73,14 @@ podAnnotations: {} ## This defaults to non root user with uid 1000 and gid 1000. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## -podSecurityContext: {} +podSecurityContext: + {} # fsGroup: 1000 # runAsNonRoot: true # runAsUser: 1000 # runAsGroup: 1000 -containerSecurityContext: {} +containerSecurityContext: + {} # capabilities: # drop: # - ALL @@ -77,7 +91,8 @@ containerSecurityContext: {} ## Environment variable to add to the pods ## -env: {} +env: + {} # VAR: "value" # VAR2: # valueFrom: @@ -93,7 +108,6 @@ envFrom: [] # - secretRef: # name: env-secret - ## Additional Pod Spec ## additionalPodSpec: {} @@ -133,7 +147,8 @@ service: ingress: enabled: false className: "" - annotations: {} + annotations: + {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" hosts: @@ -142,13 +157,14 @@ ingress: - path: / pathType: ImplementationSpecific tls: - - secretName: chart-example-tls - hosts: - - chart-example.local + - secretName: chart-example-tls + hosts: + - chart-example.local ## Resource limits & requests ## -resources: {} +resources: + {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following @@ -175,7 +191,8 @@ affinity: {} ## Controller Container liveness/readiness probe configuration ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ ## -livenessProbe: {} +livenessProbe: + {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -184,7 +201,8 @@ livenessProbe: {} # port: 80 # periodSeconds: 10 -readinessProbe: {} +readinessProbe: + {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -193,7 +211,8 @@ readinessProbe: {} # port: 80 # periodSeconds: 10 -startupProbe: {} +startupProbe: + {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -212,7 +231,7 @@ stateful: persistence: enabled: false accessModes: - - ReadWriteOnce + - ReadWriteOnce size: 50Gi annotations: {} # selector: @@ -224,7 +243,8 @@ persistence: ## See `kubectl explain poddisruptionbudget.spec` for more ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ -podDisruptionBudget: {} +podDisruptionBudget: + {} # minAvailable: 1 # maxUnavailable: 1 @@ -248,12 +268,12 @@ serviceMonitor: ## List of endpoints of service which Prometheus scrapes ## endpoints: - - path: /metrics - port: http - interval: 1m - scheme: http - scrapeTimeout: 30s - honorLabels: true + - path: /metrics + port: http + interval: 1m + scheme: http + scrapeTimeout: 30s + honorLabels: true ## Propagate certain service labels to Prometheus. targetLabels: [] From 1c4385b61e0dd17056d2703db774c409e28f1edb Mon Sep 17 00:00:00 2001 From: alvicsam Date: Fri, 23 Jun 2023 15:58:13 +0200 Subject: [PATCH 2/2] revert autolint --- charts/common/values.yaml | 51 ++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/charts/common/values.yaml b/charts/common/values.yaml index 90231293..83fc3aca 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -54,8 +54,7 @@ imagePullSecrets: [] ## serviceAccount: create: true - annotations: - {} + annotations: {} ## uncomment if you're using workload indentity ## # iam.gke.io/gcp-service-account: 'mysa@gcp-project-id.iam.gserviceaccount.com' @@ -73,14 +72,12 @@ podAnnotations: {} ## This defaults to non root user with uid 1000 and gid 1000. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ ## -podSecurityContext: - {} +podSecurityContext: {} # fsGroup: 1000 # runAsNonRoot: true # runAsUser: 1000 # runAsGroup: 1000 -containerSecurityContext: - {} +containerSecurityContext: {} # capabilities: # drop: # - ALL @@ -91,8 +88,7 @@ containerSecurityContext: ## Environment variable to add to the pods ## -env: - {} +env: {} # VAR: "value" # VAR2: # valueFrom: @@ -108,6 +104,7 @@ envFrom: [] # - secretRef: # name: env-secret + ## Additional Pod Spec ## additionalPodSpec: {} @@ -147,8 +144,7 @@ service: ingress: enabled: false className: "" - annotations: - {} + annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" hosts: @@ -157,14 +153,13 @@ ingress: - path: / pathType: ImplementationSpecific tls: - - secretName: chart-example-tls - hosts: - - chart-example.local + - secretName: chart-example-tls + hosts: + - chart-example.local ## Resource limits & requests ## -resources: - {} +resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following @@ -191,8 +186,7 @@ affinity: {} ## Controller Container liveness/readiness probe configuration ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ ## -livenessProbe: - {} +livenessProbe: {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -201,8 +195,7 @@ livenessProbe: # port: 80 # periodSeconds: 10 -readinessProbe: - {} +readinessProbe: {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -211,8 +204,7 @@ readinessProbe: # port: 80 # periodSeconds: 10 -startupProbe: - {} +startupProbe: {} # failureThreshold: 3 # successThreshold: 1 # initialDelaySeconds: 0 @@ -231,7 +223,7 @@ stateful: persistence: enabled: false accessModes: - - ReadWriteOnce + - ReadWriteOnce size: 50Gi annotations: {} # selector: @@ -243,8 +235,7 @@ persistence: ## See `kubectl explain poddisruptionbudget.spec` for more ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ -podDisruptionBudget: - {} +podDisruptionBudget: {} # minAvailable: 1 # maxUnavailable: 1 @@ -268,12 +259,12 @@ serviceMonitor: ## List of endpoints of service which Prometheus scrapes ## endpoints: - - path: /metrics - port: http - interval: 1m - scheme: http - scrapeTimeout: 30s - honorLabels: true + - path: /metrics + port: http + interval: 1m + scheme: http + scrapeTimeout: 30s + honorLabels: true ## Propagate certain service labels to Prometheus. targetLabels: []