71 lines
2.3 KiB
YAML
71 lines
2.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
namespace: {{ .Values.global.namespace }}
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
component: frontend
|
|
spec:
|
|
replicas: {{ .Values.frontend.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
component: frontend
|
|
spec:
|
|
initContainers:
|
|
- name: wait-for-backend
|
|
image: busybox:1.35
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
echo "Waiting for backend to be ready..."
|
|
until wget -q -O- http://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.service.port }}/health > /dev/null 2>&1; do
|
|
echo "Backend not ready, waiting..."
|
|
sleep 2
|
|
done
|
|
echo "Backend is ready!"
|
|
containers:
|
|
- name: {{ .Values.frontend.name }}
|
|
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
|
|
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
|
|
ports:
|
|
- containerPort: {{ .Values.frontend.service.targetPort }}
|
|
name: http
|
|
protocol: TCP
|
|
{{- with .Values.frontend.env }}
|
|
env:
|
|
{{- range $key, $value := . }}
|
|
- name: {{ $key }}
|
|
value: {{ $value | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 2
|
|
resources:
|
|
requests:
|
|
cpu: {{ .Values.frontend.resources.requests.cpu }}
|
|
memory: {{ .Values.frontend.resources.requests.memory }}
|
|
limits:
|
|
cpu: {{ .Values.frontend.resources.limits.cpu }}
|
|
memory: {{ .Values.frontend.resources.limits.memory }}
|