mirror of
https://github.com/bitnami/charts.git
synced 2026-03-02 08:05:03 +08:00
249 lines
11 KiB
YAML
249 lines
11 KiB
YAML
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "common.names.fullname" . }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
template:
|
|
metadata:
|
|
{{- if .Values.podAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
{{- if .Values.podLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- include "node.imagePullSecrets" . | nindent 6 }}
|
|
{{- if .Values.hostAliases }}
|
|
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.priorityClassName }}
|
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.podSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
initContainers:
|
|
{{- if .Values.getAppFromExternalRepository }}
|
|
- name: git-clone-repository
|
|
image: {{ include "git.image" . }}
|
|
imagePullPolicy: {{ .Values.git.image.pullPolicy | quote }}
|
|
command:
|
|
- /bin/bash
|
|
- -ec
|
|
- |
|
|
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
|
|
git clone {{ .Values.repository }} --branch {{ .Values.revision }} /app
|
|
volumeMounts:
|
|
- name: app
|
|
mountPath: /app
|
|
{{- if .Values.git.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.git.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
- name: npm-install
|
|
image: {{ template "node.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
workingDir: /app
|
|
command:
|
|
- /bin/bash
|
|
- -ec
|
|
- |
|
|
npm install
|
|
env:
|
|
- name: HOME
|
|
value: /tmp
|
|
volumeMounts:
|
|
- name: app
|
|
mountPath: /app
|
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
|
- name: volume-permissions
|
|
image: {{ include "node.volumePermissions.image" . }}
|
|
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
|
{{- if .Values.lifecycleHooks }}
|
|
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
command:
|
|
- /bin/bash
|
|
- -ec
|
|
- |
|
|
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.path }}
|
|
securityContext:
|
|
runAsUser: 0
|
|
{{- if .Values.volumePermissions.resources }}
|
|
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: {{ .Values.persistence.path }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.initContainers }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: node
|
|
image: {{ template "node.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
env:
|
|
{{- if .Values.mongodb.enabled }}
|
|
- name: DATABASE_HOST
|
|
value: {{ template "node.mongodb.fullname" . }}
|
|
- name: DATABASE_PORT
|
|
value: "27017"
|
|
- name: DATABASE_USER
|
|
value: {{ .Values.mongodb.auth.username | quote }}
|
|
- name: DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.mongodb.fullname" . }}
|
|
key: mongodb-password
|
|
- name: DATABASE_NAME
|
|
value: {{ .Values.mongodb.auth.database | quote }}
|
|
- name: DATABASE_CONNECTION_OPTIONS
|
|
value: ""
|
|
{{- else if .Values.externaldb.enabled }}
|
|
- name: DATABASE_HOST
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: host
|
|
- name: DATABASE_NAME
|
|
{{- if not .Values.externaldb.broker.serviceInstanceName }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: database
|
|
{{- else }}
|
|
value: ""
|
|
{{- end }}
|
|
- name: DATABASE_PORT
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: port
|
|
- name: DATABASE_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: username
|
|
- name: DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: password
|
|
- name: DATABASE_CONNECTION_OPTIONS
|
|
{{- if .Values.externaldb.ssl }}
|
|
value: "ssl=true"
|
|
{{- else }}
|
|
value: ""
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: DATA_FOLDER
|
|
value: "/app"
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
workingDir: /app
|
|
{{- if .Values.command }}
|
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.args }}
|
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.applicationPort }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: {{ .Values.livenessProbe.path }}
|
|
port: http
|
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
|
{{- else if .Values.customLivenessProbe }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
httpGet:
|
|
path: {{ .Values.readinessProbe.path }}
|
|
port: http
|
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
|
{{- else if .Values.customReadinessProbe }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.resources }}
|
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- if .Values.getAppFromExternalRepository }}
|
|
- name: app
|
|
mountPath: /app
|
|
{{- end }}
|
|
- name: data
|
|
mountPath: {{ .Values.persistence.path }}
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.sidecars }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
{{- if .Values.getAppFromExternalRepository }}
|
|
- name: app
|
|
emptyDir: {}
|
|
{{- end }}
|
|
- name: data
|
|
{{- if .Values.persistence.enabled }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ template "common.names.fullname" . }}-binding
|
|
{{- else }}
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- if .Values.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }}
|