Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,5 @@ ragflow_cli.egg-info

# Default backup dir
backup

.kilocode/
2 changes: 2 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
.idea/
*.tmproj
.vscode/
README.md
*.tgz
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.2.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
272 changes: 272 additions & 0 deletions helm/README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create a fully qualified name for a component (frontend, api, worker, admin, mcp).
Usage: {{ include "ragflow.componentFullname" (dict "root" . "component" "api") }}
*/}}
{{- define "ragflow.componentFullname" -}}
{{- $root := index . "root" -}}
{{- $component := index . "component" -}}
{{- printf "%s-%s" (include "ragflow.fullname" $root) $component | trunc 63 | trimSuffix "-" }}
{{- end }}
167 changes: 167 additions & 0 deletions helm/templates/admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{{- if .Values.ragflow.admin.enabled }}
{{- $component := "admin" }}
{{- $name := include "ragflow.componentFullname" (dict "root" . "component" $component) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $name }}
labels:
{{- include "ragflow.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
spec:
replicas: {{ .Values.ragflow.admin.replicaCount }}
{{- with .Values.ragflow.admin.deployment.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "ragflow.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
labels:
{{- include "ragflow.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: {{ $component }}
{{- with .Values.ragflow.admin.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- $globalPullSecrets := .Values.imagePullSecrets }}
{{- $basePullSecrets := .Values.ragflow.image.pullSecrets }}
{{- $adminImage := default (dict) .Values.ragflow.admin.image }}
{{- $componentPullSecrets := default list $adminImage.pullSecrets }}
{{- if or (or $globalPullSecrets $basePullSecrets) $componentPullSecrets }}
imagePullSecrets:
{{- with $globalPullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $basePullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $componentPullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- $localServiceConf := .Values.ragflow.service_conf }}
{{- $llmFactories := .Values.ragflow.llm_factories }}
{{- $extraArgs := join " " .Values.ragflow.admin.extraArgs }}
containers:
- name: {{ $component }}
{{- $imageRepository := default .Values.ragflow.image.repository $adminImage.repository }}
{{- $imageTag := default .Values.ragflow.image.tag $adminImage.tag }}
image: {{ printf "%s:%s" $imageRepository $imageTag }}
{{- $pullPolicy := default .Values.ragflow.image.pullPolicy $adminImage.pullPolicy }}
{{- with $pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
command:
- /bin/bash
- -lc
- |
set -eo pipefail
cd /ragflow

export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
PY=python3
exec "${PY}" admin/server/admin_server.py{{- if $extraArgs }} {{ $extraArgs }}{{- end }}
envFrom:
- secretRef:
name: {{ include "ragflow.fullname" . }}-env-config
env:
- name: FLASK_ENV
value: {{ ternary "development" "production" (default false .Values.ragflow.admin.debug) | quote }}
- name: FLASK_DEBUG
value: {{ ternary "1" "0" (default false .Values.ragflow.admin.debug) | quote }}
- name: WERKZEUG_DEBUG_PIN
value: "off"
- name: RAGFLOW_HOST
value: {{ printf "%s.%s.svc" (include "ragflow.componentFullname" (dict "root" . "component" "api")) .Release.Namespace | quote }}
{{- with .Values.ragflow.admin.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 9381
{{- $probes := default (dict) .Values.ragflow.admin.probes }}
{{- if $probes.liveness }}
livenessProbe:
{{- toYaml $probes.liveness | nindent 12 }}
{{- else }}
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
{{- end }}
{{- if $probes.readiness }}
readinessProbe:
{{- toYaml $probes.readiness | nindent 12 }}
{{- else }}
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
successThreshold: 1
{{- end }}
{{- if $probes.startup }}
startupProbe:
{{- toYaml $probes.startup | nindent 12 }}
{{- else }}
startupProbe:
tcpSocket:
port: http
periodSeconds: 10
failureThreshold: 30
{{- end }}
volumeMounts:
- mountPath: /ragflow/conf/service_conf.yaml
subPath: service_conf.yaml
name: service-conf-volume
{{- if $localServiceConf }}
- mountPath: /ragflow/conf/local.service_conf.yaml
subPath: local.service_conf.yaml
name: service-conf-volume
{{- end }}
{{- if $llmFactories }}
- mountPath: /ragflow/conf/llm_factories.json
subPath: llm_factories.json
name: service-conf-volume
{{- end }}
{{- with .Values.ragflow.admin.deployment.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: service-conf-volume
configMap:
name: ragflow-service-config
---
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
labels:
{{- include "ragflow.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
spec:
type: {{ .Values.ragflow.admin.service.type }}
selector:
{{- include "ragflow.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
{{- if gt (int .Values.ragflow.admin.replicaCount) 1 }}
sessionAffinity: ClientIP
{{- end }}
ports:
- name: http
port: {{ .Values.ragflow.admin.service.port }}
targetPort: http
{{- end }}
162 changes: 162 additions & 0 deletions helm/templates/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{{- $component := "api" }}
{{- $name := include "ragflow.componentFullname" (dict "root" . "component" $component) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $name }}
labels:
{{- include "ragflow.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
spec:
replicas: {{ .Values.ragflow.api.replicaCount }}
{{- with .Values.ragflow.api.deployment.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "ragflow.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
labels:
{{- include "ragflow.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: {{ $component }}
{{- with .Values.ragflow.api.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- $globalPullSecrets := .Values.imagePullSecrets }}
{{- $basePullSecrets := .Values.ragflow.image.pullSecrets }}
{{- $apiImage := default (dict) .Values.ragflow.api.image }}
{{- $componentPullSecrets := default list $apiImage.pullSecrets }}
{{- if or (or $globalPullSecrets $basePullSecrets) $componentPullSecrets }}
imagePullSecrets:
{{- with $globalPullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $basePullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $componentPullSecrets }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- $localServiceConf := .Values.ragflow.service_conf }}
{{- $llmFactories := .Values.ragflow.llm_factories }}
containers:
- name: {{ $component }}
workingDir: /ragflow
{{- $imageRepository := default .Values.ragflow.image.repository $apiImage.repository }}
{{- $imageTag := default .Values.ragflow.image.tag $apiImage.tag }}
image: {{ printf "%s:%s" $imageRepository $imageTag }}
{{- $pullPolicy := default .Values.ragflow.image.pullPolicy $apiImage.pullPolicy }}
{{- with $pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
command:
- /bin/bash
- -lc
- |
set -eo pipefail
cd /ragflow
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
exec python3 api/ragflow_server.py{{- range $arg := .Values.ragflow.api.extraArgs }} {{ $arg | quote }}{{- end }}
ports:
- name: http
containerPort: 9380
{{- $probes := default (dict) .Values.ragflow.api.probes }}
{{- if $probes.liveness }}
livenessProbe:
{{- toYaml $probes.liveness | nindent 12 }}
{{- else }}
livenessProbe:
httpGet:
path: /v1/system/healthz
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
{{- end }}
{{- if $probes.readiness }}
readinessProbe:
{{- toYaml $probes.readiness | nindent 12 }}
{{- else }}
readinessProbe:
httpGet:
path: /v1/system/healthz
port: http
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
successThreshold: 1
{{- end }}
{{- if $probes.startup }}
startupProbe:
{{- toYaml $probes.startup | nindent 12 }}
{{- else }}
startupProbe:
httpGet:
path: /v1/system/healthz
port: http
periodSeconds: 10
failureThreshold: 30
{{- end }}
envFrom:
- secretRef:
name: {{ include "ragflow.fullname" . }}-env-config
env:
- name: FLASK_ENV
value: {{ ternary "development" "production" (default false .Values.ragflow.api.debug) | quote }}
- name: FLASK_DEBUG
value: {{ ternary "1" "0" (default false .Values.ragflow.api.debug) | quote }}
{{- with .Values.ragflow.api.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /ragflow/conf/service_conf.yaml
subPath: service_conf.yaml
name: service-conf-volume
{{- if $localServiceConf }}
- mountPath: /ragflow/conf/local.service_conf.yaml
subPath: local.service_conf.yaml
name: service-conf-volume
{{- end }}
{{- if $llmFactories }}
- mountPath: /ragflow/conf/llm_factories.json
subPath: llm_factories.json
name: service-conf-volume
{{- end }}
{{- with .Values.ragflow.api.deployment.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: service-conf-volume
configMap:
name: ragflow-service-config
---
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
labels:
{{- include "ragflow.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
spec:
type: {{ .Values.ragflow.api.service.type }}
selector:
{{- include "ragflow.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
{{- if gt (int .Values.ragflow.api.replicaCount) 1 }}
sessionAffinity: ClientIP
{{- end }}
ports:
- name: http
port: {{ .Values.ragflow.api.service.port }}
targetPort: http
2 changes: 1 addition & 1 deletion helm/templates/elasticsearch-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
{{- if and (eq .Values.env.DOC_ENGINE "elasticsearch") (not .Values.externalServices.elasticsearch.enabled) -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
{{- if and (eq .Values.env.DOC_ENGINE "elasticsearch") (not .Values.externalServices.elasticsearch.enabled) -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
Loading