gitdataai/deploy/templates/app-deployment.yaml
2026-04-14 19:02:01 +08:00

112 lines
4.2 KiB
YAML

{{- if .Values.app.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "c-----code.fullname" . }}-app
namespace: {{ include "c-----code.namespace" . }}
labels:
app.kubernetes.io/name: {{ include "c-----code.fullname" . }}-app
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
spec:
replicas: {{ .Values.app.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "c-----code.fullname" . }}-app
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "c-----code.fullname" . }}-app
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: app
image: "{{ .Values.image.registry }}/{{ .Values.app.image.repository }}:{{ .Values.app.image.tag }}"
imagePullPolicy: {{ .Values.app.image.pullPolicy | default .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.app.service.port }}
protocol: TCP
env:
- name: APP_DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Values.database.existingSecret | default (printf "%s-secrets" (include "c-----code.fullname" .)) }}
key: {{ .Values.database.secretKeys.url }}
optional: true
- name: APP_REDIS_URL
valueFrom:
secretKeyRef:
name: {{ .Values.redis.existingSecret | default (printf "%s-secrets" (include "c-----code.fullname" .)) }}
key: {{ .Values.redis.secretKeys.url }}
optional: true
{{- if .Values.nats.enabled }}
- name: HOOK_POOL_REDIS_LIST_PREFIX
value: "{hook}"
- name: HOOK_POOL_REDIS_LOG_CHANNEL
value: "hook:logs"
{{- end }}
{{- if .Values.qdrant.enabled }}
- name: APP_QDRANT_URL
value: {{ .Values.qdrant.url }}
{{- if and .Values.qdrant.existingSecret .Values.qdrant.secretKeys.apiKey }}
- name: APP_QDRANT_API_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.qdrant.existingSecret }}
key: {{ .Values.qdrant.secretKeys.apiKey }}
optional: true
{{- end }}
{{- end }}
{{- range .Values.app.env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
livenessProbe:
httpGet:
path: {{ .Values.app.livenessProbe.path }}
port: {{ .Values.app.livenessProbe.port }}
initialDelaySeconds: {{ .Values.app.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.app.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
path: {{ .Values.app.readinessProbe.path }}
port: {{ .Values.app.readinessProbe.port }}
initialDelaySeconds: {{ .Values.app.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.app.readinessProbe.periodSeconds }}
resources:
{{- toYaml .Values.app.resources | nindent 10 }}
{{- with .Values.app.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.app.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.app.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "c-----code.fullname" . }}-app
namespace: {{ include "c-----code.namespace" . }}
labels:
app.kubernetes.io/name: {{ include "c-----code.fullname" . }}-app
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
type: {{ .Values.app.service.type }}
ports:
- port: {{ .Values.app.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "c-----code.fullname" . }}-app
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}