mirror of
https://github.com/bitnami/charts.git
synced 2026-03-06 06:58:50 +08:00
145 lines
4.8 KiB
YAML
145 lines
4.8 KiB
YAML
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "node.fullname" . }}
|
|
labels:
|
|
app: {{ template "node.name" . }}
|
|
chart: {{ template "node.chart" . }}
|
|
release: "{{ .Release.Name }}"
|
|
heritage: "{{ .Release.Service }}"
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: {{ template "node.name" . }}
|
|
release: "{{ .Release.Name }}"
|
|
replicas: {{ .Values.replicas }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ template "node.name" . }}
|
|
chart: {{ template "node.chart" . }}
|
|
release: {{ .Release.Name | quote }}
|
|
heritage: "{{ .Release.Service }}"
|
|
spec:
|
|
{{- if .Values.image.pullSecrets }}
|
|
imagePullSecrets:
|
|
{{- range .Values.image.pullSecrets }}
|
|
- name: {{ . }}
|
|
{{- end}}
|
|
{{- end }}
|
|
initContainers:
|
|
- name: git-clone-repository
|
|
image: "{{ .Values.gitImage.registry }}/{{ .Values.gitImage.repository }}:{{ .Values.gitImage.tag }}"
|
|
imagePullPolicy: {{ .Values.gitImage.pullPolicy | quote }}
|
|
command: [ '/bin/sh', '-c' , 'git clone {{ .Values.repository }} /app && cd /app && git checkout {{ .Values.revision }}']
|
|
volumeMounts:
|
|
- name: app
|
|
mountPath: /app
|
|
- name: npm-install
|
|
image: "{{ template "node.image" . }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
workingDir: /app
|
|
command: ['/bin/bash', '-c', 'useradd bitnami && chown -R bitnami:bitnami /app && npm install']
|
|
volumeMounts:
|
|
- name: app
|
|
mountPath: /app
|
|
containers:
|
|
- name: {{ template "node.fullname" . }}
|
|
image: "{{ template "node.image" . }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
env:
|
|
{{- if .Values.mongodb.install }}
|
|
- name: DATABASE_HOST
|
|
value: {{ template "node.mongodb.fullname" . }}
|
|
- name: DATABASE_PORT
|
|
value: "27017"
|
|
- name: DATABASE_USER
|
|
value: {{ .Values.mongodb.mongodbUsername | quote }}
|
|
- name: DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.mongodb.fullname" . }}
|
|
key: mongodb-password
|
|
- name: DATABASE_NAME
|
|
value: {{ .Values.mongodb.mongodbDatabase | quote }}
|
|
- name: DATABASE_CONNECTION_OPTIONS
|
|
value: ""
|
|
{{ else }}
|
|
{{- $type := dict "type" .Values.externaldb.type }}
|
|
- name: DATABASE_HOST
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: {{ template "externaldb.host" $type }}
|
|
{{- if not .Values.externaldb.broker.serviceInstanceName }}
|
|
- name: DATABASE_NAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: database
|
|
{{ else }}
|
|
- name: DATABASE_NAME
|
|
value: ""
|
|
{{- end }}
|
|
- name: DATABASE_PORT
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: {{ template "externaldb.port" $type }}
|
|
- name: DATABASE_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: {{ template "externaldb.username" $type }}
|
|
- name: DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ template "node.secretName" . }}
|
|
key: {{ template "externaldb.password" $type }}
|
|
{{- if .Values.externaldb.ssl }}
|
|
- name: DATABASE_CONNECTION_OPTIONS
|
|
value: "ssl=true"
|
|
{{ else }}
|
|
- name: DATABASE_CONNECTION_OPTIONS
|
|
value: ""
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: DATA_FOLDER
|
|
value: "/app"
|
|
workingDir: /app
|
|
command: ['/bin/bash', '-c', 'useradd bitnami && su bitnami -c "PATH=/opt/bitnami/node/bin:$PATH npm start"']
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.applicationPort }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
initialDelaySeconds: 60
|
|
timeoutSeconds: 5
|
|
failureThreshold: 6
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
initialDelaySeconds: 10
|
|
timeoutSeconds: 3
|
|
periodSeconds: 5
|
|
resources:
|
|
{{ toYaml .Values.resources | indent 10 }}
|
|
volumeMounts:
|
|
- name: app
|
|
mountPath: /app
|
|
- name: data
|
|
mountPath: {{ .Values.persistence.path }}
|
|
volumes:
|
|
- name: app
|
|
emptyDir: {}
|
|
- name: data
|
|
{{- if .Values.persistence.enabled }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ template "fullname" . }}
|
|
{{- else }}
|
|
emptyDir: {}
|
|
{{- end }}
|