mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-11-26 19:30:47 +00:00
Add probara and probara-worker charts
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
125982eda0
commit
4d632dfd58
35 files changed
+3314
No files matched your search
@@ -0,0 +1,89 @@
|
||||
===============================================================================
|
||||
PROBARA MONITORING PLATFORM
|
||||
===============================================================================
|
||||
|
||||
Congratulations! The monitoring platform has been deployed successfully.
|
||||
|
||||
{{- if .Values.migrations.enabled }}
|
||||
|
||||
DATABASE MIGRATIONS:
|
||||
A migrations job has been created and will run automatically.
|
||||
Check the status with:
|
||||
kubectl get jobs -l app.kubernetes.io/component=migrations
|
||||
{{- end }}
|
||||
|
||||
ACCESSING THE APPLICATION:
|
||||
|
||||
{{- if .Values.ingress.enabled }}
|
||||
The application is available at:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
The application is running inside the cluster. To access it:
|
||||
|
||||
1. Frontend (Web UI):
|
||||
kubectl port-forward svc/{{ include "monitoring-platform.fullname" . }}-frontend {{ .Values.frontend.httpPort }}:{{ .Values.frontend.httpPort }}
|
||||
Then open: http://localhost:{{ .Values.frontend.httpPort }}
|
||||
|
||||
2. API:
|
||||
kubectl port-forward svc/{{ include "monitoring-platform.fullname" . }}-api {{ .Values.api.httpPort }}:{{ .Values.api.httpPort }}
|
||||
Then access: http://localhost:{{ .Values.api.httpPort }}
|
||||
|
||||
3. Status Page:
|
||||
kubectl port-forward svc/{{ include "monitoring-platform.fullname" . }}-status-page {{ .Values.statusPage.httpPort }}:{{ .Values.statusPage.httpPort }}
|
||||
Then open: http://localhost:{{ .Values.statusPage.httpPort }}
|
||||
{{- end }}
|
||||
|
||||
AUTHENTICATION:
|
||||
|
||||
Use the following API key to authenticate:
|
||||
|
||||
{{ .Values.secrets.initialApiKey }}
|
||||
|
||||
IMPORTANT: Change this key in production by setting:
|
||||
--set secrets.initialApiKey=your-secure-api-key
|
||||
|
||||
CHECKING STATUS:
|
||||
|
||||
View all pods:
|
||||
kubectl get pods -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||
|
||||
View services:
|
||||
kubectl get svc -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||
|
||||
View logs for a component (e.g., api):
|
||||
kubectl logs -l app.kubernetes.io/component=api -f
|
||||
|
||||
COMPONENTS DEPLOYED:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- PostgreSQL (database)
|
||||
{{- end }}
|
||||
{{- if .Values.nats.enabled }}
|
||||
- NATS with JetStream (message queue)
|
||||
{{- end }}
|
||||
{{- if .Values.api.enabled }}
|
||||
- API Server ({{ .Values.api.replicas }} replicas)
|
||||
{{- end }}
|
||||
{{- if .Values.scheduler.enabled }}
|
||||
- Scheduler ({{ .Values.scheduler.replicas }} replica)
|
||||
{{- end }}
|
||||
{{- if .Values.worker.enabled }}
|
||||
- Worker ({{ .Values.worker.replicas }} replicas)
|
||||
{{- end }}
|
||||
{{- if .Values.alerter.enabled }}
|
||||
- Alerter ({{ .Values.alerter.replicas }} replicas)
|
||||
{{- end }}
|
||||
{{- if .Values.statusPage.enabled }}
|
||||
- Status Page ({{ .Values.statusPage.replicas }} replicas)
|
||||
{{- end }}
|
||||
{{- if .Values.frontend.enabled }}
|
||||
- Frontend ({{ .Values.frontend.replicas }} replicas)
|
||||
{{- end }}
|
||||
|
||||
===============================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "monitoring-platform.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "monitoring-platform.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 name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "monitoring-platform.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "monitoring-platform.labels" -}}
|
||||
helm.sh/chart: {{ include "monitoring-platform.chart" . }}
|
||||
{{ include "monitoring-platform.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "monitoring-platform.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "monitoring-platform.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "monitoring-platform.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "monitoring-platform.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Name of the Secret the chart renders itself.
|
||||
*/}}
|
||||
{{- define "monitoring-platform.secretName" -}}
|
||||
{{- printf "%s-secret" (include "monitoring-platform.fullname" .) }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Render one env var backed by a Kubernetes Secret, resolving the source in a
|
||||
fixed order so that any credential can come from an operator-supplied Secret
|
||||
(External Secrets Operator, Vault, sealed-secrets, SOPS — they all land a plain
|
||||
Secret in the namespace):
|
||||
|
||||
1. the field's own existingSecret -> that Secret, its existingSecretKey
|
||||
2. chart-wide secrets.existingSecret -> that Secret, the canonical key
|
||||
3. neither -> the chart-managed <fullname>-secret
|
||||
|
||||
The key defaults to the canonical name in every mode, so a single chart-wide
|
||||
Secret carrying postgres_url / nats_url / admin_jwt_secret / probara_secrets_key
|
||||
/ oidc_client_secret / nats_platform_password /
|
||||
nats_location_auth_issuer_seed satisfies the whole install.
|
||||
|
||||
Args (dict): ctx (root context), name (env var), key (canonical key),
|
||||
secret (per-field existingSecret), secretKey (per-field existingSecretKey).
|
||||
*/}}
|
||||
{{- define "monitoring-platform.secretEnv" -}}
|
||||
{{- $external := default .ctx.Values.secrets.existingSecret .secret -}}
|
||||
- name: {{ .name }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $external | default (include "monitoring-platform.secretName" .ctx) | quote }}
|
||||
key: {{ ternary (default .key .secretKey) .key (not (empty $external)) | quote }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
True when a secret field is satisfied by EITHER a literal value or any existing
|
||||
Secret reference. Guards must test this, never the literal alone: an
|
||||
external-secret install leaves the literal empty, and a guard keyed on the
|
||||
literal would silently drop the env var (for PROBARA_SECRETS_KEY that means
|
||||
running with at-rest encryption disabled).
|
||||
|
||||
Args (dict): ctx, value (the literal), secret (per-field existingSecret).
|
||||
*/}}
|
||||
{{- define "monitoring-platform.hasSecret" -}}
|
||||
{{- if or .value .secret .ctx.Values.secrets.existingSecret -}}true{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
True when a secret field is still chart-managed, i.e. its value belongs in the
|
||||
Secret this chart renders. Inverse of "some existing Secret supplies it".
|
||||
|
||||
Args (dict): ctx, secret (per-field existingSecret).
|
||||
*/}}
|
||||
{{- define "monitoring-platform.chartManagedSecret" -}}
|
||||
{{- if and (not .secret) (not .ctx.Values.secrets.existingSecret) -}}true{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
PostgreSQL connection URL
|
||||
*/}}
|
||||
{{- define "monitoring-platform.postgresUrl" -}}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
{{- printf "postgres://%s:%s@%s-postgresql:5432/%s?sslmode=disable" .Values.postgresql.auth.username .Values.postgresql.auth.password (include "monitoring-platform.fullname" .) .Values.postgresql.auth.database }}
|
||||
{{- else }}
|
||||
{{- .Values.postgresql.externalUrl }}
|
||||
{{- end }}
|
||||
{{- end }}{{/*
|
||||
NATS connection URL
|
||||
*/}}
|
||||
{{- define "monitoring-platform.natsUrl" -}}
|
||||
{{- if .Values.nats.enabled }}
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
{{- printf "nats://%s:%s@%s-nats:4222" (.Values.nats.auth.platformUser | urlquery) (.Values.nats.auth.platformPassword | urlquery) (include "monitoring-platform.fullname" .) }}
|
||||
{{- else }}
|
||||
{{- printf "nats://%s-nats:4222" (include "monitoring-platform.fullname" .) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- .Values.nats.externalUrl }}
|
||||
{{- end }}
|
||||
{{- end }}{{/*
|
||||
PostgreSQL host
|
||||
*/}}
|
||||
{{- define "monitoring-platform.postgresHost" -}}
|
||||
{{- printf "%s-postgresql" (include "monitoring-platform.fullname" .) }}
|
||||
{{- end }}{{/*
|
||||
NATS host
|
||||
*/}}
|
||||
{{- define "monitoring-platform.natsHost" -}}
|
||||
{{- printf "%s-nats" (include "monitoring-platform.fullname" .) }}
|
||||
{{- end }}{{/*
|
||||
SMTP env block for the builtin email notification plugin. Rendered into every
|
||||
workload that can invoke email Send: alerter (alert delivery), worker
|
||||
(async notifications consumer), and api (alert-channel test endpoint). Wiring
|
||||
only some of them produces channels that deliver but cannot be tested, or the
|
||||
reverse. APP_BASE_URL rides along because the same three workloads render the
|
||||
alert email and its "open the monitor" link; it is emitted independently of
|
||||
smtp.host so it survives an SMTP-less install. Emits nothing when neither
|
||||
smtp.host nor appBaseURL is set.
|
||||
*/}}
|
||||
{{- define "monitoring-platform.smtpEnv" -}}
|
||||
{{- with .Values.appBaseURL }}
|
||||
- name: APP_BASE_URL
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.smtp }}
|
||||
{{- if .host }}
|
||||
- name: SMTP_HOST
|
||||
value: {{ .host | quote }}
|
||||
- name: SMTP_PORT
|
||||
value: {{ .port | quote }}
|
||||
- name: SMTP_USE_TLS
|
||||
value: {{ .useTLS | quote }}
|
||||
{{- with .from }}
|
||||
- name: SMTP_FROM
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .fromName }}
|
||||
- name: SMTP_FROM_NAME
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .username }}
|
||||
- name: SMTP_USERNAME
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- if .existingSecret }}
|
||||
- name: SMTP_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret | quote }}
|
||||
key: {{ .existingSecretKey | default "password" | quote }}
|
||||
{{- else if .password }}
|
||||
- name: SMTP_PASSWORD
|
||||
value: {{ .password | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-config
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
data:
|
||||
# Logging configuration
|
||||
log_level: "{{ .Values.api.logLevel }}"
|
||||
|
||||
# Infrastructure endpoints
|
||||
postgresql_host: {{ include "monitoring-platform.postgresHost" . | quote }}
|
||||
postgresql_database: "{{ .Values.postgresql.auth.database }}"
|
||||
|
||||
# Scheduler configuration
|
||||
check_job_stream: "{{ .Values.scheduler.checkJobStream }}"
|
||||
check_job_subject: "{{ .Values.scheduler.checkJobSubject }}"
|
||||
scheduler_interval_seconds: "{{ .Values.scheduler.intervalSeconds }}"
|
||||
|
||||
# Worker configuration
|
||||
nats_consumer_name: "{{ .Values.worker.consumerName }}"
|
||||
worker_concurrency: "{{ .Values.worker.concurrency }}"
|
||||
@@ -0,0 +1,113 @@
|
||||
{{- if .Values.alerter.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-alerter
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: alerter
|
||||
spec:
|
||||
replicas: {{ .Values.alerter.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: alerter
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: alerter
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if or .Values.postgresql.enabled .Values.nats.enabled }}
|
||||
initContainers:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- if .Values.nats.enabled }}
|
||||
- name: wait-for-nats
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.natsHost" . }} 4222; do
|
||||
echo "Waiting for NATS..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: alerter
|
||||
image: "{{ .Values.image.repository }}-alerter:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: ["./alerter"]
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.alerter.metricsPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "alerter"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ .Values.alerter.metricsPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ .Values.alerter.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ .Values.alerter.logLevel }}"
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
|
||||
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "PROBARA_SECRETS_KEY" "key" "probara_secrets_key" "secret" .Values.secrets.probaraSecretsKeyExistingSecret "secretKey" .Values.secrets.probaraSecretsKeyExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with (include "monitoring-platform.smtpEnv" .) }}
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.alerter.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: metrics
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.alerter.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,159 @@
|
||||
{{- if .Values.api.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
replicas: {{ .Values.api.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: api
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if or .Values.postgresql.enabled .Values.nats.enabled }}
|
||||
initContainers:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- if .Values.nats.enabled }}
|
||||
- name: wait-for-nats
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.natsHost" . }} 4222; do
|
||||
echo "Waiting for NATS..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: api
|
||||
image: "{{ .Values.image.repository }}-api:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: ["./api"]
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.api.httpPort }}
|
||||
protocol: TCP
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.api.metricsPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "api"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ .Values.api.httpPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ .Values.api.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ .Values.api.logLevel }}"
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
|
||||
- name: CHECK_JOB_STREAM
|
||||
value: {{ .Values.scheduler.checkJobStream | quote }}
|
||||
# Must match the scheduler/worker subject: "Run now" publishes
|
||||
# check jobs onto this subject and silently breaks if they diverge.
|
||||
- name: CHECK_JOB_SUBJECT
|
||||
value: {{ .Values.scheduler.checkJobSubject | quote }}
|
||||
- name: CHECK_RESULT_SUBJECT
|
||||
value: "check.results"
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_LOCATION_AUTH_ISSUER_SEED" "key" "nats_location_auth_issuer_seed" "secret" .Values.nats.auth.locationIssuerSeedExistingSecret "secretKey" .Values.nats.auth.locationIssuerSeedExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "ADMIN_JWT_SECRET" "key" "admin_jwt_secret" "secret" .Values.secrets.adminJwtSecretExistingSecret "secretKey" .Values.secrets.adminJwtSecretExistingSecretKey) | nindent 8 }}
|
||||
{{- with .Values.api.publicBaseURL }}
|
||||
- name: PUBLIC_BASE_URL
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.api.publicNatsURL }}
|
||||
- name: PUBLIC_NATS_URL
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
- name: AUDIT_RETENTION_DAYS
|
||||
value: {{ .Values.auth.auditRetentionDays | quote }}
|
||||
{{- if .Values.auth.oidc.enabled }}
|
||||
- name: OIDC_ENABLED
|
||||
value: "true"
|
||||
- name: OIDC_ISSUER_URL
|
||||
value: {{ .Values.auth.oidc.issuerUrl | quote }}
|
||||
- name: OIDC_CLIENT_ID
|
||||
value: {{ .Values.auth.oidc.clientId | quote }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "OIDC_CLIENT_SECRET" "key" "oidc_client_secret" "secret" .Values.secrets.oidcClientSecretExistingSecret "secretKey" .Values.secrets.oidcClientSecretExistingSecretKey) | nindent 8 }}
|
||||
- name: OIDC_SCOPES
|
||||
value: {{ .Values.auth.oidc.scopes | quote }}
|
||||
- name: OIDC_GROUPS_CLAIM
|
||||
value: {{ .Values.auth.oidc.groupsClaim | quote }}
|
||||
- name: OIDC_PROVIDER_LABEL
|
||||
value: {{ .Values.auth.oidc.providerLabel | quote }}
|
||||
- name: OIDC_JIT_PROVISION
|
||||
value: {{ .Values.auth.oidc.jitProvision | quote }}
|
||||
- name: OIDC_JIT_DEFAULT_ROLE
|
||||
value: {{ .Values.auth.oidc.jitDefaultRole | quote }}
|
||||
- name: OIDC_JIT_DEFAULT_TENANT_ID
|
||||
value: {{ .Values.auth.oidc.jitDefaultTenantId | quote }}
|
||||
{{- end }}
|
||||
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "PROBARA_SECRETS_KEY" "key" "probara_secrets_key" "secret" .Values.secrets.probaraSecretsKeyExistingSecret "secretKey" .Values.secrets.probaraSecretsKeyExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with (include "monitoring-platform.smtpEnv" .) }}
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.api.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,89 @@
|
||||
{{- if .Values.frontend.enabled }}
|
||||
{{- $apiProxyTarget := .Values.frontend.apiProxyTarget | default (printf "http://%s-api:%v" (include "monitoring-platform.fullname" .) .Values.api.httpPort) }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-frontend
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
replicas: {{ .Values.frontend.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: frontend
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if .Values.api.enabled }}
|
||||
initContainers:
|
||||
- name: wait-for-api
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.fullname" . }}-api {{ .Values.api.httpPort }}; do
|
||||
echo "Waiting for API..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: frontend
|
||||
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy | default .Values.frontend.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.frontend.httpPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: NEXT_PUBLIC_API_URL
|
||||
value: "{{ .Values.frontend.apiUrl }}"
|
||||
- name: NEXT_PUBLIC_STATUS_PAGE_URL
|
||||
value: "{{ .Values.frontend.statusPageUrl | default .Values.statusPage.baseUrl }}"
|
||||
- name: API_PROXY_TARGET
|
||||
value: "{{ $apiProxyTarget }}"
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.frontend.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.frontend.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.frontend.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,127 @@
|
||||
{{- if .Values.scheduler.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-scheduler
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: scheduler
|
||||
spec:
|
||||
replicas: {{ .Values.scheduler.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: scheduler
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: scheduler
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if or .Values.postgresql.enabled .Values.nats.enabled }}
|
||||
initContainers:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- if .Values.nats.enabled }}
|
||||
- name: wait-for-nats
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.natsHost" . }} 4222; do
|
||||
echo "Waiting for NATS..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: scheduler
|
||||
image: "{{ .Values.image.repository }}-scheduler:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: ["./scheduler"]
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.scheduler.metricsPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "scheduler"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ .Values.scheduler.metricsPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ .Values.scheduler.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ .Values.scheduler.logLevel }}"
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
|
||||
- name: CHECK_JOB_STREAM
|
||||
value: "{{ .Values.scheduler.checkJobStream }}"
|
||||
- name: CHECK_JOB_SUBJECT
|
||||
value: "{{ .Values.scheduler.checkJobSubject }}"
|
||||
- name: SCHEDULE_INTERVAL_SECONDS
|
||||
value: "{{ .Values.scheduler.intervalSeconds }}"
|
||||
- name: RETENTION_CLEANUP_ENABLED
|
||||
value: "{{ .Values.scheduler.retentionCleanupEnabled }}"
|
||||
- name: RETENTION_CLEANUP_HOUR_UTC
|
||||
value: "{{ .Values.scheduler.retentionCleanupHourUTC }}"
|
||||
- name: RETENTION_CLEANUP_BATCH_SIZE
|
||||
value: "{{ .Values.scheduler.retentionCleanupBatchSize }}"
|
||||
- name: RETENTION_CLEANUP_MAX_ROWS_PER_RUN
|
||||
value: "{{ .Values.scheduler.retentionCleanupMaxRowsPerRun }}"
|
||||
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }}
|
||||
# The scheduler decrypts encrypted monitor configs at dispatch time and
|
||||
# location credentials in results ingest; without the key those
|
||||
# monitors silently fail to schedule.
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "PROBARA_SECRETS_KEY" "key" "probara_secrets_key" "secret" .Values.secrets.probaraSecretsKeyExistingSecret "secretKey" .Values.secrets.probaraSecretsKeyExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.scheduler.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: metrics
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.scheduler.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,115 @@
|
||||
{{- if .Values.statusPage.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-status-page
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: status-page
|
||||
spec:
|
||||
replicas: {{ .Values.statusPage.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: status-page
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: status-page
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
initContainers:
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: status-page
|
||||
image: "{{ .Values.image.repository }}-status-page:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: ["./status-page"]
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.statusPage.httpPort }}
|
||||
protocol: TCP
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.statusPage.metricsPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "status-page"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ .Values.statusPage.httpPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ .Values.statusPage.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ .Values.statusPage.logLevel }}"
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
|
||||
{{- if .Values.statusPage.baseUrl }}
|
||||
- name: STATUS_PAGE_BASE_URL
|
||||
value: "{{ .Values.statusPage.baseUrl }}"
|
||||
{{- end }}
|
||||
{{- if .Values.statusPage.vapid.publicKey }}
|
||||
# Rendered as a literal on purpose. The VAPID public key is published
|
||||
# inside every status page as the applicationServerKey, so it is not a
|
||||
# credential and does not belong in a Secret. Its private half below
|
||||
# always goes through secretEnv.
|
||||
- name: STATUS_PAGE_VAPID_PUBLIC_KEY
|
||||
value: "{{ .Values.statusPage.vapid.publicKey }}"
|
||||
{{- end }}
|
||||
{{- if .Values.statusPage.vapid.subject }}
|
||||
- name: STATUS_PAGE_VAPID_SUBJECT
|
||||
value: "{{ .Values.statusPage.vapid.subject }}"
|
||||
{{- end }}
|
||||
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.statusPageVapidPrivateKey "secret" .Values.secrets.statusPageVapidPrivateKeyExistingSecret) }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "STATUS_PAGE_VAPID_PRIVATE_KEY" "key" "status_page_vapid_private_key" "secret" .Values.secrets.statusPageVapidPrivateKeyExistingSecret "secretKey" .Values.secrets.statusPageVapidPrivateKeyExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.statusPage.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.statusPage.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,127 @@
|
||||
{{- /*
|
||||
Per-location worker deployments for private locations whose workers run in the
|
||||
SAME cluster as the platform (e.g. one fleet per VPC reached over a service
|
||||
mesh). Locations outside the cluster deploy the worker themselves using the
|
||||
snippet from the Locations page. Location workers are NATS-only: no
|
||||
POSTGRES_URL — results travel back over NATS.
|
||||
*/}}
|
||||
{{- range .Values.worker.locations }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" $ }}-worker-{{ .name }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: worker-location
|
||||
probara.io/location: {{ .name | quote }}
|
||||
spec:
|
||||
replicas: {{ .replicas | default 1 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: worker-location
|
||||
probara.io/location: {{ .name | quote }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with $.Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" $ | nindent 8 }}
|
||||
app.kubernetes.io/component: worker-location
|
||||
probara.io/location: {{ .name | quote }}
|
||||
spec:
|
||||
{{- if $.Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" $ }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: worker
|
||||
image: "{{ $.Values.image.repository }}-worker:{{ $.Values.image.tag | default $.Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ $.Values.global.imagePullPolicy }}
|
||||
command: ["./worker"]
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ $.Values.worker.metricsPort }}
|
||||
protocol: TCP
|
||||
- name: http
|
||||
containerPort: {{ $.Values.worker.httpPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "worker"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ $.Values.worker.httpPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ $.Values.worker.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ $.Values.worker.logLevel }}"
|
||||
{{- if .existingSecret }}
|
||||
- name: NATS_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret | quote }}
|
||||
key: {{ .natsUrlKey | default "nats_url" | quote }}
|
||||
{{- else }}
|
||||
- name: NATS_URL
|
||||
value: {{ required "each worker.locations entry needs its location-authenticated natsUrl (or an existingSecret supplying it)" .natsUrl | quote }}
|
||||
{{- end }}
|
||||
- name: CHECK_JOB_STREAM
|
||||
value: "{{ $.Values.worker.checkJobStream }}"
|
||||
- name: CHECK_JOB_SUBJECT
|
||||
value: "{{ $.Values.worker.checkJobSubject }}"
|
||||
- name: NATS_CONSUMER_NAME
|
||||
# Scheduler pre-creates this fixed per-location durable so the
|
||||
# restricted worker account never needs JetStream management rights.
|
||||
value: "check-workers"
|
||||
- name: WORKER_LOCATION_ID
|
||||
value: {{ required "each worker.locations entry needs locationId (the location UUID)" .locationId | quote }}
|
||||
{{- if .existingSecret }}
|
||||
- name: LOCATION_CREDENTIAL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .existingSecret | quote }}
|
||||
key: {{ .credentialKey | default "credential" | quote }}
|
||||
{{- else }}
|
||||
- name: LOCATION_CREDENTIAL
|
||||
value: {{ required "each worker.locations entry needs credential from the location deploy info (or an existingSecret supplying it)" .credential | quote }}
|
||||
{{- end }}
|
||||
- name: WORKER_CONCURRENCY
|
||||
value: "{{ .concurrency | default $.Values.worker.concurrency }}"
|
||||
{{- with $.Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.worker.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: metrics
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml $.Values.worker.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml $.Values.securityContext | nindent 10 }}
|
||||
{{- with $.Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,124 @@
|
||||
{{- if .Values.worker.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-worker
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
replicas: {{ .Values.worker.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: worker
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if or .Values.postgresql.enabled .Values.nats.enabled }}
|
||||
initContainers:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- if .Values.nats.enabled }}
|
||||
- name: wait-for-nats
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z {{ include "monitoring-platform.natsHost" . }} 4222; do
|
||||
echo "Waiting for NATS..."
|
||||
sleep 2
|
||||
done
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: worker
|
||||
image: "{{ .Values.image.repository }}-worker:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: ["./worker"]
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.worker.metricsPort }}
|
||||
protocol: TCP
|
||||
- name: http
|
||||
containerPort: {{ .Values.worker.httpPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SERVICE_NAME
|
||||
value: "worker"
|
||||
- name: HTTP_PORT
|
||||
value: "{{ .Values.worker.httpPort }}"
|
||||
- name: METRICS_PORT
|
||||
value: "{{ .Values.worker.metricsPort }}"
|
||||
- name: LOG_LEVEL
|
||||
value: "{{ .Values.worker.logLevel }}"
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
|
||||
- name: CHECK_JOB_STREAM
|
||||
value: "{{ .Values.worker.checkJobStream }}"
|
||||
- name: CHECK_JOB_SUBJECT
|
||||
value: "{{ .Values.worker.checkJobSubject }}"
|
||||
- name: NATS_CONSUMER_NAME
|
||||
value: "{{ .Values.worker.consumerName }}"
|
||||
- name: WORKER_CONCURRENCY
|
||||
value: "{{ .Values.worker.concurrency }}"
|
||||
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "PROBARA_SECRETS_KEY" "key" "probara_secrets_key" "secret" .Values.secrets.probaraSecretsKeyExistingSecret "secretKey" .Values.secrets.probaraSecretsKeyExistingSecretKey) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with (include "monitoring-platform.smtpEnv" .) }}
|
||||
{{- . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.worker.extraEnv }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: metrics
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.worker.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if and .Values.worker.enabled .Values.worker.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-worker
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "monitoring-platform.fullname" . }}-worker
|
||||
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "monitoring-platform.fullname" . -}}
|
||||
{{- $apiPort := .Values.api.httpPort -}}
|
||||
{{- $frontendPort := .Values.frontend.httpPort -}}
|
||||
{{- $statusPagePort := .Values.statusPage.httpPort -}}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}-{{ .host | replace "." "-" }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.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 }}
|
||||
tls:
|
||||
{{- range $.Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- if $.Values.frontend.enabled }}
|
||||
{{- if $.Values.api.enabled }}
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}-api
|
||||
port:
|
||||
number: {{ $apiPort }}
|
||||
{{- else }}
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}-frontend
|
||||
port:
|
||||
number: {{ $frontendPort }}
|
||||
{{- end }}
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}-frontend
|
||||
port:
|
||||
number: {{ $frontendPort }}
|
||||
{{- else if $.Values.api.enabled }}
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}-api
|
||||
port:
|
||||
number: {{ $apiPort }}
|
||||
{{- end }}
|
||||
{{- range .paths }}
|
||||
{{- if ne .path "/" }}
|
||||
{{- if ne .path "/api" }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}-status-page
|
||||
port:
|
||||
number: {{ $statusPagePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{- if .Values.migrations.enabled }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-migrations
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: migrations
|
||||
annotations:
|
||||
# Runs AFTER the release manifests are applied (post-install/post-upgrade),
|
||||
# so new pods may briefly run against the old schema until this job
|
||||
# finishes; application code must tolerate that window. We cannot use a
|
||||
# pre-install hook: on first install the chart's own PostgreSQL would not
|
||||
# exist yet for the migrations to run against.
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "-5"
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: migrations
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
initContainers:
|
||||
# Wait for embedded PostgreSQL to be ready
|
||||
- name: wait-for-postgresql
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for PostgreSQL to be ready..."
|
||||
until nc -z {{ include "monitoring-platform.fullname" . }}-postgresql 5432; do
|
||||
echo "PostgreSQL is not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "PostgreSQL is ready!"
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: migrations
|
||||
{{- if .Values.migrations.image.repository }}
|
||||
image: "{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag | default (.Values.image.tag | default .Chart.AppVersion) }}"
|
||||
{{- else }}
|
||||
image: "{{ .Values.image.repository }}-migrations:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
{{- end }}
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
env:
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 12 }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.migrations.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.migrations.resources | nindent 12 }}
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- /*
|
||||
Server config for the embedded broker. It must stay free of secret material,
|
||||
so the platform user is NOT declared here: the StatefulSet passes it as
|
||||
--user/--pass, with the password substituted by Kubernetes from a Secret-backed
|
||||
env var. nats-server merges those flags with this authorization block, leaving
|
||||
auth_callout active for every other user (verified: the platform user connects
|
||||
immediately, others still go through callout).
|
||||
|
||||
Do not move the password back into this file via nats-server's $VAR expansion.
|
||||
It re-parses the expanded token as configuration, so passwords that are purely
|
||||
numeric, look boolean, or contain a space, comma or brace abort startup — and
|
||||
quoting the reference suppresses expansion entirely, silently making the
|
||||
literal "$NATS_PLATFORM_PASSWORD" the password. The issuer public key below is
|
||||
public by construction and safe to template.
|
||||
*/}}
|
||||
{{- if and .Values.nats.enabled .Values.nats.auth.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-nats-config
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: nats
|
||||
data:
|
||||
nats.conf: |
|
||||
jetstream {
|
||||
store_dir: /data
|
||||
}
|
||||
http_port: 8222
|
||||
authorization {
|
||||
auth_callout {
|
||||
issuer: {{ required "nats.auth.locationIssuerPublicKey is required when nats.auth.enabled" .Values.nats.auth.locationIssuerPublicKey | quote }}
|
||||
auth_users: [{{ required "nats.auth.platformUser is required when nats.auth.enabled" .Values.nats.auth.platformUser | quote }}]
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- if .Values.nats.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-nats
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: nats
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 4222
|
||||
targetPort: client
|
||||
protocol: TCP
|
||||
name: client
|
||||
- port: 8222
|
||||
targetPort: monitor
|
||||
protocol: TCP
|
||||
name: monitor
|
||||
- port: 6222
|
||||
targetPort: cluster
|
||||
protocol: TCP
|
||||
name: cluster
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: nats
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
{{- if .Values.nats.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-nats
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: nats
|
||||
spec:
|
||||
serviceName: {{ include "monitoring-platform.fullname" . }}-nats
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: nats
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: nats
|
||||
spec:
|
||||
containers:
|
||||
- name: nats
|
||||
image: "{{ .Values.nats.image }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
- "-c"
|
||||
- "/etc/nats/nats.conf"
|
||||
# The platform user lives here rather than in nats.conf so the
|
||||
# password never passes through the config parser: Kubernetes
|
||||
# substitutes $(NATS_PLATFORM_PASSWORD) literally, which nats.conf's
|
||||
# own $VAR expansion cannot do safely.
|
||||
- "--user"
|
||||
- {{ .Values.nats.auth.platformUser | quote }}
|
||||
- "--pass"
|
||||
- "$(NATS_PLATFORM_PASSWORD)"
|
||||
{{- else }}
|
||||
- "-js"
|
||||
- "-m"
|
||||
- "8222"
|
||||
- "-sd"
|
||||
- "/data"
|
||||
{{- end }}
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
env:
|
||||
# Referenced as $(NATS_PLATFORM_PASSWORD) in args above, substituted
|
||||
# by Kubernetes, so the password stays out of the ConfigMap.
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_PLATFORM_PASSWORD" "key" "nats_platform_password" "secret" .Values.nats.auth.platformPasswordExistingSecret "secretKey" .Values.nats.auth.platformPasswordExistingSecretKey) | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: client
|
||||
containerPort: 4222
|
||||
protocol: TCP
|
||||
- name: monitor
|
||||
containerPort: 8222
|
||||
protocol: TCP
|
||||
- name: cluster
|
||||
containerPort: 6222
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: monitor
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: monitor
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.nats.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
- name: config
|
||||
mountPath: /etc/nats
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if or (not .Values.nats.persistence.enabled) .Values.nats.auth.enabled }}
|
||||
volumes:
|
||||
{{- if not .Values.nats.persistence.enabled }}
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.nats.auth.enabled }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-nats-config
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.nats.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- if .Values.nats.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.nats.persistence.storageClass }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.nats.persistence.size }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-postgresql
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: postgresql
|
||||
protocol: TCP
|
||||
name: postgresql
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-postgresql
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
serviceName: {{ include "monitoring-platform.fullname" . }}-postgresql
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: postgresql
|
||||
spec:
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: "{{ .Values.postgresql.image }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: postgresql
|
||||
containerPort: 5432
|
||||
protocol: TCP
|
||||
env:
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_USER" "key" "postgresql_username" "secret" .Values.postgresql.auth.existingSecret "secretKey" .Values.postgresql.auth.existingSecretUserKey) | nindent 12 }}
|
||||
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_PASSWORD" "key" "postgresql_password" "secret" .Values.postgresql.auth.existingSecret "secretKey" .Values.postgresql.auth.existingSecretPasswordKey) | nindent 12 }}
|
||||
- name: POSTGRES_DB
|
||||
value: "{{ .Values.postgresql.auth.database }}"
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.auth.username }} -d {{ .Values.postgresql.auth.database }} -h 127.0.0.1 -p 5432
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.auth.username }} -d {{ .Values.postgresql.auth.database }} -h 127.0.0.1 -p 5432
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.postgresql.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
{{- if .Values.postgresql.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- if .Values.postgresql.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.postgresql.persistence.storageClass }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgresql.persistence.size }}
|
||||
{{- else }}
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
{{- /*
|
||||
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 }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.alerter.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-alerter
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: alerter
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.alerter.metricsPort }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: alerter
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.api.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.api.httpPort }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
- port: {{ .Values.api.metricsPort }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if .Values.frontend.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-frontend
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
type: {{ .Values.frontend.service.type | default "ClusterIP" }}
|
||||
ports:
|
||||
- port: {{ .Values.frontend.service.port | default .Values.frontend.httpPort }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: frontend
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.scheduler.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-scheduler
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: scheduler
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.scheduler.metricsPort }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: scheduler
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.statusPage.enabled }}
|
||||
{{- $serviceType := .Values.statusPage.service.type | default "ClusterIP" }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-status-page
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: status-page
|
||||
spec:
|
||||
type: {{ $serviceType }}
|
||||
ports:
|
||||
- port: {{ .Values.statusPage.service.port | default .Values.statusPage.httpPort }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
{{- if and (eq $serviceType "NodePort") .Values.statusPage.service.nodePort }}
|
||||
nodePort: {{ .Values.statusPage.service.nodePort }}
|
||||
{{- end }}
|
||||
- port: {{ .Values.statusPage.metricsPort }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
{{- if and (eq $serviceType "NodePort") .Values.statusPage.service.metricsNodePort }}
|
||||
nodePort: {{ .Values.statusPage.service.metricsNodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: status-page
|
||||
{{- end }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- /*
|
||||
Optional per-location Service exposing the mesh echo port (GET /mesh/echo) so
|
||||
OTHER locations can probe this one. Enable meshService on a location entry and
|
||||
set the location's mesh_endpoint (Locations page) to this Service's reachable
|
||||
address — e.g. an internal NLB address routable across your VPCs.
|
||||
*/}}
|
||||
{{- range .Values.worker.locations }}
|
||||
{{- if and .meshService .meshService.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" $ }}-worker-{{ .name }}-mesh
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: worker-location
|
||||
probara.io/location: {{ .name | quote }}
|
||||
{{- with .meshService.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .meshService.type | default "ClusterIP" }}
|
||||
ports:
|
||||
- port: {{ $.Values.worker.httpPort }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: worker-location
|
||||
probara.io/location: {{ .name | quote }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.worker.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.fullname" . }}-worker
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.worker.metricsPort }}
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
name: metrics
|
||||
selector:
|
||||
{{- include "monitoring-platform.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "monitoring-platform.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Reference in new issue
Block a user