fix(deploy): replace underscores with hyphens in container names and fix namespace Helm ownership

Kubernetes container names must follow RFC 1123 (no underscores).
Also update deploy.sh to label/annotate namespace with Helm ownership metadata.
This commit is contained in:
ZhenYi 2026-05-10 23:23:45 +08:00
parent f082429a58
commit 065c9e6aa5
4 changed files with 10 additions and 5 deletions

View File

@ -25,9 +25,14 @@ command_exists kubectl || err "kubectl not found — install via https://kuberne
log "helm $(helm version --short)"
log "kubectl $(kubectl version --client --short 2>/dev/null || kubectl version -o json 2>/dev/null | grep gitVersion)"
# ── 1. Ensure namespace ──────────────────────────────────────────────
log "Ensuring namespace $NAMESPACE exists..."
# ── 1. Ensure namespace with Helm ownership ──────────────────────────
log "Ensuring namespace $NAMESPACE exists with Helm ownership..."
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
kubectl label namespace "$NAMESPACE" app.kubernetes.io/managed-by=Helm --overwrite
kubectl label namespace "$NAMESPACE" meta.helm.sh/release-name="$RELEASE" --overwrite
kubectl label namespace "$NAMESPACE" meta.helm.sh/release-namespace="$NAMESPACE" --overwrite
kubectl annotate namespace "$NAMESPACE" meta.helm.sh/release-name="$RELEASE" --overwrite
kubectl annotate namespace "$NAMESPACE" meta.helm.sh/release-namespace="$NAMESPACE" --overwrite
# ── 2. Ensure prerequisites ─────────────────────────────────────────
# ConfigMap (must exist before Helm install)

View File

@ -26,7 +26,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: email_worker
- name: email-worker
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}

View File

@ -26,7 +26,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: metrics_aggregator
- name: metrics-aggregator
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}

View File

@ -26,7 +26,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: static_server
- name: static-server
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}