Re-applying the independently-diagnosed Helm bug fix that got reverted
along with everything else a few rounds back (flagged at the time that
CI would hit this again the moment it wasn't reapplied -- it just did).
helm lint deploy/chart (the default 5-world values.yaml) fails:
templates/worlds.yaml: unable to parse YAML: error converting YAML
to JSON: yaml: line 24: did not find expected key
Root cause (confirmed earlier via `helm template --debug` on the raw,
pre-parse output): the per-world loop's `{{- $host := ... -}}` line has
a leading whitespace-trim that eats the one newline separating one
world's rendered manifests from the next world's "---" separator, so
consecutive iterations run together as "...port: { name: http } }---
apiVersion: apps/v1" with no newline -- invalid YAML. values-srs.yaml
only has one world, so the loop never repeats and never trips this;
the default values.yaml has five.
Fix: drop the leading trim (`{{-` -> `{{`) on just that line, so the
one separating newline survives.
Verified with the same helm v4.2.4 CI uses: `helm lint`/`helm template`
clean against both deploy/chart's default values (5 worlds) and
-f deploy/values-srs.yaml (1 world); rendered manifests for all 5
worlds look correct.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
122 lines
5.6 KiB
YAML
122 lines
5.6 KiB
YAML
{{- $root := . -}}
|
|
{{- $directory := list -}}
|
|
{{- $ids := dict -}}
|
|
{{- range .Values.worlds -}}
|
|
{{- if hasKey $ids .id -}}{{- fail "world IDs must be unique" -}}{{- end -}}
|
|
{{- $_ := set $ids .id true -}}
|
|
{{- $host := default .host $root.Values.portal.host -}}
|
|
{{- $directory = append $directory (dict "id" .id "url" (printf "https://%s/game?world=%s" $host .id)) -}}
|
|
{{- end -}}
|
|
{{- if and .Values.portal.host (not (hasKey $ids .Values.portal.primaryWorld)) -}}{{- fail "portal.primaryWorld must exist in worlds" -}}{{- end -}}
|
|
{{- range .Values.worlds }}
|
|
{{ $host := default .host $root.Values.portal.host -}}
|
|
{{- $primary := eq .id $root.Values.portal.primaryWorld -}}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ $root.Release.Name }}-{{ .id }}
|
|
labels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
|
|
spec:
|
|
replicas: 1
|
|
strategy: { type: Recreate }
|
|
revisionHistoryLimit: 3
|
|
selector:
|
|
matchLabels: { app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
|
|
template:
|
|
metadata:
|
|
labels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
terminationGracePeriodSeconds: 30
|
|
imagePullSecrets: {{ $root.Values.imagePullSecrets | toJson }}
|
|
{{- if $root.Values.databaseCA.configMap }}
|
|
volumes:
|
|
- name: postgres-ca
|
|
configMap:
|
|
name: {{ $root.Values.databaseCA.configMap | quote }}
|
|
{{- end }}
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 65532
|
|
runAsGroup: 65532
|
|
seccompProfile: { type: RuntimeDefault }
|
|
containers:
|
|
- name: world
|
|
image: {{ if $root.Values.image.digest }}{{ printf "%s@%s" $root.Values.image.repository $root.Values.image.digest | quote }}{{ else }}{{ printf "%s:%s" $root.Values.image.repository $root.Values.image.tag | quote }}{{ end }}
|
|
imagePullPolicy: IfNotPresent
|
|
{{- if $root.Values.databaseCA.configMap }}
|
|
volumeMounts:
|
|
- name: postgres-ca
|
|
mountPath: /etc/postgres-ca
|
|
readOnly: true
|
|
{{- end }}
|
|
ports: [{ name: http, containerPort: 8080 }]
|
|
securityContext:
|
|
readOnlyRootFilesystem: true
|
|
allowPrivilegeEscalation: false
|
|
capabilities: { drop: [ALL] }
|
|
env:
|
|
- { name: APP_ENV, value: production }
|
|
- { name: LISTEN_ADDR, value: "0.0.0.0:8080" }
|
|
- { name: WORLD_ID, value: {{ .id | quote }} }
|
|
- { name: WORLD_SEED, value: {{ .seed | quote }} }
|
|
- { name: PUBLIC_URL, value: {{ printf "https://%s" $host | quote }} }
|
|
- { name: WORLD_DIRECTORY, value: {{ $directory | toJson | quote }} }
|
|
- { name: OIDC_ADMIN_ROLE, value: {{ $root.Values.control.adminRole | quote }} }
|
|
- { name: CONTROL_PRIMARY, value: {{ $primary | quote }} }
|
|
{{- if and $primary $root.Values.control.existingSecret }}
|
|
- { name: CONTROL_GITOPS_REPOSITORY, value: {{ $root.Values.control.gitopsRepository | quote }} }
|
|
- { name: CONTROL_GITOPS_BRANCH, value: {{ $root.Values.control.gitopsBranch | quote }} }
|
|
- { name: CONTROL_GITOPS_VALUES_FILE, value: {{ $root.Values.control.gitopsValuesFile | quote }} }
|
|
{{- end }}
|
|
envFrom:
|
|
- secretRef: { name: {{ $root.Values.existingSecret | quote }} }
|
|
{{- if and $primary $root.Values.control.existingSecret }}
|
|
- secretRef: { name: {{ $root.Values.control.existingSecret | quote }} }
|
|
{{- end }}
|
|
resources: {{ $root.Values.resources | toJson }}
|
|
startupProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 5, failureThreshold: 24 }
|
|
readinessProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 3, failureThreshold: 2 }
|
|
livenessProbe: { httpGet: { path: /healthz, port: http }, periodSeconds: 10, failureThreshold: 3 }
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $root.Release.Name }}-{{ .id }}
|
|
spec:
|
|
selector: { app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
|
|
ports: [{ name: http, port: 8080, targetPort: http }]
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: {{ $root.Release.Name }}-{{ .id }}
|
|
annotations:
|
|
{{- if and $root.Values.ingress.clusterIssuer (or $primary (not $root.Values.portal.host)) }}
|
|
cert-manager.io/cluster-issuer: {{ $root.Values.ingress.clusterIssuer | quote }}
|
|
{{- end }}
|
|
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
|
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
|
nginx.ingress.kubernetes.io/proxy-body-size: "8k"
|
|
nginx.ingress.kubernetes.io/limit-rps: "10"
|
|
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
|
spec:
|
|
ingressClassName: {{ $root.Values.ingress.className | quote }}
|
|
tls: [{ hosts: [{{ $host | quote }}], secretName: {{ $root.Values.ingress.tlsSecret | quote }} }]
|
|
rules:
|
|
- host: {{ $host | quote }}
|
|
http:
|
|
paths:
|
|
- path: {{ printf "/worlds/%s" .id }}
|
|
pathType: Prefix
|
|
backend:
|
|
service: { name: {{ $root.Release.Name }}-{{ .id }}, port: { name: http } }
|
|
{{- if or $primary (not $root.Values.portal.host) }}
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service: { name: {{ $root.Release.Name }}-{{ .id }}, port: { name: http } }
|
|
{{- end }}
|
|
{{- end }}
|