71 lines
2.5 KiB
YAML
71 lines
2.5 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:
|
|
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
|
|
{{- /* compute API_BASE: prefer frontend.env.API_BASE, else use first ingress host */}}
|
|
{{- $apiBase := "" }}
|
|
{{- if .Values.frontend.env.API_BASE }}
|
|
{{- $apiBase = .Values.frontend.env.API_BASE }}
|
|
{{- else if .Values.ingress.hosts }}
|
|
{{- $firstHost := index .Values.ingress.hosts 0 }}
|
|
{{- $apiBase = printf "https://%s/api" $firstHost.host }}
|
|
{{- end }}
|
|
env:
|
|
- name: API_BASE
|
|
value: {{ $apiBase | quote }}
|
|
{{- /* include any other env vars provided in values.frontend.env (skip API_BASE to avoid duplicate) */}}
|
|
{{- with .Values.frontend.env }}
|
|
{{- range $key, $value := . }}
|
|
{{- if ne $key "API_BASE" }}
|
|
- name: {{ $key }}
|
|
value: {{ $value | quote }}
|
|
{{- end }}
|
|
{{- 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 }}
|