chore(helm): fix duplicated env, annotation precedence and stale config keys
ZhenYi committed
Modified charts/core/templates/_helpers.tpl charts/core/templates/_helpers.tpl +3 −6 View charts/core/templates/_helpers.tpl
@@ -63,8 +63,6 @@
6363 value: {{ .Values.kenshell.rpcKey | quote }}
6464- name: APP_GIT__KENSHELL_TIMEOUT_SECS
6565 value: {{ .Values.kenshell.timeoutSecs | quote }}
66- name: APP_GIT__HTTP_CLONE_BASE_URL
67 value: {{ .Values.kenshell.httpCloneBaseUrl | quote }}
6866- name: APP_GIT__SSH_CLONE_HOST
6967 value: {{ .Values.kenshell.sshCloneHost | quote }}
7068- name: APP_GIT__SSH_CLONE_PORT
@@ -74,8 +72,9 @@
7472 value: {{ default $base .Values.config.env.APP_WEB__WEB_BASE_URL | quote }}
7573- name: APP_GIT__BASE_URL
7674 value: {{ default $base .Values.config.env.APP_GIT__BASE_URL | quote }}
75{{- $cloneBase := default $base .Values.kenshell.httpCloneBaseUrl }}
7776- name: APP_GIT__HTTP_CLONE_BASE_URL
78 value: {{ default $base .Values.config.env.APP_GIT__HTTP_CLONE_BASE_URL | quote }}
77 value: {{ default $cloneBase .Values.config.env.APP_GIT__HTTP_CLONE_BASE_URL | quote }}
7978{{- if .Values.metrics.otlpEndpoint }}
8079- name: OTEL_EXPORTER_OTLP_ENDPOINT
8180 value: {{ .Values.metrics.otlpEndpoint | quote }}
@@ -87,15 +86,13 @@
8786 fieldPath: "metadata.labels['app.kubernetes.io/component']"
8887{{- end }}
8988{{- range $k, $v := .Values.config.env }}
90{{- if not (hasPrefix "APP_WEB__WEB_BASE_URL" $k) }}
91{{- if not (hasPrefix "APP_GIT__BASE_URL" $k) }}
89{{- if and (not (hasPrefix "APP_WEB__WEB_BASE_URL" $k)) (not (hasPrefix "APP_GIT__BASE_URL" $k)) (not (hasPrefix "APP_GIT__HTTP_CLONE_BASE_URL" $k)) }}
9290{{/* config.env 走容器 env:,secret.env 走 envFrom:;同名时 env: 优先级更高,
9391 会静默覆盖 Secret 里的真实值(例如把连接串换成 chart 默认的 redis://redis-master)。
9492 因此这里跳过任何已在 secret.env 中声明的键,让 Secret 成为唯一来源。 */}}
9593{{- if not (hasKey $.Values.secret.env $k) }}
9694- name: {{ $k }}
9795 value: {{ $v | quote }}
98{{- end }}
9996{{- end }}
10097{{- end }}
10198{{- end }}
Modified charts/core/templates/configmap-env.yaml charts/core/templates/configmap-env.yaml +1 −0 View charts/core/templates/configmap-env.yaml
@@ -7,5 +7,6 @@
77 annotations:
88 "helm.sh/hook": pre-install,pre-upgrade
99 "helm.sh/hook-weight": "-10"
10 "helm.sh/hook-delete-policy": before-hook-creation
1011data:
1112 RUST_LOG: "info"
Modified charts/core/templates/ingress.yaml charts/core/templates/ingress.yaml +1 −1 View charts/core/templates/ingress.yaml
@@ -12,7 +12,7 @@
1212 "nginx.ingress.kubernetes.io/proxy-send-timeout" (printf "%v" .Values.ingress.proxySendTimeout)
1313 "nginx.ingress.kubernetes.io/proxy-connect-timeout" (printf "%v" .Values.ingress.proxyConnectTimeout)
1414 }}
15{{- $annotations = merge (mustFromJson (toJson $nginxDefaults)) $annotations }}
15{{- $annotations = mergeOverwrite (mustFromJson (toJson $nginxDefaults)) $annotations }}
1616{{- end }}
1717{{- if and .Values.ingress.tls.enabled .Values.ingress.tls.clusterIssuer }}
1818{{- $_ := set $annotations "cert-manager.io/cluster-issuer" .Values.ingress.tls.clusterIssuer }}
Modified charts/core/templates/NOTES.txt charts/core/templates/NOTES.txt +2 −2 View charts/core/templates/NOTES.txt
@@ -2,7 +2,7 @@
22
33Endpoints (ingress {{ .Values.ingress.enabled }}):
44{{- if .Values.ingress.enabled }}
5 https://{{ .Values.ingress.host }}/ -> apihost (REST/GraphQL/WS)
5 https://{{ .Values.ingress.host }}/ -> apihost (REST/WS)
66 git clone https://{{ .Values.ingress.host }}/{space}/{repo}.git -> KenShell
77{{- else }}
88 kubectl port-forward svc/{{ .Values.fullnameOverride | default (printf "%s-%s" .Release.Name .Chart.Name) }}-apihost {{ .Values.apihost.port }}:{{ .Values.apihost.port }}
@@ -13,7 +13,7 @@
1313 kubectl -n {{ .Release.Namespace }} logs job/{{ include "gitdata.fullname" . }}-migrate
1414
1515Reminders:
16 - secret.env 中 APP_AUTH__RPC_KEY / APP_INTERNAL__SERVICE_KEY / APP_POW__MAC_KEY / APP_AUTH__TOTP_ENCRYPTION_KEY 必填;
16 - secret.env 中 APP_INTERNAL__SERVICE_KEY / APP_POW__MAC_KEY / APP_AUTH__TOTP_ENCRYPTION_KEY 必填;
1717 生产环境建议 --set secret.existingSecret=<name> 并用外部 Secret 管理。
1818 - KenApi 不再持有 bare 仓库;clone/push 由 KenShell 提供,需配置 kenshell.endpoint。
1919 - 磁盘上的 config/local/ 含真实密钥,部署前请轮换。
Modified charts/core/templates/secret-env.yaml charts/core/templates/secret-env.yaml +1 −0 View charts/core/templates/secret-env.yaml
@@ -8,6 +8,7 @@
88 annotations:
99 "helm.sh/hook": pre-install,pre-upgrade
1010 "helm.sh/hook-weight": "-10"
11 "helm.sh/hook-delete-policy": before-hook-creation
1112type: Opaque
1213stringData:
1314 {{- range $k, $v := .Values.secret.env }}
Modified charts/core/values.yaml charts/core/values.yaml +3 −6 View charts/core/values.yaml
@@ -15,7 +15,7 @@
1515 annotations: {}
1616
1717# ---------------------------------------------------------------------------
18# 运行时配置。全部通过 Figment 的 APP_* 环境变量注入(见 docs/技术架构.md §12)。
18# 运行时配置。全部通过 Figment 的 APP_* 环境变量注入。
1919# config.env -> ConfigMap(非敏感)
2020# secret.env -> Secret(敏感);生产建议改用 existingSecret + 外部密钥管理
2121# ---------------------------------------------------------------------------
@@ -31,15 +31,13 @@
3131 # 读写库/副本、配额等其余段均可在此覆盖,例如:
3232 # APP_DATABASE__REPLICAS: '[{url="postgres://readonly@pg:5432/gitdata"}]'
3333 # Web Push:默认关闭;开启前必须同时提供 APP_PUSH__VAPID_PUBLIC_KEY(此处)
34 # 与 APP_PUSH__VAPID_PRIVATE_KEY(secret.env)。密钥生成见 config/default/。
34 # 与 APP_PUSH__VAPID_PRIVATE_KEY(secret.env)。
3535 APP_PUSH__ENABLED: "false"
3636 APP_PUSH__VAPID_PUBLIC_KEY: ""
3737 APP_PUSH__VAPID_SUBJECT: "mailto:ops@example.com"
3838 # 事件投递:消息事件写入 event_outbox,由 apihost 内嵌 relay 投递到 RocketMQ。
39 APP_ROCKETMQ__ENABLED: "true"
4039 APP_ROCKETMQ__NAME_SERVER: "rocketmq-namesrv:9876"
4140 APP_ROCKETMQ__TOPIC_PREFIX: "gitdata"
42 # 认证中心:浏览器走同域 session,服务间走 gRPC(x-rpc-key)。
4341 RUST_LOG: "info"
4442
4543# 敏感配置(渲染为 Secret)。注意 AppConfig 的 Debug 会带出密钥,
@@ -50,7 +48,6 @@
5048 existingSecret: ""
5149 env:
5250 APP_DATABASE__URL: "postgres://postgres:CHANGE_ME@postgres:5432/gitdata"
53 APP_AUTH__RPC_KEY: "" # 与 identity auth.rpc_key 一致,>=32 字节
5451 APP_INTERNAL__SERVICE_KEY: "" # /api/v1/internal/* 服务密钥,>=32 字节
5552 APP_POW__MAC_KEY: "" # base64 >=32 字节
5653 APP_AUTH__TOTP_ENCRYPTION_KEY: "" # base64 >=32 字节(实测必填)
@@ -152,5 +149,5 @@
152149 proxyConnectTimeout: 60
153150
154151metrics:
155 # OTLP 推送(无 scrape 端点,见 §13)
152 # OTLP 推送(无 scrape 端点)
156153 otlpEndpoint: ""