diff --git a/charts/keeptrack/CONTRIBUTING.md b/charts/keeptrack/CONTRIBUTING.md index 1d9dcf5..9e8b355 100644 --- a/charts/keeptrack/CONTRIBUTING.md +++ b/charts/keeptrack/CONTRIBUTING.md @@ -42,6 +42,7 @@ kubectl create secret generic keeptrack-app \ --from-literal=tmdbapikey='***' \ --from-literal=rawgapikey='***' \ --from-literal=discogstoken='***' \ + --from-literal=googlebooksApiKey='***' \ --namespace demo ``` @@ -90,6 +91,10 @@ webapi: tokenSecretKeyRef: name: keeptrack-app key: discogstoken + googlebooks: + apiKeySecretKeyRef: + name: keeptrack-app + key: googlebooksApiKey ingress: enabled: true diff --git a/charts/keeptrack/Chart.yaml b/charts/keeptrack/Chart.yaml index 819c59c..3d516fb 100644 --- a/charts/keeptrack/Chart.yaml +++ b/charts/keeptrack/Chart.yaml @@ -2,8 +2,8 @@ name: keeptrack description: Helm chart for Keeptrack type: application -version: 0.2.2 -appVersion: "2.1" +version: 0.2.3 +appVersion: "2.3" home: https://github.com/devpro/keeptrack sources: - https://github.com/devpro/keeptrack diff --git a/charts/keeptrack/templates/deployment.yaml b/charts/keeptrack/templates/deployment.yaml index a016cd9..6cece97 100644 --- a/charts/keeptrack/templates/deployment.yaml +++ b/charts/keeptrack/templates/deployment.yaml @@ -245,6 +245,16 @@ spec: - name: Discogs__Token value: {{ .referenceData.discogs.token | quote }} {{- end }} + {{- if .referenceData.googlebooks.apiKeySecretKeyRef }} + - name: GoogleBooks__ApiKey + valueFrom: + secretKeyRef: + name: {{ .referenceData.googlebooks.apiKeySecretKeyRef.name }} + key: {{ .referenceData.googlebooks.apiKeySecretKeyRef.key }} + {{- else }} + - name: GoogleBooks__ApiKey + value: {{ .referenceData.googlebooks.apiKey | quote }} + {{- end }} {{- end }} restartPolicy: Always {{- if $.Values.security.hardened.enabled }} diff --git a/charts/keeptrack/values.yaml b/charts/keeptrack/values.yaml index ad9f792..2b530ac 100644 --- a/charts/keeptrack/values.yaml +++ b/charts/keeptrack/values.yaml @@ -8,7 +8,7 @@ healthEndpoint: /health tls: secretName: keeptrack-blazorapp-tls - tag: 2.1.29541631973 # ref. https://hub.docker.com/r/devprofr/keeptrack-blazorapp/tags + tag: 2.3.29668982088 # ref. https://hub.docker.com/r/devprofr/keeptrack-blazorapp/tags replicaCount: 1 resources: {} # limits: @@ -54,7 +54,7 @@ webapi: secretName: keeptrack-webapi-tls host: "" replicaCount: 1 - tag: 2.1.29541631973 # ref. https://hub.docker.com/r/devprofr/keeptrack-webapi/tags + tag: 2.3.29668982088 # ref. https://hub.docker.com/r/devprofr/keeptrack-webapi/tags resources: {} extraEnv: [] additionalPodLabels: {} @@ -91,6 +91,11 @@ webapi: # name: "" # key: "" token: "" + googlebooks: + # apiKeySecretKeyRef: + # name: "" + # key: "" + apiKey: "" dotnet: environment: Production diff --git a/charts/liveship/.helmignore b/charts/liveship/.helmignore new file mode 100644 index 0000000..bfaad30 --- /dev/null +++ b/charts/liveship/.helmignore @@ -0,0 +1,9 @@ +.git/ +.gitignore +.helmignore +*.orig +*.swp +*.bak +values.mine.yaml +temp*.yaml +kubeconfig diff --git a/charts/liveship/CONTRIBUTING.md b/charts/liveship/CONTRIBUTING.md new file mode 100644 index 0000000..3443a5e --- /dev/null +++ b/charts/liveship/CONTRIBUTING.md @@ -0,0 +1,64 @@ +# Contribution guide + +## Update chart dependencies + +Add the Bitnami Helm repository: + +```bash +helm repo add bitnami https://charts.bitnami.com/bitnami +helm repo update +``` + +Look for existing versions: + +```bash +helm search repo -l mongodb --versions +``` + +Manually edit `Chart.yaml` with the version. + +Update `Chart.lock` and fetch the archive into `charts/` (gitignored, rebuilt from `Chart.lock` by anyone who needs it): + +```bash +helm dependency update . +``` + +Note: Bitnami's index currently redirects some downloads to `oci://registry-1.docker.io/bitnamicharts`, which can fail with a 401 for older versions. +The same `mongodb-18.6.16.tgz` is used by the sidelab and keeptrack charts — copying it from a sibling `charts/` directory is a valid workaround as long as the version matches. + +## Review the generated manifest + +```bash +helm template liveship . -f values.yaml -f values.mine.yaml --namespace liveship --debug > temp.yaml +``` + +Useful sanity checks on the output: `helm template liveship .` with nothing set must fail fast asking for a database; +`--set mongodb.enabled=true` alone must fail asking for `mongodb.auth.rootPassword`; +`--set ingress.enabled=true` without a host, or an `auth.encryptionKey` that isn't 64 hex characters, must fail with a clear message rather than render something broken. + +## Validate on a local cluster + +The image is private on GHCR for now — create the pull secret first: + +```bash +kubectl create secret docker-registry ghcr-pull -n liveship \ + --docker-server=ghcr.io --docker-username= --docker-password= +``` + +Then a minimal `values.mine.yaml` for a demo install: + +```yaml +imagePullSecrets: + - name: ghcr-pull +mongodb: + enabled: true + auth: + rootPassword: "change-me" +``` + +```bash +helm upgrade --install liveship . -f values.mine.yaml --namespace liveship --create-namespace +``` + +Follow the printed NOTES.txt to seed the first admin user and port-forward to the app. +Verify login works end-to-end (that exercises MongoDB, `NEXTAUTH_SECRET`, and `NEXTAUTH_URL` at once), then create a connection and re-open it after `kubectl rollout restart` (that exercises `ENCRYPTION_KEY` stability). diff --git a/charts/liveship/Chart.lock b/charts/liveship/Chart.lock new file mode 100644 index 0000000..bcbdd1b --- /dev/null +++ b/charts/liveship/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: mongodb + repository: https://charts.bitnami.com/bitnami + version: 18.6.16 +digest: sha256:889cbf07e49e630d28dc8a1c72fdd0465f3f0f0c1601b3be559940108bb50ab2 +generated: "2026-07-11T01:36:26.300038311+02:00" diff --git a/charts/liveship/Chart.yaml b/charts/liveship/Chart.yaml new file mode 100644 index 0000000..5b034ba --- /dev/null +++ b/charts/liveship/Chart.yaml @@ -0,0 +1,25 @@ +apiVersion: v2 +name: liveship +description: > + One platform for an organization's infrastructure, security posture, and code. + Deploys the Liveship application, which reads the same MongoDB database terraform-backend-mongodb writes to. +type: application +version: 0.1.0 +appVersion: "0.1.0" +keywords: + - liveship + - infrastructure + - kubernetes + - terraform +home: https://github.com/devpro/helm-charts +sources: + - https://github.com/devpro/liveship +dependencies: + - name: mongodb + version: 18.6.16 # MongoDB 8.2.6 + repository: https://charts.bitnami.com/bitnami + alias: mongodb + condition: mongodb.enabled +maintainers: + - name: devpro + email: bertrand@devpro.fr diff --git a/charts/liveship/README.md b/charts/liveship/README.md new file mode 100644 index 0000000..76677f5 --- /dev/null +++ b/charts/liveship/README.md @@ -0,0 +1,61 @@ +# Liveship Helm Chart + +Helm chart for [Liveship](https://github.com/devpro/liveship) — one platform for an organization's infrastructure, security posture, and code. +Deploys the Liveship application (Next.js + MongoDB), which reads the same database [terraform-backend-mongodb](../terraform-backend-mongodb) writes to — point both charts at the same MongoDB to get the Terraform state views. + +`values.yaml` is the source of truth for every option — it's fully commented. + +## Quick Start + +Add the chart repository: + +```bash +helm repo add devpro https://devpro.github.io/helm-charts +helm repo update +``` + +Create a `values.yaml` file to override [default values](values.yaml). +Two things are always required: + +- **Image pull credentials** — the `ghcr.io/devpro/liveship` image is private for now: + + ```bash + kubectl create secret docker-registry ghcr-pull -n liveship \ + --docker-server=ghcr.io --docker-username= --docker-password= + ``` + + then set `imagePullSecrets: [{name: ghcr-pull}]`. +- **A MongoDB** — one of `database.uri`, `database.existingSecret`, or `mongodb.enabled=true` (bundled demo instance; also set `mongodb.auth.rootPassword`). + The chart fails fast at render time when none is set. + +Install the application: + +```bash +helm upgrade --install liveship devpro/liveship -f values.yaml --namespace liveship --create-namespace +``` + +`NEXTAUTH_SECRET` and `ENCRYPTION_KEY` are auto-generated on first install and kept stable across upgrades. +Under GitOps (ArgoCD/Flux), set `auth.existingSecret` instead — offline rendering would rotate them on every sync, and a rotated `ENCRYPTION_KEY` makes stored connection credentials permanently undecryptable (see `values.yaml`). + +The first admin user is seeded with the `seed-admin.mjs` script from the liveship repo — `helm install` prints the exact commands (NOTES.txt). + +## Scaling & high availability + +The app is stateless and scales horizontally with no extra configuration: set `replicaCount` (or `autoscaling.enabled=true`), optionally with `podDisruptionBudget.enabled=true`. + +What makes this safe (verified against the app's source): + +- Sessions are stateless NextAuth JWT cookies — any replica can validate any user's cookie, since all replicas share the chart's single `NEXTAUTH_SECRET`. + No sticky sessions needed. +- All application state and every cache (Kubernetes resource-type discovery, git repository cache, login lockout counters) live in MongoDB, shared by all replicas. +- Stored credentials are encrypted with the shared `ENCRYPTION_KEY` env var — every replica can decrypt what any other stored. +- Nothing is written to the local filesystem, and there are no in-process background jobs to run twice. + +## Uninstall + +```bash +helm uninstall liveship -n liveship +kubectl delete namespace liveship +``` + +The auto-generated `-auth` Secret is deleted along with the namespace — its `ENCRYPTION_KEY` is the only way to decrypt stored connection credentials, so back it up first if the database outlives the release. diff --git a/charts/liveship/ci/ci-values.yaml b/charts/liveship/ci/ci-values.yaml new file mode 100644 index 0000000..2fcf3bf --- /dev/null +++ b/charts/liveship/ci/ci-values.yaml @@ -0,0 +1,2 @@ +database: + uri: mongodb://ci-dummy-mongo:27017 diff --git a/charts/liveship/templates/NOTES.txt b/charts/liveship/templates/NOTES.txt new file mode 100644 index 0000000..6528be7 --- /dev/null +++ b/charts/liveship/templates/NOTES.txt @@ -0,0 +1,86 @@ +🎉 Liveship has been deployed! + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Application URL +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +{{- if .Values.ingress.enabled }} + {{ include "liveship.nextauthUrl" . }} +{{- if .Values.ingress.tls.enabled }} + + The TLS certificate is issued automatically by cert-manager, if configured + via a cert-manager.io/cluster-issuer annotation. Allow 1-2 minutes for it + to become ready: + + kubectl get certificate -n {{ .Release.Namespace }} -w +{{- end }} +{{- else }} + Port-forward to access the app locally: + + kubectl port-forward -n {{ .Release.Namespace }} \ + svc/{{ include "liveship.fullname" . }} 3000:{{ .Values.service.port }} + + Then open: http://localhost:3000 + (NEXTAUTH_URL defaults to exactly that, so login works out of the box — + see auth.url in values.yaml before putting this behind a real hostname.) +{{- end }} + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + First login +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + The app has no built-in signup — the first global_admin user is seeded + directly into MongoDB with the seed script from the liveship repo: + +{{- if and .Values.mongodb.enabled (not .Values.database.uri) (not .Values.database.existingSecret) }} + + kubectl port-forward -n {{ .Release.Namespace }} svc/{{ .Release.Name }}-mongodb 27017:27017 + + then, from a checkout of https://github.com/devpro/liveship: + + MONGODB_URI='mongodb://root:@localhost:27017/?authSource=admin' \ + MONGODB_DB='{{ .Values.database.name }}' \ + node scripts/seed-admin.mjs --username admin --password +{{- else }} + + From a checkout of https://github.com/devpro/liveship, pointed at the + same MongoDB this release uses: + + MONGODB_URI='' MONGODB_DB='{{ .Values.database.name }}' \ + node scripts/seed-admin.mjs --username admin --password + + Not needed if terraform-backend-mongodb (or a previous install) already + seeded users into this database — they log straight in. +{{- end }} + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Back up the encryption key +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +{{- if .Values.auth.existingSecret }} + Managed by you, in Secret/{{ .Values.auth.existingSecret }} (key ENCRYPTION_KEY). +{{- else }} + ENCRYPTION_KEY encrypts every stored connection credential (cloud keys, + cluster tokens, registry passwords). If the Secret is lost, that data is + permanently undecryptable. Save a copy somewhere safe: + + kubectl get secret -n {{ .Release.Namespace }} {{ include "liveship.authSecretName" . }} \ + -o jsonpath='{.data.ENCRYPTION_KEY}' | base64 -d; echo +{{- end }} + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Database +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Database: {{ .Values.database.name }} +{{- if and .Values.mongodb.enabled (not .Values.database.uri) (not .Values.database.existingSecret) }} + Using the bundled MongoDB chart — fine for a demo, not backed up. Point + database.uri at a real MongoDB before you rely on this data. +{{- end }} + Terraform state views expect terraform-backend-mongodb writing to this + same database — point both charts at the same instance. + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Useful commands +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + # Watch the app Pods + kubectl get pods -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} -w + + # Tail app logs + kubectl logs -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} -f diff --git a/charts/liveship/templates/_helpers.tpl b/charts/liveship/templates/_helpers.tpl new file mode 100644 index 0000000..a262265 --- /dev/null +++ b/charts/liveship/templates/_helpers.tpl @@ -0,0 +1,181 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "liveship.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +Truncated to 63 chars because some Kubernetes name fields have this limit. +*/}} +{{- define "liveship.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart label value (name + version). +*/}} +{{- define "liveship.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels applied to all resources. +*/}} +{{- define "liveship.labels" -}} +helm.sh/chart: {{ include "liveship.chart" . }} +{{ include "liveship.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels (used by Service and Deployment). +*/}} +{{- define "liveship.selectorLabels" -}} +app.kubernetes.io/name: {{ include "liveship.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +ServiceAccount name. +*/}} +{{- define "liveship.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "liveship.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Name of the auth Secret (NEXTAUTH_SECRET / ENCRYPTION_KEY keys). +*/}} +{{- define "liveship.authSecretName" -}} +{{- if .Values.auth.existingSecret }} +{{- .Values.auth.existingSecret }} +{{- else }} +{{- printf "%s-auth" (include "liveship.fullname" .) }} +{{- end }} +{{- end }} + +{{/* +Name of the MongoDB connection Secret (MONGODB_URI key). +*/}} +{{- define "liveship.mongoSecretName" -}} +{{- if .Values.database.existingSecret }} +{{- .Values.database.existingSecret }} +{{- else }} +{{- printf "%s-mongo" (include "liveship.fullname" .) }} +{{- end }} +{{- end }} + +{{/* +Image tag — falls back to .Chart.AppVersion. +*/}} +{{- define "liveship.imageTag" -}} +{{- .Values.image.tag | default .Chart.AppVersion }} +{{- end }} + +{{/* +External URL of the app (NEXTAUTH_URL). auth.url wins; otherwise derived from +the ingress host and TLS setting; otherwise localhost:3000, which matches the +kubectl port-forward instructions in NOTES.txt (NextAuth builds every +login/callback redirect from this value, so it has to be what the browser uses). +*/}} +{{- define "liveship.nextauthUrl" -}} +{{- if .Values.auth.url -}} +{{- .Values.auth.url -}} +{{- else if and .Values.ingress.enabled .Values.ingress.host -}} +{{- printf "http%s://%s" (ternary "s" "" .Values.ingress.tls.enabled) .Values.ingress.host -}} +{{- else -}} +http://localhost:3000 +{{- end -}} +{{- end }} + +{{/* +MongoDB connection string. +database.uri wins; +otherwise, if the bundled mongodb subchart is enabled, derived from its default standalone Service name +("-mongodb", per the alias in Chart.yaml and the Bitnami chart's own naming convention) and mongodb.auth.rootPassword. +The database itself is selected by MONGODB_DB (database.name), not the URI path. +Only called from secret.yaml when database.existingSecret is not set. +*/}} +{{- define "liveship.mongoUri" -}} +{{- if .Values.database.uri -}} +{{- .Values.database.uri -}} +{{- else if .Values.mongodb.enabled -}} +{{- printf "mongodb://root:%s@%s-mongodb:27017/?authSource=admin" .Values.mongodb.auth.rootPassword .Release.Name -}} +{{- end -}} +{{- end }} + +{{/* +NextAuth secret — auth.nextauthSecret wins; otherwise reused from the existing Secret on upgrade (via lookup), or freshly generated on first install. +`lookup` returns nothing outside a real cluster (e.g. `helm template`), so offline rendering always generates a fresh value — +expected, and harmless for a dry render. +Only called from secret.yaml when auth.existingSecret is not set. +*/}} +{{- define "liveship.nextauthSecret" -}} +{{- if .Values.auth.nextauthSecret -}} +{{- .Values.auth.nextauthSecret -}} +{{- else -}} +{{- $existing := lookup "v1" "Secret" .Release.Namespace (include "liveship.authSecretName" .) -}} +{{- if and $existing $existing.data (hasKey $existing.data "NEXTAUTH_SECRET") -}} +{{- index $existing.data "NEXTAUTH_SECRET" | b64dec -}} +{{- else -}} +{{- randAlphaNum 48 -}} +{{- end -}} +{{- end -}} +{{- end }} + +{{/* +Encryption key — same reuse-then-generate pattern as liveship.nextauthSecret above, +except the generated value must be exactly 64 hex characters (the app enforces +a 32-byte hex key): sha256sum of a random string gives exactly that. +Only called from secret.yaml when auth.existingSecret is not set. +*/}} +{{- define "liveship.encryptionKey" -}} +{{- if .Values.auth.encryptionKey -}} +{{- .Values.auth.encryptionKey -}} +{{- else -}} +{{- $existing := lookup "v1" "Secret" .Release.Namespace (include "liveship.authSecretName" .) -}} +{{- if and $existing $existing.data (hasKey $existing.data "ENCRYPTION_KEY") -}} +{{- index $existing.data "ENCRYPTION_KEY" | b64dec -}} +{{- else -}} +{{- randAlphaNum 64 | sha256sum -}} +{{- end -}} +{{- end -}} +{{- end }} + +{{/* +Validate required values and emit a clear error message. +*/}} +{{- define "liveship.validateValues" -}} +{{- if not .Values.image.repository }} +{{- fail "image.repository is required." }} +{{- end }} +{{- if and (not .Values.database.uri) (not .Values.database.existingSecret) (not .Values.mongodb.enabled) }} +{{- fail "A MongoDB is required: set one of database.uri, database.existingSecret, or mongodb.enabled=true." }} +{{- end }} +{{- if and .Values.mongodb.enabled (not .Values.database.uri) (not .Values.database.existingSecret) (not .Values.mongodb.auth.rootPassword) }} +{{- fail "mongodb.auth.rootPassword is required when mongodb.enabled=true (unless database.uri or database.existingSecret is set instead)." }} +{{- end }} +{{- if and .Values.ingress.enabled (not .Values.ingress.host) }} +{{- fail "ingress.host is required when ingress.enabled=true." }} +{{- end }} +{{- if and .Values.auth.encryptionKey (not (regexMatch "^[0-9a-fA-F]{64}$" .Values.auth.encryptionKey)) }} +{{- fail "auth.encryptionKey must be exactly 64 hex characters (openssl rand -hex 32) — the app refuses any other shape at startup." }} +{{- end }} +{{- end }} diff --git a/charts/liveship/templates/configmap.yaml b/charts/liveship/templates/configmap.yaml new file mode 100644 index 0000000..a999969 --- /dev/null +++ b/charts/liveship/templates/configmap.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "liveship.fullname" . }}-config + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +data: + MONGODB_DB: {{ .Values.database.name | quote }} + # What the browser uses to reach the app — NextAuth builds login/callback + # redirects from this, so a wrong value breaks sign-in, not just links. + NEXTAUTH_URL: {{ include "liveship.nextauthUrl" . | quote }} + {{- if .Values.otel.endpoint }} + OTEL_EXPORTER_OTLP_ENDPOINT: {{ .Values.otel.endpoint | quote }} + OTEL_SERVICE_NAME: {{ .Values.otel.serviceName | quote }} + {{- end }} diff --git a/charts/liveship/templates/deployment.yaml b/charts/liveship/templates/deployment.yaml new file mode 100644 index 0000000..919fd10 --- /dev/null +++ b/charts/liveship/templates/deployment.yaml @@ -0,0 +1,109 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "liveship.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: + # No local state at all (see the replicaCount note in values.yaml) — + # always safe to roll without downtime. + type: RollingUpdate + selector: + matchLabels: + {{- include "liveship.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "liveship.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + # forces a rollout when the rendered ConfigMap/Secret content changes, + # even if the image tag doesn't — env vars are only read at container + # start, so Kubernetes won't otherwise notice a ConfigMap/Secret edit. + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "liveship.serviceAccountName" . }} + automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} + restartPolicy: Always + {{- if .Values.podSecurityContext }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- end }} + containers: + - name: liveship + image: "{{ .Values.image.repository }}:{{ include "liveship.imageTag" . }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.containerSecurityContext }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + envFrom: + - configMapRef: + name: {{ include "liveship.fullname" . }}-config + # The Secrets' keys match the app's env var names exactly + # (envFrom has no per-key rename). + - secretRef: + name: {{ include "liveship.authSecretName" . }} + - secretRef: + name: {{ include "liveship.mongoSecretName" . }} + {{- with .Values.extraEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + volumeMounts: + # Writable /tmp and Next.js runtime cache (image optimizer etc.) — + # both emptyDirs, so containerSecurityContext.readOnlyRootFilesystem + # can be enabled without further changes. Per-Pod caches, not shared + # state: nothing the app relies on across replicas or restarts. + - name: tmp + mountPath: /tmp + - name: next-cache + mountPath: /app/.next/cache + {{- with .Values.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: tmp + emptyDir: {} + - name: next-cache + emptyDir: {} + {{- with .Values.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/liveship/templates/hpa.yaml b/charts/liveship/templates/hpa.yaml new file mode 100644 index 0000000..b161f66 --- /dev/null +++ b/charts/liveship/templates/hpa.yaml @@ -0,0 +1,23 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "liveship.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "liveship.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/charts/liveship/templates/ingress.yaml b/charts/liveship/templates/ingress.yaml new file mode 100644 index 0000000..2c5a6c6 --- /dev/null +++ b/charts/liveship/templates/ingress.yaml @@ -0,0 +1,35 @@ +{{- if .Values.ingress.enabled }} +{{- include "liveship.validateValues" . }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "liveship.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.ingress.host | quote }} + secretName: {{ .Values.ingress.tls.secretName }} + {{- end }} + rules: + - host: {{ .Values.ingress.host | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "liveship.fullname" . }} + port: + name: http +{{- end }} diff --git a/charts/liveship/templates/pdb.yaml b/charts/liveship/templates/pdb.yaml new file mode 100644 index 0000000..b503b66 --- /dev/null +++ b/charts/liveship/templates/pdb.yaml @@ -0,0 +1,14 @@ +{{- if .Values.podDisruptionBudget.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "liveship.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +spec: + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} + selector: + matchLabels: + {{- include "liveship.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/liveship/templates/secret.yaml b/charts/liveship/templates/secret.yaml new file mode 100644 index 0000000..cd71341 --- /dev/null +++ b/charts/liveship/templates/secret.yaml @@ -0,0 +1,29 @@ +{{- include "liveship.validateValues" . }} +{{- if not .Values.auth.existingSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "liveship.authSecretName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +type: Opaque +stringData: + NEXTAUTH_SECRET: {{ include "liveship.nextauthSecret" . | quote }} + # Losing this key makes every stored connection credential undecryptable — + # see the warning on auth.encryptionKey in values.yaml. + ENCRYPTION_KEY: {{ include "liveship.encryptionKey" . | quote }} +{{- end }} +{{- if not .Values.database.existingSecret }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "liveship.mongoSecretName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +type: Opaque +stringData: + MONGODB_URI: {{ include "liveship.mongoUri" . | quote }} +{{- end }} diff --git a/charts/liveship/templates/service.yaml b/charts/liveship/templates/service.yaml new file mode 100644 index 0000000..5071233 --- /dev/null +++ b/charts/liveship/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "liveship.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + {{- include "liveship.selectorLabels" . | nindent 4 }} diff --git a/charts/liveship/templates/serviceaccount.yaml b/charts/liveship/templates/serviceaccount.yaml new file mode 100644 index 0000000..e89de37 --- /dev/null +++ b/charts/liveship/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "liveship.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "liveship.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/liveship/values.yaml b/charts/liveship/values.yaml new file mode 100644 index 0000000..c6988e1 --- /dev/null +++ b/charts/liveship/values.yaml @@ -0,0 +1,235 @@ +# ── Image ───────────────────────────────────────────────────────────────────── +image: + # The liveship image is published to GitHub Container Registry as a private + # package for now — set imagePullSecrets below with GHCR credentials + # (a PAT with read:packages) or the pull will fail with ImagePullBackOff. + repository: ghcr.io/devpro/liveship + pullPolicy: IfNotPresent + # -- Defaults to .Chart.AppVersion when empty. + tag: "" + +# -- Required while the GHCR image is private, e.g.: +# kubectl create secret docker-registry ghcr-pull \ +# --docker-server=ghcr.io --docker-username= --docker-password= +imagePullSecrets: [] + # - name: ghcr-pull + +nameOverride: "" +fullnameOverride: "" + +# The app is stateless by design: sessions are JWT cookies (NextAuth), every +# cache (Kubernetes resource-type discovery, git repository cache) lives in +# MongoDB, and nothing is written to the local filesystem. Scaling out needs +# nothing beyond raising this — all replicas just have to share the same +# NEXTAUTH_SECRET and ENCRYPTION_KEY, which the chart's single Secret already +# guarantees. See also autoscaling and podDisruptionBudget below. +replicaCount: 1 + +# ── Auth & encryption ───────────────────────────────────────────────────────── +auth: + # -- NextAuth JWT signing secret (NEXTAUTH_SECRET). + # Leave empty to auto-generate a strong random value on first install — it is then kept stable across upgrades (read back from the existing Secret). + # Rotating it logs every user out (their session cookies stop validating) but loses no data. + nextauthSecret: "" + + # -- AES-256-GCM key encrypting stored connection credentials at rest (ENCRYPTION_KEY) — cloud provider keys, cluster tokens, registry passwords. + # Must be exactly 64 hex characters (openssl rand -hex 32); the chart fails at render time otherwise. + # Leave empty to auto-generate on first install (kept stable across upgrades). + # WARNING: unlike nextauthSecret, losing or rotating this key makes every stored credential permanently undecryptable — + # every connection would have to be re-entered by hand. Back up the Secret (see NOTES.txt after install). + encryptionKey: "" + + # -- External URL of the app (NEXTAUTH_URL) — what users type in their browser. + # Leave empty to derive it from the ingress section below ("https://"), + # falling back to "http://localhost:3000" (fine for kubectl port-forward) when the ingress is disabled. + url: "" + + # -- Use your own pre-created Secret instead of the two secret fields above. + # Keys expected: NEXTAUTH_SECRET, ENCRYPTION_KEY. + # GitOps note (ArgoCD/Flux): those tools render templates offline, where the auto-generate-then-reuse trick above can't look up the existing Secret — + # so every sync would rotate both values, and a rotated ENCRYPTION_KEY makes stored credentials undecryptable (see the warning above). + # Under GitOps, always set this (or both fields explicitly). + existingSecret: "" + +# ── Database ────────────────────────────────────────────────────────────────── +# Liveship reads the same MongoDB database terraform-backend-mongodb writes to +# (tf_state, tf_state_lock, user, tenant collections) — point both charts at +# the same instance and database name to get the Terraform state views. +database: + # -- Full MongoDB connection string, e.g. mongodb+srv://user:pass@cluster.mongodb.net + # (database selection is via database.name below, not the URI path). + # Not needed if mongodb.enabled=true below — the chart wires that up for you. + uri: "" + + # -- Database name (MONGODB_DB). The app's own default; matches what + # terraform-backend-mongodb uses so the two share data out of the box. + name: "terraform_backend" + + # -- Use your own pre-created Secret instead of database.uri. + # Key expected: MONGODB_URI. Takes priority over database.uri and over the + # bundled mongodb chart below. + existingSecret: "" + +# ── Bundled MongoDB (optional, for a quick disposable demo) ─────────────────── +# Deploys https://github.com/bitnami/charts/blob/main/bitnami/mongodb/values.yaml +# as a subchart alongside the app. Off by default — prefer a real, backed-up +# MongoDB (Atlas or self-hosted) for anything you care about; this is +# uncomfortable to lose, since it's just another Pod with a PVC, not a managed +# database. +# +# When enabled, the chart auto-builds database.uri's connection string from +# mongodb.auth.rootPassword — set that one field and the wiring is automatic. +# database.uri / database.existingSecret, if set, always take priority over +# this (so you can point at an external Mongo even with an unrelated +# mongodb.enabled=true left over from testing). +mongodb: + enabled: false + architecture: standalone + auth: + enabled: true + # -- Required when mongodb.enabled=true, unless database.uri or + # database.existingSecret is set instead. + # This is intentionally not auto-generated: the same value has to reach + # both this subchart's own root user AND the app's connection string, + # and Helm cannot pass a chart-generated value into a subchart's values. + rootPassword: "" + image: + registry: docker.io + repository: bitnami/mongodb # other options: chainguard/mongodb + tag: latest # IMPORTANT: latest should never be used in production + persistence: + enabled: true + size: 4Gi + global: + security: + allowInsecureImages: true + # -- Uncomment to point the subchart at a specific cluster storage class. + # global: + # defaultStorageClass: "" + +# ── OpenTelemetry (optional) ────────────────────────────────────────────────── +otel: + # -- OTLP collector endpoint, e.g. "http://otel-collector:4318". + # Leave empty to disable tracing/log export entirely (the app checks this + # exact variable). All standard OTEL_* env vars are honoured — use extraEnv + # below for the less common ones (OTEL_EXPORTER_OTLP_HEADERS, etc.). + endpoint: "" + serviceName: "liveship" + +# ── Service ─────────────────────────────────────────────────────────────────── +service: + # -- ClusterIP, NodePort, or LoadBalancer. + type: ClusterIP + port: 3000 + # -- Only used when service.type=NodePort. Leave empty to let Kubernetes pick one. + nodePort: "" + +# ── Ingress ─────────────────────────────────────────────────────────────────── +ingress: + # -- Off by default so a first install doesn't need an ingress controller. + enabled: false + # -- e.g. "public" or "nginx" for MicroK8s' bundled ingress-nginx, "traefik" for Traefik. + className: "" + # -- Hostname for the app, e.g. "liveship.example.com". Required when enabled. + host: "" + annotations: {} + # cert-manager.io/cluster-issuer: "letsencrypt-prod" + # traefik.ingress.kubernetes.io/router.entrypoints: websecure + # traefik.ingress.kubernetes.io/router.tls: "true" + tls: + # -- Requests a certificate automatically when a cert-manager ClusterIssuer + # annotation is present above. + enabled: false + secretName: "liveship-tls" + +# ── Security ────────────────────────────────────────────────────────────────── +# The image already runs as a dedicated non-root user (uid 1001, "nextjs") — +# the contexts below are extra hardening for clusters that mandate it +# explicitly, off by default so the chart runs unmodified on a plain cluster. +podSecurityContext: {} + # runAsNonRoot: true + # runAsUser: 1001 + # runAsGroup: 1001 + # seccompProfile: + # type: RuntimeDefault + +containerSecurityContext: {} + # allowPrivilegeEscalation: false + # readOnlyRootFilesystem: true + # capabilities: + # drop: + # - ALL + +# ── Resources ───────────────────────────────────────────────────────────────── +resources: {} + # requests: + # cpu: 100m + # memory: 256Mi + # limits: + # cpu: 500m + # memory: 512Mi + +# ── Probes ──────────────────────────────────────────────────────────────────── +# The app has no dedicated /healthz route — /login is served unauthenticated +# (everything else redirects there, which probes also accept) and proves the +# server is up and rendering. +livenessProbe: + httpGet: + path: /login + port: http + initialDelaySeconds: 15 + periodSeconds: 20 + failureThreshold: 3 + +readinessProbe: + httpGet: + path: /login + port: http + initialDelaySeconds: 5 + periodSeconds: 10 + failureThreshold: 3 + +# ── Autoscaling ─────────────────────────────────────────────────────────────── +# Safe to enable as-is — see the replicaCount note above for why multiple +# replicas need no extra configuration. +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 80 + +# ── Pod Disruption Budget ───────────────────────────────────────────────────── +# Off by default: with replicaCount 1, a PDB with minAvailable=1 blocks +# voluntary node drains from ever evicting the Pod. Makes sense once you run +# 2+ replicas. +podDisruptionBudget: + enabled: false + minAvailable: 1 + +# ── ServiceAccount ──────────────────────────────────────────────────────────── +serviceAccount: + create: true + annotations: {} + # -- Defaults to the chart's fullname. + name: "" + # -- The app never talks to its own cluster's API — Kubernetes clusters are + # browsed through credentials stored in the app, so the Pod needs no token. + automountServiceAccountToken: false + +# ── Scheduling ──────────────────────────────────────────────────────────────── +nodeSelector: {} +tolerations: [] +affinity: {} + +podAnnotations: {} +podLabels: {} + +# ── Extra environment variables passed to the app container ─────────────────── +# Example: +# extraEnv: +# - name: OTEL_EXPORTER_OTLP_HEADERS +# value: "authorization=Bearer xyz" +extraEnv: [] + +extraVolumes: [] +extraVolumeMounts: [] diff --git a/charts/sidelab/Chart.yaml b/charts/sidelab/Chart.yaml index b36908d..99e96da 100644 --- a/charts/sidelab/Chart.yaml +++ b/charts/sidelab/Chart.yaml @@ -4,7 +4,7 @@ description: > Self-hosted interactive lab platform. Deploys the Sidelab launcher, which manages lab sessions as ephemeral Kubernetes Pods inside tenant-scoped namespaces. type: application -version: 0.1.2 +version: 0.1.3 appVersion: "0.1.0" keywords: - sidelab diff --git a/charts/sidelab/templates/deployment.yaml b/charts/sidelab/templates/deployment.yaml index d5efc56..9f512de 100644 --- a/charts/sidelab/templates/deployment.yaml +++ b/charts/sidelab/templates/deployment.yaml @@ -8,10 +8,16 @@ metadata: spec: replicas: {{ .Values.replicaCount }} strategy: - # State is on a PVC with ReadWriteOnce (SQLite file, git course cache) and - # session tracking is in-memory — keep this Recreate, not RollingUpdate, - # so two Pods never run at once. + {{- if .Values.persistence.enabled }} + # The data PVC is ReadWriteOnce (SQLite file, git course cache), so two Pods + # must never run at once — Recreate, at the cost of brief dashboard downtime + # on upgrades. Lab sessions are unaffected either way: their Pods keep + # running and the launcher reconciles from the database on the way back up. type: Recreate + {{- else }} + # No PVC (mongo backend, no local state) — roll without downtime. + type: RollingUpdate + {{- end }} selector: matchLabels: {{- include "sidelab.selectorLabels" . | nindent 6 }} diff --git a/charts/sidelab/values.yaml b/charts/sidelab/values.yaml index cdbdb7e..1901373 100644 --- a/charts/sidelab/values.yaml +++ b/charts/sidelab/values.yaml @@ -1,4 +1,4 @@ -# ── Domain ──────────────────────────────────────────────────────────────────── +# ── Domain ──────────────────────────────────────────────────────────────────── # Single source of truth for hostnames, so you don't repeat your domain in multiple places. # Leave the two derived values below empty to use it: # ingress.host defaults to "sidelab." (the dashboard) @@ -20,10 +20,12 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" -# Session state (active sessions, port allocations, expiry timers) is kept in-memory by the launcher process — -# it is NOT shared across replicas and does NOT survive a restart. -# Keep this at 1 regardless of database backend; -# this is a known upstream limitation, not a SQLite-specific one. +# Session state lives in the database (shared across replicas, survives restarts +# and rollouts — lab pods keep running while the launcher restarts). +# More than 1 replica requires database.backend=mongo: sqlite is a single local +# file on a ReadWriteOnce PVC, which pins the launcher to one Pod regardless. +# When scaling out, also prefer launcher.labAccess=ingress — nodeport lab URLs +# are built from one node's IP. replicaCount: 1 # ── Auth ────────────────────────────────────────────────────────────────────── @@ -106,8 +108,10 @@ mongodb: persistence: # -- Enable a PersistentVolumeClaim for /app/data. - # Required for the sqlite backend. Recommended for the git course cache even - # with the mongo backend, so cloned course repos survive a Pod restart. + # Required for the sqlite backend. With the mongo backend the launcher keeps no + # local state at all (lab Pods clone courses themselves in an init container), + # so this can be disabled — which also unlocks RollingUpdate deployments and + # multiple replicas (see replicaCount above). enabled: true # -- Leave empty to use the cluster default. storageClass: "" @@ -149,12 +153,11 @@ launcher: # gets namespace "sidelab-admin" with the default prefix. namespacePrefix: "sidelab" - # -- Comma-separated list of tenant namespaces the launcher scans for orphan - # cleanup on startup and for terminating sessions it lost track of across a - # restart (delete-by-label fallback). The app does NOT discover these itself — - # left empty, the chart defaults to "-admin" (the seeded - # admin tenant). List every tenant namespace here once you add tenants, - # e.g. "sidelab-admin,sidelab-acme". + # -- Extra tenant namespaces for orphan cleanup and the delete-by-label + # fallback, comma-separated. Normally leave empty: the launcher discovers + # tenant namespaces itself via the app.kubernetes.io/managed-by=sidelab label + # it puts on every namespace it creates. Only needed for namespaces created + # by hand without that label, e.g. "sidelab-legacy". knownNamespaces: "" # Note: the git-clone init container used for git-sourced courses always runs @@ -241,9 +244,8 @@ readinessProbe: failureThreshold: 3 # ── Autoscaling ────────────────────────────────────────────────────────────────── -# Not supported: session state is in-memory per Pod (see replicaCount above). -# Left here, off, only so a future multi-replica launcher doesn't need a chart -# rewrite — do not enable this today. +# Only valid with database.backend=mongo and persistence.enabled=false — the same +# conditions as replicaCount > 1 (see above). Never enable it on sqlite. autoscaling: enabled: false minReplicas: 1 @@ -252,7 +254,8 @@ autoscaling: # ── Pod Disruption Budget ──────────────────────────────────────────────────────── # Off by default: with replicaCount 1, a PDB with minAvailable=1 blocks voluntary -# node drains from ever evicting the Pod. Only turn this on if that's what you want. +# node drains from ever evicting the Pod. Makes sense once you run 2+ replicas +# on the mongo backend (see replicaCount above). podDisruptionBudget: enabled: false minAvailable: 1 diff --git a/charts/terraform-backend-mongodb/CONTRIBUTING.md b/charts/terraform-backend-mongodb/CONTRIBUTING.md index 77046d1..76a7248 100644 --- a/charts/terraform-backend-mongodb/CONTRIBUTING.md +++ b/charts/terraform-backend-mongodb/CONTRIBUTING.md @@ -30,8 +30,9 @@ Create a `values.mine.yaml` file: ```yaml dotnet: environment: Development - enableSwagger: true - enableOpenTelemetry: false + enableScalar: true + openTelemetry: + enabled: false ingress: enabled: true className: traefik @@ -43,7 +44,7 @@ mongodb: rootPassword: admin webapi: db: - connectionString: mongodb://root:admin@tfbackend-mongodb:27017/tfbackend_beta?authSource=admin + # connectionString is auto-wired from mongodb.auth.rootPassword above databaseName: tfbackend_beta ``` @@ -56,10 +57,10 @@ helm upgrade --install tfbackend . \ --namespace tfbackend --create-namespace ``` -Open application Swagger in a browser. +Open the Scalar API reference in a browser. ```bash -echo https://tfbckmdb.console.$SANDBOX_ID.instruqt.io/swagger +echo https://tfbckmdb.console.$SANDBOX_ID.instruqt.io/scalar ``` Create admin: diff --git a/charts/terraform-backend-mongodb/Chart.yaml b/charts/terraform-backend-mongodb/Chart.yaml index a8456b1..0514096 100644 --- a/charts/terraform-backend-mongodb/Chart.yaml +++ b/charts/terraform-backend-mongodb/Chart.yaml @@ -1,9 +1,15 @@ -apiVersion: v2 +apiVersion: v2 name: terraform-backend-mongodb description: Helm chart for Terraform Backend MongoDB type: application -version: 0.1.2 -appVersion: "1.2.0" +version: 0.2.0 +appVersion: "1.2.3" +home: https://github.com/devpro/terraform-backend-mongodb +sources: + - https://github.com/devpro/terraform-backend-mongodb +keywords: + - terraform + - mongodb dependencies: - name: mongodb version: 18.1.10 # MongoDB 8.2.2 diff --git a/charts/terraform-backend-mongodb/README.md b/charts/terraform-backend-mongodb/README.md index de47826..fabc2e7 100644 --- a/charts/terraform-backend-mongodb/README.md +++ b/charts/terraform-backend-mongodb/README.md @@ -23,6 +23,69 @@ Install the application: helm upgrade --install tfbackend devpro/terraform-backend-mongodb -f values.yaml --namespace tfbackend --create-namespace ``` +## Database connection + +`DatabaseSettings__ConnectionString` is sourced from a Secret via `secretKeyRef` only when you point +the chart at one yourself; otherwise it's rendered as a plain environment variable. Pick one of the +three ways below to provide it; they're evaluated in this priority order: +`webapi.db.connectionStringSecretKeyRef` > `webapi.db.connectionString` > the bundled `mongodb` +subchart. + +### Option 1 - your own MongoDB, connection string in a pre-created Secret (recommended for Production) + +Create the Secret yourself (`kubectl create secret`, External Secrets Operator, Sealed Secrets, or +your GitOps tool's secret management) with a key holding the full connection string, then point the +chart at it. The chart neither reads nor creates a Secret of its own in this case - the plaintext +value never appears in your values files or in Helm's release history: + +```bash +kubectl create secret generic tfbackend-db \ + --namespace tfbackend \ + --from-literal=connectionString='mongodb+srv://user:pass@cluster.mongodb.net' +``` + +```yaml +webapi: + db: + databaseName: "tfbackend" + connectionStringSecretKeyRef: + name: tfbackend-db + key: connectionString +``` + +### Option 2 - your own MongoDB, connection string as a chart value + +Point `webapi.db.connectionString` at a reachable, already-provisioned instance. The chart renders it +directly as a plain env var - the plaintext value is visible in your values file, in `helm get +values`/Helm's release history, and in the Pod spec, so prefer Option 1 for Production credentials: + +```yaml +webapi: + db: + connectionString: "mongodb+srv://user:pass@cluster.mongodb.net" + databaseName: "tfbackend" +``` + +### Option 3 - bundled MongoDB (auto-wired, good for demos/testing) + +Enable the bundled `mongodb` subchart and set its root password; the chart derives the connection +string for you and renders it the same way as Option 2 (plain env var). Leave +`webapi.db.connectionString`/`connectionStringSecretKeyRef` empty: + +```yaml +mongodb: + enabled: true + auth: + rootPassword: "changeme" +``` + +Not recommended for anything you care about keeping - it's just another Pod with a PVC, not a +managed/backed-up database. + +If none of the three is configured, or `mongodb.enabled=true` is set without `mongodb.auth.rootPassword`, +the chart fails at render/install time with a clear error instead of deploying a Pod that can't reach +a database. + ## Going further Check the [contribution guide](CONTRIBUTING.md). diff --git a/charts/terraform-backend-mongodb/templates/NOTES.txt b/charts/terraform-backend-mongodb/templates/NOTES.txt index e69de29..680c3a8 100644 --- a/charts/terraform-backend-mongodb/templates/NOTES.txt +++ b/charts/terraform-backend-mongodb/templates/NOTES.txt @@ -0,0 +1,33 @@ +Terraform Backend MongoDB has been deployed. + +{{- if .Values.ingress.enabled }} +{{- if .Values.webapi.enabled }} +Web API: + https://{{ .Values.webapi.host }} +{{- end }} +{{- else }} +Ingress is disabled - reach the app via `kubectl port-forward` or your own ingress/gateway pointed +at the {{ .Values.webapi.name }} Service. +{{- end }} + +{{- if not .Values.mongodb.enabled }} + +MongoDB is not managed by this chart (mongodb.enabled=false) - make sure webapi.db.connectionString +(or webapi.db.connectionStringSecretKeyRef) points at a reachable, already-provisioned instance. +{{- else }} + +MongoDB is managed by this chart (mongodb.enabled=true) - the webapi connection string was +auto-derived from mongodb.auth.rootPassword. +{{- end }} + +Check the rollout: + kubectl get pods -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} + +Create a user (there is no in-app way to do this - see CONTRIBUTING.md): + MONGODB_URI= ./tfbeadm create-user + +{{- if not .Values.security.hardened.enabled }} + +Note: security.hardened.enabled is false. Turn it on once validated in this environment to run with +a read-only root filesystem, all Linux capabilities dropped, and the default seccomp profile. +{{- end }} diff --git a/charts/terraform-backend-mongodb/templates/_helpers.tpl b/charts/terraform-backend-mongodb/templates/_helpers.tpl index e69de29..2c25f0f 100644 --- a/charts/terraform-backend-mongodb/templates/_helpers.tpl +++ b/charts/terraform-backend-mongodb/templates/_helpers.tpl @@ -0,0 +1,65 @@ +{{/* +Recommended Kubernetes labels (https://helm.sh/docs/chart_best_practices/labels/), added on top of +the app-specific `app` / `app.kubernetes.io/name` labels every template already sets directly. +These are informational only - never add them to a Deployment's spec.selector.matchLabels, which +is immutable and would break `helm upgrade` for existing releases. +Call with a dict: (dict "app" . "root" $) where "." is the current webapi values entry. +*/}} +{{- define "terraform-backend-mongodb.commonLabels" -}} +helm.sh/chart: {{ printf "%s-%s" .root.Chart.Name .root.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +app.kubernetes.io/version: {{ .root.Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .root.Release.Service }} +app.kubernetes.io/instance: {{ .root.Release.Name }} +app.kubernetes.io/part-of: terraform-backend-mongodb +{{- if .app.role }} +app.kubernetes.io/component: {{ .app.role }} +{{- end }} +{{- end -}} + +{{/* +Fully-qualified resource name for an application entry (webapi). Prefixes the app's own `.name` +(e.g. "tfbackend") with the release name, unless `.name` already contains it - so two releases in the +same namespace that both leave `.name` at its default don't collide on Deployment/Service/Ingress/ +ServiceAccount names (or on their selector labels, which use the same value). +Call with a dict: (dict "app" . "root" $) where "." is the current webapi values entry. +*/}} +{{- define "terraform-backend-mongodb.fullname" -}} +{{- if contains .app.name .root.Release.Name -}} +{{- .root.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .root.Release.Name .app.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + +{{/* +MongoDB connection string. +webapi.db.connectionString wins; otherwise, if the bundled mongodb subchart is enabled, derived from +its default standalone Service name ("-mongodb", per the alias in Chart.yaml and the +Bitnami chart's own naming convention) and mongodb.auth.rootPassword. +Only called from deployment.yaml when webapi.db.connectionStringSecretKeyRef is not set. +*/}} +{{- define "terraform-backend-mongodb.mongoConnectionString" -}} +{{- if .Values.webapi.db.connectionString -}} +{{- .Values.webapi.db.connectionString -}} +{{- else if .Values.mongodb.enabled -}} +{{- printf "mongodb://root:%s@%s-mongodb:27017/?authSource=admin" .Values.mongodb.auth.rootPassword .Release.Name -}} +{{- end -}} +{{- end -}} + +{{/* +Validate required values and emit a clear error message instead of silently rendering a placeholder +or a broken manifest. +*/}} +{{- define "terraform-backend-mongodb.validateValues" -}} +{{- if .Values.webapi.enabled }} +{{- if and (not .Values.webapi.db.connectionString) (not .Values.webapi.db.connectionStringSecretKeyRef) (not .Values.mongodb.enabled) }} +{{- fail "A MongoDB connection is required: set webapi.db.connectionString, webapi.db.connectionStringSecretKeyRef, or mongodb.enabled=true." }} +{{- end }} +{{- if and .Values.mongodb.enabled (not .Values.webapi.db.connectionString) (not .Values.webapi.db.connectionStringSecretKeyRef) (not .Values.mongodb.auth.rootPassword) }} +{{- fail "mongodb.auth.rootPassword is required when mongodb.enabled=true (unless webapi.db.connectionString or webapi.db.connectionStringSecretKeyRef is set instead)." }} +{{- end }} +{{- if and .Values.ingress.enabled (not .Values.webapi.host) }} +{{- fail "webapi.host is required when ingress.enabled=true." }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/terraform-backend-mongodb/templates/deployment.yaml b/charts/terraform-backend-mongodb/templates/deployment.yaml index cb67347..cb136cb 100644 --- a/charts/terraform-backend-mongodb/templates/deployment.yaml +++ b/charts/terraform-backend-mongodb/templates/deployment.yaml @@ -1,40 +1,52 @@ {{- $applications := list .Values.webapi -}} {{ range $applications }} -{{- $name := .name -}} {{- if .enabled -}} --- apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .name }} + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} labels: - app: {{ .name }} - app.kubernetes.io/name: {{ .name }} + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- include "terraform-backend-mongodb.commonLabels" (dict "app" . "root" $) | nindent 4 }} spec: replicas: {{ .replicaCount }} strategy: type: RollingUpdate selector: matchLabels: - app: {{ .name }} - app.kubernetes.io/name: {{ .name }} + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} template: metadata: labels: - app: {{ $name }} - app.kubernetes.io/name: {{ $name }} + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- include "terraform-backend-mongodb.commonLabels" (dict "app" . "root" $) | nindent 8 }} {{- if .additionalPodLabels }} {{- toYaml .additionalPodLabels | nindent 8 }} {{- end }} spec: + {{- with .affinity }} affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: "kubernetes.io/arch" - operator: In - values: ["amd64"] + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if $.Values.security.serviceAccount.create }} + serviceAccountName: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- else }} + serviceAccountName: default + {{- end }} + automountServiceAccountToken: false + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if $.Values.security.hardened.enabled }} + securityContext: + seccompProfile: + type: RuntimeDefault + {{- end }} containers: - name: {{ .name }} image: {{ .image }}:{{ .tag }} @@ -58,7 +70,21 @@ spec: runAsUser: 1654 # "app" user runAsGroup: 1654 # "app" group allowPrivilegeEscalation: false + {{- if $.Values.security.hardened.enabled }} + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"] + {{- end }} + {{- if $.Values.security.hardened.enabled }} + volumeMounts: + - name: tmp + mountPath: /tmp + {{- end }} env: + {{- if $.Values.security.hardened.enabled }} + - name: HOME + value: /tmp + {{- end }} {{- if .extraEnv }} {{- toYaml .extraEnv | nindent 12 }} {{- end }} @@ -67,33 +93,56 @@ spec: fieldRef: apiVersion: v1 fieldPath: status.hostIP - # TODO: only add this variables when needed and manage http calls - name: ASPNETCORE_ENVIRONMENT value: "{{ $.Values.dotnet.environment }}" - name: Logging__LogLevel__Default - value: {{ $.Values.dotnet.logLevels.default }} + value: {{ $.Values.dotnet.logLevels.default | quote }} - name: Logging__LogLevel__Microsoft.AspNetCore - value: {{ $.Values.dotnet.logLevels.framework }} - - name: Logging__LogLevel__Farseer - value: {{ $.Values.dotnet.logLevels.application }} - {{- if $.Values.dotnet.enableSwagger }} - - name: Application__IsSwaggerEnabled - value: "true" + value: {{ $.Values.dotnet.logLevels.framework | quote }} + - name: Logging__LogLevel__Devpro + value: {{ $.Values.dotnet.logLevels.application | quote }} + - name: Features__IsHttpsRedirectionEnabled + value: {{ $.Values.dotnet.httpsRedirectionEnabled | quote }} + - name: Features__IsScalarEnabled + value: {{ $.Values.dotnet.enableScalar | quote }} + {{- if $.Values.dotnet.openTelemetry.enabled }} + - name: OTEL_SERVICE_NAME + value: {{ $.Values.dotnet.openTelemetry.serviceName | default (include "terraform-backend-mongodb.fullname" (dict "app" . "root" $)) | quote }} + - name: OTEL_TRACES_EXPORTER + value: "otlp" + - name: OTEL_METRICS_EXPORTER + value: "otlp" + - name: OTEL_LOGS_EXPORTER + value: "otlp" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ $.Values.dotnet.openTelemetry.endpoint | quote }} + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: {{ $.Values.dotnet.openTelemetry.protocol | quote }} + {{- else }} + - name: OTEL_TRACES_EXPORTER + value: "none" + - name: OTEL_METRICS_EXPORTER + value: "none" + - name: OTEL_LOGS_EXPORTER + value: "none" {{- end }} - {{- if $.Values.dotnet.enableOpenTelemetry }} - - name: Application__IsOpenTelemetryEnabled - value: "true" - - name: OpenTelemetry__CollectorEndpoint - value: "http://$(HOST_IP):4317" - {{- end }} - {{- if .db }} - - name: ConnectionStrings__MongoDb - value: {{ .db.connectionString }} - - name: MongoDb__ConnectionStringName - value: "MongoDb" - - name: MongoDb__DatabaseName - value: {{ .db.databaseName }} + {{- if .db.connectionStringSecretKeyRef }} + - name: DatabaseSettings__ConnectionString + valueFrom: + secretKeyRef: + name: {{ .db.connectionStringSecretKeyRef.name }} + key: {{ .db.connectionStringSecretKeyRef.key }} + {{- else }} + - name: DatabaseSettings__ConnectionString + value: {{ include "terraform-backend-mongodb.mongoConnectionString" $ | quote }} {{- end }} + - name: DatabaseSettings__DatabaseName + value: {{ .db.databaseName | quote }} restartPolicy: Always + {{- if $.Values.security.hardened.enabled }} + volumes: + - name: tmp + emptyDir: {} + {{- end }} {{- end }} {{ end }} diff --git a/charts/terraform-backend-mongodb/templates/ingress.yaml b/charts/terraform-backend-mongodb/templates/ingress.yaml index 002a815..11c7ca9 100644 --- a/charts/terraform-backend-mongodb/templates/ingress.yaml +++ b/charts/terraform-backend-mongodb/templates/ingress.yaml @@ -1,12 +1,17 @@ {{- $applications := list .Values.webapi -}} {{ range $applications }} -{{- $name := .name -}} +{{- $app := . -}} {{- if and $.Values.ingress.enabled .enabled -}} +{{- include "terraform-backend-mongodb.validateValues" $ }} --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ $name }} + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + labels: + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- include "terraform-backend-mongodb.commonLabels" (dict "app" . "root" $) | nindent 4 }} {{- with $.Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -23,7 +28,7 @@ spec: pathType: Prefix backend: service: - name: {{ $name }} + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} port: number: {{ .port }} {{- range .ingressExtraHosts }} @@ -35,7 +40,7 @@ spec: pathType: {{ .pathType }} backend: service: - name: {{ $name }} + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" $app "root" $) }} port: number: {{ .port }} {{- end }} diff --git a/charts/terraform-backend-mongodb/templates/service.yaml b/charts/terraform-backend-mongodb/templates/service.yaml index 27e5b7d..fbbad7b 100644 --- a/charts/terraform-backend-mongodb/templates/service.yaml +++ b/charts/terraform-backend-mongodb/templates/service.yaml @@ -6,9 +6,10 @@ apiVersion: v1 kind: Service metadata: labels: - app: {{ .name }} - app.kubernetes.io/name: {{ .name }} - name: {{ .name }} + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- include "terraform-backend-mongodb.commonLabels" (dict "app" . "root" $) | nindent 4 }} + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} spec: type: ClusterIP ports: @@ -17,7 +18,7 @@ spec: protocol: TCP name: http selector: - app: {{ .name }} - app.kubernetes.io/name: {{ .name }} + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} {{- end }} {{ end }} diff --git a/charts/terraform-backend-mongodb/templates/serviceaccount.yaml b/charts/terraform-backend-mongodb/templates/serviceaccount.yaml new file mode 100644 index 0000000..c6d945f --- /dev/null +++ b/charts/terraform-backend-mongodb/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +{{- if .Values.security.serviceAccount.create }} +{{- $applications := list .Values.webapi -}} +{{ range $applications }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + labels: + app: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + app.kubernetes.io/name: {{ include "terraform-backend-mongodb.fullname" (dict "app" . "root" $) }} + {{- include "terraform-backend-mongodb.commonLabels" (dict "app" . "root" $) | nindent 4 }} +automountServiceAccountToken: false +{{ end }} +{{- end }} diff --git a/charts/terraform-backend-mongodb/values.yaml b/charts/terraform-backend-mongodb/values.yaml index 36bd8c7..1baf622 100644 --- a/charts/terraform-backend-mongodb/values.yaml +++ b/charts/terraform-backend-mongodb/values.yaml @@ -1,17 +1,26 @@ webapi: enabled: true - host: tfbackend.random + host: "" name: tfbackend image: docker.io/devprofr/terraform-backend-mongodb # images are hosted on DockerHub: https://hub.docker.com/r/devprofr/terraform-backend-mongodb/tags - tag: latest # IMPORTANT: latest should never be used in Production + tag: "1.2.3" # pins to Chart.yaml appVersion - avoid floating tags (e.g. latest) in Production replicaCount: 1 port: 80 containerPort: 8080 healthEndpoint: /health db: - connectionString: "someconnstring" - databaseName: "somedb" + # -- Full MongoDB connection string, e.g. mongodb://user:pass@host:27017/?authSource=admin + # Not needed if mongodb.enabled=true below - the chart wires that up for you from + # mongodb.auth.rootPassword. Rendered as a plain env var unless connectionStringSecretKeyRef + # below is set instead. + connectionString: "" + # -- Use your own pre-created Secret instead of connectionString above (rendered via secretKeyRef). + # Takes priority over connectionString and over the bundled mongodb chart below. + # connectionStringSecretKeyRef: + # name: "" + # key: "" + databaseName: "tfbackend" extraEnv: [] # - name: xxx # value: "yyyy" @@ -25,6 +34,18 @@ webapi: # requests: # cpu: 100m # memory: 64Mi + # -- Pod affinity/anti-affinity/node-affinity rules, passed through as-is. + # Defaults to requiring amd64 nodes: the image's baked-in OpenTelemetry auto-instrumentation + # native library (see Dockerfile) is amd64-only, so an arm64 node would fail to load the + # profiler. Clear this (affinity: {}) once/if an arm64-compatible image is published. + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/arch" + operator: In + values: ["amd64"] dotnet: environment: Production @@ -32,8 +53,34 @@ dotnet: default: Information framework: Information application: Information - enableSwagger: false - enableOpenTelemetry: false + enableScalar: false + # false by default: the app redirects to HTTPS internally, which fights a TLS-terminating ingress + # that forwards plain HTTP to the pod. + httpsRedirectionEnabled: false + # The app image always ships with .NET auto-instrumentation baked in (see Dockerfile); these settings + # only control the standard OTEL_* exporter env vars the agent reads - they don't turn the agent itself + # on or off. When disabled, exporters are set to "none" so the agent doesn't try to reach a collector. + openTelemetry: + enabled: false + # defaults to webapi.name when empty + serviceName: "" + # OTLP collector endpoint, e.g. http://otel-collector:4318 + endpoint: "" + protocol: "http/protobuf" + +# optional: image registry credentials, e.g. for a private mirror of the image above +imagePullSecrets: [] + # - name: my-registry-secret + +security: + serviceAccount: + create: false + # Hardened container settings for platforms that mandate the Kubernetes Pod Security Standards "restricted" profile (or an equivalent CIS benchmark policy): + # seccompProfile, dropping all Linux capabilities, and a read-only root filesystem. Disabled by default - + # readOnlyRootFilesystem needs to be validated against each environment before being turned on broadly + # (it redirects HOME to an emptyDir-backed /tmp so .NET's own writes keep working). + hardened: + enabled: false ingress: enabled: false @@ -56,4 +103,10 @@ mongodb: repository: bitnami/mongodb # other options: chainguard/mongodb tag: latest # IMPORTANT: latest should never be used in Production auth: {} + # -- Required when mongodb.enabled=true, unless webapi.db.connectionString or + # webapi.db.connectionStringSecretKeyRef is set instead. This is intentionally not + # auto-generated: the same value has to reach both this subchart's own root user AND + # the webapi connection string, and Helm cannot pass a chart-generated value into a + # subchart's values. # rootPassword: "" + # existingSecret: ""