基于helm-dify 0.23.0 版本初始化

This commit is contained in:
2025-03-21 10:00:02 +08:00
parent d773ead144
commit 67b42e3e1c
196 changed files with 26165 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
{{- if and .Values.worker.enabled}}
{{- $usePvc := not (or .Values.externalS3.enabled .Values.externalOSS.enabled .Values.externalAzureBlobStorage.enabled .Values.externalGCS.enabled .Values.externalCOS.enabled) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{ include "dify.ud.annotations" . | indent 4 }}
descriptions: worker
labels:
{{- include "dify.labels" . | nindent 4 }}
component: worker
# app: {{ template "dify.worker.fullname" . }}
{{ include "dify.ud.labels" . | indent 4 }}
name: {{ template "dify.worker.fullname" . }}
spec:
replicas: {{ .Values.worker.replicas }}
selector:
matchLabels:
{{- include "dify.selectorLabels" . | nindent 6 }}
component: worker
{{/*
# Required labels for istio
# app: {{ template "dify.worker.fullname" . }}
# version: {{ (print "v" .Values.serviceMesh.version) | quote }}
*/}}
template:
metadata:
annotations:
checksum/worker-config: {{ include (print $.Template.BasePath "/worker-config.yaml") . | sha256sum }}
checksum/worker-secret: {{ include (print $.Template.BasePath "/worker-secret.yaml") . | sha256sum }}
{{ include "dify.ud.annotations" . | indent 8 }}
labels:
{{- include "dify.selectorLabels" . | nindent 8 }}
component: worker
{{/*
# Required labels for istio
# app: {{ template "dify.worker.fullname" . }}
# version: {{ (print "v" .Values.serviceMesh.version) | quote }}
*/}}
{{ include "dify.ud.labels" . | indent 8 }}
spec:
serviceAccountName: {{ include "dify.worker.serviceAccountName" . }}
{{- if .Values.image.api.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.api.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.worker.podSecurityContext }}
securityContext:
{{ toYaml .Values.worker.podSecurityContext | indent 8 }}
{{- end }}
initContainers:
- name: init
image: "{{.Values.image.python.repository }}:{{ default "3.12-slim" .Values.image.python.tag }}"
imagePullPolicy: "{{.Values.image.python.pullPolicy }}"
command: ["/bin/sh"]
args: ["-c", "pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn"]
volumeMounts:
- name: python-config
mountPath: /root/.config/pip
containers:
- image: "{{ .Values.image.api.repository }}:{{ default .Chart.AppVersion .Values.image.api.tag }}"
imagePullPolicy: "{{ .Values.image.api.pullPolicy }}"
name: worker
{{- if .Values.worker.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.worker.customLivenessProbe "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.worker.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.worker.customReadinessProbe "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.worker.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.worker.customStartupProbe "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.worker.containerSecurityContext }}
securityContext:
{{ toYaml .Values.worker.containerSecurityContext | indent 10 }}
{{- end }}
env:
{{- if .Values.worker.extraEnv }}
{{- toYaml .Values.worker.extraEnv | nindent 8 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "dify.worker.fullname" . }}
- secretRef:
name: {{ template "dify.worker.fullname" . }}
resources:
{{- toYaml .Values.worker.resources | nindent 12 }}
volumeMounts:
- name: python-config
mountPath: /root/.config/pip
{{- if $usePvc }}
- name: app-data
mountPath: {{ .Values.api.persistence.mountPath | quote }}
subPath: {{ .Values.api.persistence.persistentVolumeClaim.subPath | default "" }}
{{- end }}
{{- if and (.Values.nodeSelector) (not .Values.worker.nodeSelector) }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.worker.nodeSelector }}
nodeSelector:
{{ toYaml .Values.worker.nodeSelector | indent 8 }}
{{- end }}
{{- if and (.Values.affinity) (not .Values.worker.affinity) }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.worker.affinity }}
affinity:
{{ toYaml .Values.worker.affinity | indent 8 }}
{{- end }}
{{- if and (.Values.tolerations) (not .Values.worker.tolerations) }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.worker.tolerations }}
tolerations:
{{ toYaml .Values.worker.tolerations | indent 8 }}
{{- end }}
volumes:
- name: python-config
emptyDir: {}
{{- if $usePvc }}
- name: app-data
persistentVolumeClaim:
claimName: {{ .Values.api.persistence.persistentVolumeClaim.existingClaim | default (printf "%s" (include "dify.fullname" . | trunc 58)) }}
{{- end }}
{{- end }}