mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-11-26 19:30:47 +00:00
98 lines
6.5 KiB
YAML
98 lines
6.5 KiB
YAML
{{- /*
|
|
The chart-managed Secret. It only carries the fields no existing Secret
|
|
supplies: each key below is skipped when secrets.existingSecret or the field's
|
|
own <field>ExistingSecret points somewhere else, and the whole resource is
|
|
skipped when nothing is left to manage.
|
|
*/}}
|
|
{{- if and .Values.api.publicNatsURL (not .Values.nats.auth.enabled) }}
|
|
{{- fail "nats.auth.enabled must be true when api.publicNatsURL is set" }}
|
|
{{- end }}
|
|
{{- if and .Values.nats.auth.enabled (not (include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret))) }}
|
|
{{- fail "secrets.probaraSecretsKey (or an existing Secret supplying it) is required when nats.auth.enabled" }}
|
|
{{- end }}
|
|
{{- /*
|
|
Helm cannot read Secrets, so whenever a credential the chart would otherwise
|
|
interpolate into a URL comes from outside, the composed URL has to come from
|
|
outside too. Either the field's own reference or the chart-wide one satisfies
|
|
that, since secretEnv resolves the URL through both.
|
|
*/}}
|
|
{{- if and .Values.postgresql.enabled .Values.postgresql.auth.existingSecret (not (or .Values.postgresql.existingSecret .Values.secrets.existingSecret)) }}
|
|
{{- fail "postgresql.existingSecret (or secrets.existingSecret) is required alongside postgresql.auth.existingSecret: Helm cannot compose POSTGRES_URL from credentials it cannot read" }}
|
|
{{- end }}
|
|
{{- if and .Values.nats.enabled .Values.nats.auth.enabled .Values.nats.auth.platformPasswordExistingSecret (not (or .Values.nats.existingSecret .Values.secrets.existingSecret)) }}
|
|
{{- fail "nats.existingSecret (or secrets.existingSecret) is required alongside nats.auth.platformPasswordExistingSecret: Helm cannot compose NATS_URL around a password it cannot read" }}
|
|
{{- end }}
|
|
{{- if and .Values.auth.oidc.enabled (not (include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.oidcClientSecret "secret" .Values.secrets.oidcClientSecretExistingSecret))) }}
|
|
{{- fail "secrets.oidcClientSecret (or an existing Secret supplying it) is required when auth.oidc.enabled" }}
|
|
{{- end }}
|
|
{{- if not (or .Values.postgresql.enabled .Values.postgresql.externalUrl .Values.postgresql.existingSecret .Values.secrets.existingSecret) }}
|
|
{{- fail "postgresql.externalUrl or postgresql.existingSecret is required when postgresql.enabled is false" }}
|
|
{{- end }}
|
|
|
|
{{- $managePostgresUrl := include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.postgresql.existingSecret) }}
|
|
{{- $managePostgresAuth := and .Values.postgresql.enabled (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.postgresql.auth.existingSecret)) }}
|
|
{{- $manageNatsUrl := include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.nats.existingSecret) }}
|
|
{{- $manageNatsPassword := and .Values.nats.enabled .Values.nats.auth.enabled (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.nats.auth.platformPasswordExistingSecret)) }}
|
|
{{- $manageIssuerSeed := and .Values.nats.auth.enabled (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.nats.auth.locationIssuerSeedExistingSecret)) }}
|
|
{{- $manageJwt := include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.secrets.adminJwtSecretExistingSecret) }}
|
|
{{- $manageProbaraKey := and .Values.secrets.probaraSecretsKey (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.secrets.probaraSecretsKeyExistingSecret)) }}
|
|
{{- $manageOidc := and .Values.secrets.oidcClientSecret (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.secrets.oidcClientSecretExistingSecret)) }}
|
|
{{- $manageVapid := and .Values.secrets.statusPageVapidPrivateKey (include "monitoring-platform.chartManagedSecret" (dict "ctx" . "secret" .Values.secrets.statusPageVapidPrivateKeyExistingSecret)) }}
|
|
{{- $manageInitialApiKey := not .Values.secrets.existingSecret }}
|
|
{{- if or $managePostgresUrl $managePostgresAuth $manageNatsUrl $manageNatsPassword $manageIssuerSeed $manageJwt $manageProbaraKey $manageOidc $manageVapid $manageInitialApiKey }}
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ include "monitoring-platform.secretName" . }}
|
|
labels:
|
|
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
|
type: Opaque
|
|
stringData:
|
|
{{- if $manageNatsUrl }}
|
|
# Kept in a Secret because the URL contains the internal platform credential
|
|
# when NATS authorization callout is enabled.
|
|
nats_url: {{ include "monitoring-platform.natsUrl" . | quote }}
|
|
{{- end }}
|
|
{{- if $manageNatsPassword }}
|
|
# Platform user password. The embedded broker receives it as a --pass
|
|
# argument substituted by Kubernetes, so it never lands in the ConfigMap.
|
|
nats_platform_password: {{ required "nats.auth.platformPassword is required when nats.auth.enabled" .Values.nats.auth.platformPassword | quote }}
|
|
{{- end }}
|
|
{{- if $manageIssuerSeed }}
|
|
nats_location_auth_issuer_seed: {{ required "nats.auth.locationIssuerSeed is required when nats.auth.enabled" .Values.nats.auth.locationIssuerSeed | quote }}
|
|
{{- end }}
|
|
{{- if $managePostgresAuth }}
|
|
# Embedded PostgreSQL server credentials
|
|
postgresql_username: {{ .Values.postgresql.auth.username | quote }}
|
|
postgresql_password: {{ .Values.postgresql.auth.password | quote }}
|
|
postgresql_database: {{ .Values.postgresql.auth.database | quote }}
|
|
{{- end }}
|
|
{{- if $managePostgresUrl }}
|
|
# Full PostgreSQL connection URL, read by every workload that talks to the DB
|
|
postgres_url: {{ include "monitoring-platform.postgresUrl" . | quote }}
|
|
{{- end }}
|
|
{{- if $manageJwt }}
|
|
# JWT secret for API authentication
|
|
admin_jwt_secret: {{ .Values.secrets.adminJwtSecret | quote }}
|
|
{{- end }}
|
|
{{- if $manageInitialApiKey }}
|
|
# Initial API key for first login
|
|
initial_api_key: {{ .Values.secrets.initialApiKey | quote }}
|
|
{{- end }}
|
|
{{- if $manageProbaraKey }}
|
|
# AES-256 key (32 bytes, base64) for at-rest encryption of monitor/channel
|
|
# config secrets. Used by api, scheduler, worker, and alerter.
|
|
probara_secrets_key: {{ .Values.secrets.probaraSecretsKey | quote }}
|
|
{{- end }}
|
|
{{- if $manageOidc }}
|
|
# OIDC client secret for SSO login (api only)
|
|
oidc_client_secret: {{ .Values.secrets.oidcClientSecret | quote }}
|
|
{{- end }}
|
|
{{- if $manageVapid }}
|
|
# VAPID private key signing status page visitor push notifications
|
|
# (status-page only). The public half is statusPage.vapid.publicKey and is
|
|
# deliberately NOT here: it ships inside every rendered page.
|
|
status_page_vapid_private_key: {{ .Values.secrets.statusPageVapidPrivateKey | quote }}
|
|
{{- end }}
|
|
{{- end }}
|