helm: improvements (#10976)

- fix(ingress): use root context ($) for fullname inside range
- fix(statefulset): use updateStrategy instead of strategy for
mysql/infinity/elasticsearch/opensearch
- feat(mysql): add external mode via mysql.enabled=false with env
MYSQL_HOST/PORT and MYSQL_USER (default root)
- feat(minio/redis): add external mode via *.enabled=false with env
*_HOST/PORT
- feat(global): add global.repo for image registry prefix and
global.imagePullSecrets for all pods
- feat: helper template ragflow.imageRepo to render image with global
repo
- chore(env): allow optional MINIO_HOST, MINIO_PASSWORD, REDIS_PASSWORD
(remove required); keep MYSQL_PASSWORD required
- docs(helm): add helm/README.md and update usage
- refactor(images): apply global repo to all components and init
containers
- test: align test busybox image with global repo helper

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [x] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
This commit is contained in:
LyleLaii
2025-12-29 13:29:47 +08:00
committed by GitHub
parent a764f0a5b2
commit 082c2ed11c
14 changed files with 246 additions and 38 deletions

View File

@ -9,20 +9,39 @@ metadata:
type: Opaque
stringData:
{{- range $key, $val := .Values.env }}
{{- if $val }}
{{- if and $val (ne $key "MYSQL_HOST") (ne $key "MYSQL_PORT") (ne $key "MYSQL_USER") (ne $key "MINIO_HOST") (ne $key "MINIO_PORT") (ne $key "REDIS_HOST") (ne $key "REDIS_PORT") }}
{{ $key }}: {{ quote $val }}
{{- end }}
{{- end }}
{{- /*
Use host names derived from internal cluster DNS
*/}}
{{- if .Values.redis.enabled }}
REDIS_HOST: {{ printf "%s-redis.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
REDIS_PORT: "6379"
{{- else }}
REDIS_HOST: {{ required "env.REDIS_HOST is required when redis.enabled=false" .Values.env.REDIS_HOST | quote }}
REDIS_PORT: {{ default "6379" .Values.env.REDIS_PORT | quote }}
{{- end }}
{{- if .Values.mysql.enabled }}
MYSQL_HOST: {{ printf "%s-mysql.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
MYSQL_PORT: "3306"
{{- else }}
MYSQL_HOST: {{ required "env.MYSQL_HOST is required when mysql.enabled=false" .Values.env.MYSQL_HOST | quote }}
MYSQL_PORT: {{ default "3306" .Values.env.MYSQL_PORT | quote }}
MYSQL_USER: {{ default "root" .Values.env.MYSQL_USER | quote }}
{{- end }}
{{- if .Values.minio.enabled }}
MINIO_HOST: {{ printf "%s-minio.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
MINIO_PORT: "9000"
{{- else }}
MINIO_HOST: {{ default "" .Values.env.MINIO_HOST | quote }}
MINIO_PORT: {{ default "9000" .Values.env.MINIO_PORT | quote }}
{{- end }}
{{- /*
Fail if passwords are not provided in release values
*/}}
REDIS_PASSWORD: {{ .Values.env.REDIS_PASSWORD | required "REDIS_PASSWORD is required" }}
REDIS_PASSWORD: {{ default "" .Values.env.REDIS_PASSWORD }}
{{- /*
NOTE: MySQL uses MYSQL_ROOT_PASSWORD env var but Ragflow container expects
MYSQL_PASSWORD so we need to define both as the same value here.
@ -31,10 +50,9 @@ stringData:
MYSQL_PASSWORD: {{ . }}
MYSQL_ROOT_PASSWORD: {{ . }}
{{- end }}
{{- with .Values.env.MINIO_PASSWORD | required "MINIO_PASSWORD is required" }}
MINIO_PASSWORD: {{ . }}
MINIO_ROOT_PASSWORD: {{ . }}
{{- end }}
{{- $minioPass := default "" .Values.env.MINIO_PASSWORD }}
MINIO_PASSWORD: {{ $minioPass }}
MINIO_ROOT_PASSWORD: {{ $minioPass }}
{{- /*
Only provide env vars for enabled doc engine
*/}}