feat(helm): allow Service name overrides with matching consumer references (#4109)

* feat(helm): support compatible service name overrides

* refactor(helm): keep verification within existing chart workflow

* docs(helm): focus service naming guidance on configuration and upgrades
main
Perfecto 2026-10-12 11:53:32 +08:00 committed by GitHub
parent 3c36cb19a2
commit c6bfe81894
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 83 additions and 21 deletions

View File

@ -142,6 +142,43 @@ helm install weknora ./helm \
## Configuration
### Service names
Optional Service name overrides preserve the following defaults:
| Parameter | Default when omitted or empty |
|-----------|-------------------------------|
| `app.service.name` | `app` |
| `frontend.service.name` | `frontend` |
| `postgresql.service.name` | `postgres` |
| `redis.service.name` | `redis` |
| `docreader.service.name` | `docreader` |
| `neo4j.service.name` | `neo4j` (when enabled) |
For example, save this as `service-names.yaml`:
```yaml
app: {service: {name: weknora-app}}
frontend: {service: {name: weknora-frontend}}
postgresql: {service: {name: weknora-postgres}}
redis: {service: {name: weknora-redis}}
docreader: {service: {name: weknora-docreader}}
neo4j: {service: {name: weknora-neo4j}}
```
Pass `-f service-names.yaml` alongside your other values. Names must be valid
Kubernetes Service names. Services, backend addresses, Ingress and installation
notes use these names consistently. Frontend's `APP_HOST` follows the App Service
unless `frontend.appHost` is explicitly set.
For multiple releases in one namespace, use distinct names for every enabled
Service (for example, `alpha-app` and `beta-app`). Defaults are not release-prefixed
and still collide. Configure separate Ingress hosts when needed.
Omitted or empty overrides preserve Service names on upgrade. Changing a name on
an existing installation requires a DNS/consumer cutover plan; matching a
pre-existing Service name does not automatically transfer its ownership to Helm.
### Global Parameters
| Parameter | Description | Default |

View File

@ -28,7 +28,7 @@ WeKnora is accessible via Ingress:
To access WeKnora, use port-forwarding:
# Frontend (Web UI)
kubectl port-forward svc/frontend -n {{ .Release.Namespace }} 8080:80
kubectl port-forward svc/{{ include "weknora.serviceName" (dict "component" "frontend" "context" .) }} -n {{ .Release.Namespace }} 8080:80
# Then open: http://localhost:8080
@ -113,7 +113,7 @@ which is deprecated and no longer read by the app):
--set neo4j.password=<your-secure-password>
Access Neo4j Browser:
kubectl port-forward svc/neo4j -n {{ .Release.Namespace }} 7474:7474 7687:7687
kubectl port-forward svc/{{ include "weknora.serviceName" (dict "component" "neo4j" "context" .) }} -n {{ .Release.Namespace }} 7474:7474 7687:7687
# Open: http://localhost:7474
{{- end }}

View File

