mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 13:10:42 +00:00
The init container was only getting RUST_LOG, not the main env block. This caused it to connect to the config file's database URL (SQLite) instead of the BARYCENTER__DATABASE__URL env var (PostgreSQL), resulting in migrations and user-sync running against the wrong database. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
140 lines
4.7 KiB
YAML
140 lines
4.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "barycenter.fullname" . }}
|
|
labels:
|
|
{{- include "barycenter.labels" . | nindent 4 }}
|
|
spec:
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
strategy:
|
|
type: Recreate # Use Recreate for SQLite (single writer)
|
|
selector:
|
|
matchLabels:
|
|
{{- include "barycenter.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
{{- if and .Values.config.authz.enabled (not .Values.authz.existingConfigMap) .Values.authz.policies }}
|
|
checksum/authz-policies: {{ include (print $.Template.BasePath "/authz-policies-configmap.yaml") . | sha256sum }}
|
|
{{- end }}
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "barycenter.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "barycenter.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
{{- if .Values.userSync.enabled }}
|
|
initContainers:
|
|
- name: user-sync
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
command:
|
|
- barycenter
|
|
- -c
|
|
- /app/config/config.toml
|
|
- sync-users
|
|
- --file
|
|
- /secrets/{{ .Values.userSync.secretKey }}
|
|
{{- if .Values.env }}
|
|
env:
|
|
{{- toYaml .Values.env | nindent 8 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /app/config
|
|
readOnly: true
|
|
{{- if .Values.persistence.enabled }}
|
|
- name: data
|
|
mountPath: /app/data
|
|
{{- end }}
|
|
- name: user-sync-secret
|
|
mountPath: /secrets
|
|
readOnly: true
|
|
resources:
|
|
{{- toYaml .Values.userSync.resources | nindent 10 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
args: ["-c", "/app/config/config.toml"]
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.config.server.port }}
|
|
protocol: TCP
|
|
{{- if .Values.config.authz.enabled }}
|
|
- name: authz
|
|
containerPort: {{ .Values.config.authz.port | default (add .Values.config.server.port 2) }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- if .Values.env }}
|
|
env:
|
|
{{- toYaml .Values.env | nindent 8 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /app/config
|
|
readOnly: true
|
|
{{- if .Values.persistence.enabled }}
|
|
- name: data
|
|
mountPath: /app/data
|
|
{{- end }}
|
|
{{- if .Values.config.authz.enabled }}
|
|
- name: authz-policies
|
|
mountPath: {{ .Values.config.authz.policiesDir }}
|
|
readOnly: true
|
|
{{- end }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.livenessProbe | nindent 10 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.readinessProbe | nindent 10 }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 10 }}
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ include "barycenter.fullname" . }}
|
|
{{- if .Values.persistence.enabled }}
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "barycenter.fullname" . }}-data
|
|
{{- else }}
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- if .Values.userSync.enabled }}
|
|
- name: user-sync-secret
|
|
secret:
|
|
secretName: {{ .Values.userSync.existingSecret }}
|
|
{{- end }}
|
|
{{- if .Values.config.authz.enabled }}
|
|
- name: authz-policies
|
|
configMap:
|
|
name: {{ if .Values.authz.existingConfigMap }}{{ .Values.authz.existingConfigMap }}{{ else }}{{ include "barycenter.fullname" . }}-authz-policies{{ end }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|