LibreChat/helm/librechat/templates/deployment.yaml
Dustin Healy 1f27f5848a
📦 feat: Package Shared Slack Workspace Deployments (#17815)
* feat: Package Shared Slack Workspace Deployments

* fix: Require Explicit Shared Slack Deployment Prerequisites

* fix: Validate Public Slack Deployment Origins

* fix: Keep Shared Slack App Setup in Organization Administration

* 🔧 fix: Validate Shared Gateway Deployment Prerequisites
2026-11-10 21:04:10 -08:00

143 lines
6.1 KiB
YAML
Executable file

{{- $sharedSlack := and .Values.channelGateway.enabled (eq .Values.channelGateway.mode "shared") -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "librechat.fullname" $ }}
labels:
{{- include "librechat.labels" . | nindent 4 }}
{{- with .Values.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.deploymentAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
{{- if .Values.updateStrategy }}
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "librechat.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{ if .Values.librechat.configYamlContent }}checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}{{ end }}
checksum/configEnv: {{ include (print $.Template.BasePath "/configmap-env.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "librechat.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "librechat.podSettings" . | nindent 6 }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.initContainers }}
initContainers:
{{- range $key, $value := .Values.initContainers }}
{{- if . }}
- name: {{ $key }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
containers:
- name: {{ include "librechat.fullname" $ }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.containerPort | default .Values.service.port }}
protocol: TCP
lifecycle:
{{- toYaml .Values.lifecycle | nindent 12 }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- if or .Values.librechat.configYamlContent .Values.librechat.existingConfigYaml }}
- name: config-yaml
mountPath: "/app/librechat.yaml"
subPath: "librechat.yaml"
readOnly: true
{{- end }}
{{- if .Values.librechat.imageVolume.enabled }}
- name: image-volume
mountPath: "/app/client/public/images"
{{- end }}
{{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "librechat.fullname" $ }}-configenv
{{- if .Values.global.librechat.existingSecretName }}
- secretRef:
name: {{ .Values.global.librechat.existingSecretName }}
optional: false
{{- end }}
{{- include "librechat.validateBundledPasswords" . }}
{{- if or (include "librechat.bundledMongoAuth" .) (include "librechat.bundledRedisAuth" .) .Values.global.librechat.env $sharedSlack }}
env:
{{- with .Values.global.librechat.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $sharedSlack }}
{{- $configEnv := default dict .Values.librechat.configEnv }}
{{- $key := "CHANNEL_SERVICE_TOKEN" }}
{{- if not (or (include "librechat.userEnvHas" (dict "root" $ "name" $key)) (hasKey $configEnv $key)) }}
{{- $secret := .Values.channelGateway.existingSecretName | default .Values.global.librechat.existingSecretName }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ required "Shared Slack setup requires a service token Secret or explicit API environment" $secret | quote }}
key: {{ $key }}
{{- end }}
{{- end }}
{{- if include "librechat.bundledMongoAuth" . }}
{{- if not (include "librechat.userEnvHas" (dict "root" . "name" "MONGODB_ROOT_PASSWORD")) }}
- name: MONGODB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mongodb.secretName" .Subcharts.mongodb | quote }}
key: mongodb-root-password
{{- end }}
- name: MONGO_URI
value: mongodb://{{ .Values.mongodb.auth.rootUser | default "root" | urlquery | replace "+" "%20" }}:$(MONGODB_ROOT_PASSWORD)@{{ include "mongodb.service.nameOverride" .Subcharts.mongodb }}.{{ .Release.Namespace | lower }}.svc.cluster.local:27017/LibreChat?authSource=admin
{{- end }}
{{- if include "librechat.bundledRedisAuth" . }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "redis.secretName" .Subcharts.redis | quote }}
key: {{ include "redis.secretPasswordKey" .Subcharts.redis | quote }}
{{- end }}
{{- end }}
volumes:
{{- if or .Values.librechat.configYamlContent .Values.librechat.existingConfigYaml }}
- name: config-yaml
configMap:
{{- if .Values.librechat.existingConfigYaml }}
name: {{ .Values.librechat.existingConfigYaml }}
{{- else if .Values.librechat.configYamlContent }}
name: {{ include "librechat.fullname" $ }}-config
{{- end }}
{{- end }}
{{- if .Values.librechat.imageVolume.enabled }}
- name: image-volume
persistentVolumeClaim:
claimName: {{ include "librechat.fullname" $ }}-images
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 6 }}
{{- end }}