@ -32,6 +32,19 @@ Create a default fully qualified app name.
{{- end }}
{{- end }}
{{/*
Resolve a component Service name while preserving names used by existing releases.
Usage: include "weknora.serviceName" (dict "component" "postgresql" "context" .)
*/}}
{{- define "weknora.serviceName" -}}
{{- $service := (index .context.Values .component).service | default dict -}}
{{- $legacyName := .component -}}
{{- if eq .component "postgresql" -}}
{{- $legacyName = "postgres" -}}
{{- end -}}
{{- default $legacyName $service.name -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
Ref: https://helm.sh/docs/chart_best_practices/labels/

View File

@ -57,7 +57,7 @@ spec:
- name: DB_DRIVER
value: "postgres"
- name: DB_HOST
value: "postgres"
value: {{ include "weknora.serviceName" (dict "component" "postgresql" "context" .) | quote }}
- name: DB_PORT
value: "5432"
- name: DB_USER
@ -77,7 +77,7 @@ spec:
key: DB_NAME
# Redis configuration
- name: REDIS_ADDR
value: "redis:6379"
value: {{ printf "%s:6379" (include "weknora.serviceName" (dict "component" "redis" "context" .)) | quote }}
- name: REDIS_USERNAME
valueFrom:
secretKeyRef:
@ -115,7 +115,7 @@ spec:
value: {{ .Values.app.env.LOCAL_STORAGE_BASE_DIR | quote }}
# Document reader
- name: DOCREADER_ADDR
value: "docreader:50051"
value: {{ printf "%s:50051" (include "weknora.serviceName" (dict "component" "docreader" "context" .)) | quote }}
# Processing
- name: AUTO_RECOVER_DIRTY
value: {{ .Values.app.env.AUTO_RECOVER_DIRTY | quote }}
@ -133,7 +133,7 @@ spec:
- name: NEO4J_ENABLE
value: "true"
- name: NEO4J_URI
value: "bolt://neo4j:7687"
value: {{ printf "bolt://%s:7687" (include "weknora.serviceName" (dict "component" "neo4j" "context" .)) | quote }}
- name: NEO4J_USERNAME
valueFrom:
secretKeyRef:
@ -186,8 +186,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "app" - frontend nginx config hardcodes this
name: app
name: {{ include "weknora.serviceName" (dict "component" "app" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "app" "context" .) | nindent 4 }}

View File

@ -87,8 +87,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "docreader" - app references this
name: docreader
name: {{ include "weknora.serviceName" (dict "component" "docreader" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "docreader" "context" .) | nindent 4 }}

View File

@ -43,7 +43,7 @@ spec:
{{- end }}
env:
- name: APP_HOST
value: {{ .Values.frontend.appHost | default "app" | quote }}
value: {{ .Values.frontend.appHost | default (include "weknora.serviceName" (dict "component" "app" "context" .)) | quote }}
- name: APP_PORT
value: {{ .Values.frontend.appPort | default .Values.app.service.port | quote }}
- name: MAX_FILE_SIZE_MB
@ -97,8 +97,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "frontend" - ingress references this
name: frontend
name: {{ include "weknora.serviceName" (dict "component" "frontend" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "frontend" "context" .) | nindent 4 }}

View File

@ -38,7 +38,7 @@ spec:
pathType: Prefix
backend:
service:
name: app
name: {{ include "weknora.serviceName" (dict "component" "app" "context" .) | quote }}
port:
name: http
# Frontend routes - catch-all
@ -46,7 +46,7 @@ spec:
pathType: Prefix
backend:
service:
name: frontend
name: {{ include "weknora.serviceName" (dict "component" "frontend" "context" .) | quote }}
port:
name: http
{{- end }}

View File

@ -115,8 +115,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "neo4j" - app references this
name: neo4j
name: {{ include "weknora.serviceName" (dict "component" "neo4j" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "graph" "context" .) | nindent 4 }}

View File

@ -111,8 +111,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "postgres" - app references this
name: postgres
name: {{ include "weknora.serviceName" (dict "component" "postgresql" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "database" "context" .) | nindent 4 }}

View File

@ -107,8 +107,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
# Service name must be "redis" - app references this
name: redis
name: {{ include "weknora.serviceName" (dict "component" "redis" "context" .) | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "weknora.componentLabels" (dict "component" "cache" "context" .) | nindent 4 }}

View File

@ -114,6 +114,8 @@ app:
# -- Service configuration
service:
# -- Service name override (empty keeps "app")
name: ""
type: ClusterIP
port: 8080
@ -181,6 +183,8 @@ frontend:
# -- Service configuration
service:
# -- Service name override (empty keeps "frontend")
name: ""
type: ClusterIP
port: 80
@ -231,6 +235,8 @@ docreader:
# -- Service configuration
service:
# -- Service name override (empty keeps "docreader")
name: ""
type: ClusterIP
port: 50051
@ -250,6 +256,10 @@ postgresql:
# -- Enable PostgreSQL
enabled: true
service:
# -- Service name override (empty keeps "postgres")
name: ""
image:
# -- Image repository (ParadeDB for vector search)
repository: paradedb/paradedb
@ -296,6 +306,10 @@ redis:
# -- Enable Redis
enabled: true
service:
# -- Service name override (empty keeps "redis")
name: ""
image:
# -- Image repository
repository: redis
@ -446,6 +460,10 @@ neo4j:
# -- Enable Neo4j for GraphRAG
enabled: false
service:
# -- Service name override (empty keeps "neo4j")
name: ""
image:
# -- Image repository
repository: neo4j