d3bbc0c0a0
Build and Deploy Platform / build-and-deploy (push) Successful in 14m57s
User-app builds no longer pull gcr.io/docker.io directly when build.images is configured in values.yaml, fixing ImagePullBackOff on clusters without upstream registry access. Co-authored-by: Cursor <cursoragent@cursor.com>
143 lines
5.0 KiB
YAML
143 lines
5.0 KiB
YAML
{{- if .Values.backend.enabled }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "cloudhost-platform.backend.fullname" . }}
|
|
namespace: {{ include "cloudhost-platform.namespace" . }}
|
|
labels:
|
|
app: {{ include "cloudhost-platform.backend.fullname" . }}
|
|
{{- include "cloudhost-platform.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.backend.replicas }}
|
|
# Zero-downtime rollouts: DB migrations run in a pre-upgrade hook Job, so the
|
|
# new pod only starts against a ready schema. The uploads PVC is RWO but
|
|
# local-path volumes pin pods to the same node, so surge pods can attach.
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
selector:
|
|
matchLabels:
|
|
app: {{ include "cloudhost-platform.backend.fullname" . }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ include "cloudhost-platform.backend.fullname" . }}
|
|
spec:
|
|
{{- with .Values.backend.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
initContainers:
|
|
{{- if .Values.postgres.enabled }}
|
|
- name: wait-postgres
|
|
image: {{ .Values.images.busybox | quote }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
until nc -z {{ include "cloudhost-platform.postgres.fullname" . }} 5432; do
|
|
echo "waiting for postgres..."
|
|
sleep 2
|
|
done
|
|
{{- end }}
|
|
{{- if .Values.redis.enabled }}
|
|
- name: wait-redis
|
|
image: {{ .Values.images.busybox | quote }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
until nc -z {{ include "cloudhost-platform.redis.fullname" . }} 6379; do
|
|
echo "waiting for redis..."
|
|
sleep 2
|
|
done
|
|
{{- end }}
|
|
containers:
|
|
- name: backend
|
|
image: {{ include "cloudhost-platform.backendImage" . | quote }}
|
|
imagePullPolicy: {{ .Values.images.backend.pullPolicy }}
|
|
ports:
|
|
- containerPort: 4000
|
|
env:
|
|
- name: DB_HOST
|
|
value: {{ include "cloudhost-platform.postgres.fullname" . }}
|
|
- name: DB_PORT
|
|
value: "5432"
|
|
- name: DB_USERNAME
|
|
value: {{ .Values.postgres.username | quote }}
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "cloudhost-platform.secretName" . }}
|
|
key: postgres-password
|
|
- name: DB_DATABASE
|
|
value: {{ .Values.postgres.database | quote }}
|
|
- name: REDIS_HOST
|
|
value: {{ include "cloudhost-platform.redis.fullname" . }}
|
|
- name: REDIS_PORT
|
|
value: "6379"
|
|
- name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "cloudhost-platform.secretName" . }}
|
|
key: redis-password
|
|
- name: JWT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "cloudhost-platform.secretName" . }}
|
|
key: jwt-secret
|
|
- name: JWT_REFRESH_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "cloudhost-platform.secretName" . }}
|
|
key: jwt-refresh-secret
|
|
- name: CLUSTER_KUBECONFIG_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "cloudhost-platform.secretName" . }}
|
|
key: cluster-kubeconfig-key
|
|
- name: FRONTEND_URL
|
|
value: {{ include "cloudhost-platform.corsOrigins" . | quote }}
|
|
{{- include "cloudhost-platform.buildEnv" . | nindent 12 }}
|
|
{{- range $key, $val := .Values.backend.env }}
|
|
- name: {{ $key }}
|
|
value: {{ $val | quote }}
|
|
{{- end }}
|
|
{{- range $key, $val := .Values.backend.extraEnv }}
|
|
- name: {{ $key }}
|
|
value: {{ $val | quote }}
|
|
{{- end }}
|
|
{{- if .Values.backend.sourceStorage.enabled }}
|
|
envFrom:
|
|
- secretRef:
|
|
name: {{ .Values.backend.sourceStorage.existingSecret }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: uploads
|
|
mountPath: /app/uploads
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/v1/health
|
|
port: 4000
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 15
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/v1/ready
|
|
port: 4000
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
{{- with .Values.backend.resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: uploads
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "cloudhost-platform.backend.fullname" . }}-uploads
|
|
{{- end }}
|