gitdataai/admin/deploy/templates/admin-deployment.yaml
ZhenYi b8e5cbbb69
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions
feat(admin): add Docker and Kubernetes deployment for admin panel
2026-04-19 21:49:22 +08:00

118 lines
4.3 KiB
YAML

{{- if .Values.admin.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "admin.fullname" . }}-admin
namespace: {{ include "admin.namespace" . }}
labels:
app.kubernetes.io/name: {{ include "admin.fullname" . }}-admin
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
spec:
replicas: {{ .Values.admin.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "admin.fullname" . }}-admin
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "admin.fullname" . }}-admin
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- if $.Values.image.pullSecrets }}
imagePullSecrets:
{{- range $.Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
terminationGracePeriodSeconds: 30
containers:
- name: admin
image: "{{ include "admin.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.admin.service.port }}
protocol: TCP
env:
- name: NODE_ENV
value: {{ .Values.admin.config.nodeEnv | default "production" | quote }}
{{- if .Values.admin.config.appUrl }}
- name: NEXT_PUBLIC_APP_URL
value: {{ .Values.admin.config.appUrl | quote }}
{{- end }}
{{- if .Values.admin.config.appDomain }}
- name: NEXT_PUBLIC_APP_DOMAIN
value: {{ .Values.admin.config.appDomain | quote }}
{{- end }}
{{- if .Values.secrets.enabled }}
- name: {{ .Values.admin.secretKeys.databaseUrl }}
valueFrom:
secretKeyRef:
name: {{ include "admin.fullname" . }}-secrets
key: {{ .Values.admin.secretKeys.databaseUrl }}
- name: {{ .Values.admin.secretKeys.redisUrl }}
valueFrom:
secretKeyRef:
name: {{ include "admin.fullname" . }}-secrets
key: {{ .Values.admin.secretKeys.redisUrl }}
- name: {{ .Values.admin.secretKeys.nextAuthSecret }}
valueFrom:
secretKeyRef:
name: {{ include "admin.fullname" . }}-secrets
key: {{ .Values.admin.secretKeys.nextAuthSecret }}
{{- end }}
{{- range .Values.admin.env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
livenessProbe:
httpGet:
path: {{ .Values.admin.livenessProbe.path }}
port: {{ .Values.admin.livenessProbe.port }}
initialDelaySeconds: {{ .Values.admin.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.admin.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
path: {{ .Values.admin.readinessProbe.path }}
port: {{ .Values.admin.readinessProbe.port }}
initialDelaySeconds: {{ .Values.admin.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.admin.readinessProbe.periodSeconds }}
{{- if .Values.admin.resources }}
resources:
{{- toYaml .Values.admin.resources | nindent 12 }}
{{- end }}
{{- with .Values.admin.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.admin.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.admin.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "admin.fullname" . }}-admin
namespace: {{ include "admin.namespace" . }}
labels:
app.kubernetes.io/name: {{ include "admin.fullname" . }}-admin
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
type: {{ .Values.admin.service.type }}
ports:
- port: {{ .Values.admin.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "admin.fullname" . }}-admin
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}