Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MahdiKarimipour/b12be2dc9a982bd00de5370f8fb21615 to your computer and use it in GitHub Desktop.
Save MahdiKarimipour/b12be2dc9a982bd00de5370f8fb21615 to your computer and use it in GitHub Desktop.
Complete Deployment Helm Chart with with Secret Volumes
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ecosystem-identity-api.fullname" . }}
labels:
{{- include "ecosystem-identity-api.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "ecosystem-identity-api.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ecosystem-identity-api.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ecosystem-identity-api.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
volumeMounts:
{{ range $k, $v := .Values.volumeMounts }}
- name: {{ $v.name | quote }}
mountPath: {{ $v.mountPath | quote }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{ range $k, $v := .Values.env }}
- name: {{ $v.name | quote }}
value: {{ $v.value | quote }}
{{- end }}
{{ range $k, $v := .Values.global.envValuesFrom }}
- name: {{ $v | quote }}
valueFrom:
fieldRef:
fieldPath: {{ $v | quote }}
{{- end }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /health/live
port: http
readinessProbe:
httpGet:
path: /health/ready
port: http
startupProbe:
httpGet:
path: /health/startup
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
{{ range $k, $v := .Values.volumes }}
- name: {{ $v.name | quote }}
{{ if $v.secretRef }}
secret:
secretName: {{ $v.secretRef | quote }}
{{- end }}
{{ if $v.csiSecretProviderClass }}
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: {{ $v.csiSecretProviderClass }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment