From 1897caecbdf7e4564f36e4f1e846039c1ed19f16 Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:19:54 +0500 Subject: [PATCH 1/7] release: stage official UTU Engine 1.0.0 Helm chart and license --- LICENSE | 36 +++ helm/utu-engine/Chart.yaml | 6 + helm/utu-engine/templates/_helpers.tpl | 59 +++++ .../templates/bootstrap-secret.yaml | 60 +++++ helm/utu-engine/templates/deployment.yaml | 227 ++++++++++++++++++ helm/utu-engine/templates/ingress.yaml | 35 +++ .../templates/network-deep-rbac.yaml | 53 ++++ helm/utu-engine/templates/networkpolicy.yaml | 38 +++ .../templates/postgresql-init-configmap.yaml | 19 ++ .../templates/postgresql-service.yaml | 18 ++ .../templates/postgresql-statefulset.yaml | 92 +++++++ .../templates/rbac-namespaced-reader.yaml | 100 ++++++++ .../templates/rbac-optional-cluster-read.yaml | 55 +++++ helm/utu-engine/templates/rbac.yaml | 158 ++++++++++++ helm/utu-engine/templates/service.yaml | 20 ++ helm/utu-engine/templates/serviceaccount.yaml | 8 + helm/utu-engine/values.yaml | 214 +++++++++++++++++ 17 files changed, 1198 insertions(+) create mode 100644 LICENSE create mode 100644 helm/utu-engine/Chart.yaml create mode 100644 helm/utu-engine/templates/_helpers.tpl create mode 100644 helm/utu-engine/templates/bootstrap-secret.yaml create mode 100644 helm/utu-engine/templates/deployment.yaml create mode 100644 helm/utu-engine/templates/ingress.yaml create mode 100644 helm/utu-engine/templates/network-deep-rbac.yaml create mode 100644 helm/utu-engine/templates/networkpolicy.yaml create mode 100644 helm/utu-engine/templates/postgresql-init-configmap.yaml create mode 100644 helm/utu-engine/templates/postgresql-service.yaml create mode 100644 helm/utu-engine/templates/postgresql-statefulset.yaml create mode 100644 helm/utu-engine/templates/rbac-namespaced-reader.yaml create mode 100644 helm/utu-engine/templates/rbac-optional-cluster-read.yaml create mode 100644 helm/utu-engine/templates/rbac.yaml create mode 100644 helm/utu-engine/templates/service.yaml create mode 100644 helm/utu-engine/templates/serviceaccount.yaml create mode 100644 helm/utu-engine/values.yaml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..067d688 --- /dev/null +++ b/LICENSE @@ -0,0 +1,36 @@ +UTU ENGINE PROPRIETARY SOFTWARE LICENSE + +Copyright © 2026 Yergali Yerkalin. +All rights reserved. + +UTU Engine, including its source code, documentation, user interface, build files, +configuration, and other original materials in this repository (collectively, +the "Software"), is proprietary software owned by Yergali Yerkalin. + +No license or other rights to the Software are granted by possession of, access +to, or receipt of the Software except under a separate written license agreement +signed or otherwise accepted by the copyright owner. + +Without such a separate written agreement, you may not, in whole or in part: + +- copy or reproduce the Software; +- modify, adapt, translate, reverse engineer, or create derivative works of the + Software, except to the extent such a restriction is prohibited by applicable + law; +- distribute, publish, disclose, transmit, or make the Software or its source + code available to any third party; +- sublicense, rent, lease, sell, resell, assign, or otherwise transfer the + Software; +- use the Software in, or incorporate it into, a commercial product or service; +- remove or alter proprietary notices. + +Third-party software and open-source components that are included with, used by, +or distributed alongside UTU Engine are not relicensed by this document. Those +components remain subject to their respective copyright notices and license +terms. + +THE SOFTWARE IS PROVIDED ONLY UNDER THE TERMS OF AN APPLICABLE WRITTEN LICENSE +AGREEMENT. EXCEPT AS EXPRESSLY STATED IN SUCH AN AGREEMENT, NO WARRANTIES, +SUPPORT COMMITMENTS, SERVICE LEVELS, INDEMNITIES, OR OTHER RIGHTS ARE GRANTED. + +For commercial licensing inquiries, contact the copyright owner. diff --git a/helm/utu-engine/Chart.yaml b/helm/utu-engine/Chart.yaml new file mode 100644 index 0000000..09b1e23 --- /dev/null +++ b/helm/utu-engine/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: utu-engine +description: UTU Engine — application-centric incident investigation platform +version: 1.0.0 +appVersion: "1.0.0" +type: application diff --git a/helm/utu-engine/templates/_helpers.tpl b/helm/utu-engine/templates/_helpers.tpl new file mode 100644 index 0000000..c1fdd3a --- /dev/null +++ b/helm/utu-engine/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{- define "utu-engine.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "utu-engine.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 }} + +{{- define "utu-engine.labels" -}} +app.kubernetes.io/name: {{ include "utu-engine.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +{{- end }} + +{{- define "utu-engine.selectorLabels" -}} +app.kubernetes.io/name: {{ include "utu-engine.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "utu-engine.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "utu-engine.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "utu-engine.bootstrapSecretName" -}} +{{- if .Values.secrets.existingSecret }} +{{- .Values.secrets.existingSecret }} +{{- else }} +{{- printf "%s-bootstrap" (include "utu-engine.fullname" .) }} +{{- end }} +{{- end }} + + +{{- define "utu-engine.image" -}} +{{- $repository := required "image.repository must be set" .Values.image.repository -}} +{{- $digest := trim (default "" .Values.image.digest) -}} +{{- if $digest -}} +{{- if not (regexMatch "^sha256:[0-9a-f]{64}$" $digest) -}} +{{- fail "image.digest must be a full immutable sha256:<64 lowercase hex> reference" -}} +{{- end -}} +{{- printf "%s@%s" $repository $digest -}} +{{- else -}} +{{- $tag := trim (required "image.tag must be set when image.digest is empty" .Values.image.tag) -}} +{{- printf "%s:%s" $repository $tag -}} +{{- end -}} +{{- end }} diff --git a/helm/utu-engine/templates/bootstrap-secret.yaml b/helm/utu-engine/templates/bootstrap-secret.yaml new file mode 100644 index 0000000..f527e7d --- /dev/null +++ b/helm/utu-engine/templates/bootstrap-secret.yaml @@ -0,0 +1,60 @@ +{{- if and .Release.IsUpgrade (not .Values.secrets.existingSecret) -}} +{{- $previous := lookup "v1" "Secret" .Release.Namespace (include "utu-engine.bootstrapSecretName" .) -}} +{{- if not $previous -}} +{{- fail "UTU Engine upgrade blocked: current bootstrap Secret is missing. This chart is NOT an in-place rename of a legacy release; keep the existing PostgreSQL PVC and Secret and plan an explicit migration." -}} +{{- end -}} +{{- range $requiredKey := (list .Values.secrets.keys.databaseUrl .Values.secrets.keys.masterKey .Values.secrets.keys.authKey .Values.secrets.keys.postgresqlAdminPassword .Values.secrets.keys.postgresqlPassword) -}} +{{- if not (index $previous.data $requiredKey) -}} +{{- fail (printf "UTU Engine upgrade blocked: bootstrap Secret is missing required key %q; refusing silent key rotation." $requiredKey) -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- if and (not .Values.postgresql.enabled) (not .Values.secrets.existingSecret) -}} +{{- fail "postgresql.enabled=false requires secrets.existingSecret with an external PostgreSQL database-url" -}} +{{- end -}} +{{- if not .Values.secrets.existingSecret }} +{{- $secretName := include "utu-engine.bootstrapSecretName" . -}} +{{- $existing := lookup "v1" "Secret" .Release.Namespace $secretName -}} +{{- $adminPassword := randAlphaNum 32 -}} +{{- $postgresqlPassword := randAlphaNum 32 -}} +{{- $masterKey := randBytes 32 | replace "+" "-" | replace "/" "_" -}} +{{- $authKey := randBytes 32 | replace "+" "-" | replace "/" "_" -}} +{{- $bootstrapAdminPassword := randAlphaNum 24 -}} +{{- if $existing }} + {{- if index $existing.data .Values.secrets.keys.postgresqlAdminPassword }} + {{- $adminPassword = index $existing.data .Values.secrets.keys.postgresqlAdminPassword | b64dec -}} + {{- end }} + {{- if index $existing.data .Values.secrets.keys.postgresqlPassword }} + {{- $postgresqlPassword = index $existing.data .Values.secrets.keys.postgresqlPassword | b64dec -}} + {{- end }} + {{- if index $existing.data .Values.secrets.keys.masterKey }} + {{- $masterKey = index $existing.data .Values.secrets.keys.masterKey | b64dec -}} + {{- end }} + {{- if index $existing.data .Values.secrets.keys.authKey }} + {{- $authKey = index $existing.data .Values.secrets.keys.authKey | b64dec -}} + {{- end }} + {{- if index $existing.data .Values.secrets.keys.bootstrapAdminPassword }} + {{- $bootstrapAdminPassword = index $existing.data .Values.secrets.keys.bootstrapAdminPassword | b64dec -}} + {{- end }} +{{- end }} +{{- $postgresqlHost := printf "%s-postgresql" (include "utu-engine.fullname" .) -}} +{{- $databaseUrl := printf "postgresql+psycopg://%s:%s@%s:5432/%s" .Values.postgresql.user $postgresqlPassword $postgresqlHost .Values.postgresql.database -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: bootstrap + annotations: + utu-engine.io/credentials: session-keys-generated-initial-password-temporary + utu-engine.io/credential-policy: preserve-on-upgrade +type: Opaque +stringData: + {{ .Values.secrets.keys.postgresqlAdminPassword }}: {{ $adminPassword | quote }} + {{ .Values.secrets.keys.postgresqlPassword }}: {{ $postgresqlPassword | quote }} + {{ .Values.secrets.keys.masterKey }}: {{ $masterKey | quote }} + {{ .Values.secrets.keys.authKey }}: {{ $authKey | quote }} + {{ .Values.secrets.keys.bootstrapAdminPassword }}: {{ $bootstrapAdminPassword | quote }} + {{ .Values.secrets.keys.databaseUrl }}: {{ $databaseUrl | quote }} +{{- end }} diff --git a/helm/utu-engine/templates/deployment.yaml b/helm/utu-engine/templates/deployment.yaml new file mode 100644 index 0000000..fc64597 --- /dev/null +++ b/helm/utu-engine/templates/deployment.yaml @@ -0,0 +1,227 @@ +{{- if or (hasKey .Values "testingLab") (hasKey .Values "internal") }} +{{- fail "Internal diagnostics are not configurable in the official UTU production chart" }} +{{- end }} +{{- if ne (int .Values.replicaCount) 1 }} +{{- fail "UTU Engine V1 supports exactly one Backend Pod (replicaCount: 1); multi-pod execution requires a distributed investigation owner" }} +{{- end }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "utu-engine.fullname" . }} + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: api +spec: + replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + selector: + matchLabels: + {{- include "utu-engine.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: api + template: + metadata: + labels: + {{- include "utu-engine.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: api + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- /* + Helm increments Release.Revision on every upgrade, even when values + and the floating image tag (e.g. :main) are unchanged. Updating this + Pod-template annotation triggers a new Pod, and pullPolicy: Always + resolves the latest tag. User podAnnotations are preserved; the Helm + revision key is reserved so it cannot be overridden accidentally. + */}} + {{- $podAnnotations := deepCopy (default dict .Values.podAnnotations) }} + {{- $_ := set $podAnnotations "utu-engine.io/helm-release-revision" (toString .Release.Revision) }} + annotations: + {{- toYaml $podAnnotations | nindent 8 }} + spec: + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + serviceAccountName: {{ include "utu-engine.serviceAccountName" . }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- /* With a floating tag, migration runs inside the Backend container. + Kubernetes must resolve exactly one image for schema + code. + Digest-pinned releases retain the separate init-container. */ -}} + {{- if and .Values.migration.enabled .Values.image.digest }} + initContainers: + - name: migrate + securityContext: + runAsNonRoot: true + runAsUser: 10001 + runAsGroup: 10001 + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + image: {{ include "utu-engine.image" . | quote }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - /bin/sh + - -ec + - | + until python -c 'from app.db.session import engine; c=engine.connect(); c.close()'; do + echo "waiting for PostgreSQL" + sleep 3 + done + alembic upgrade head + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.databaseUrl }} + - name: UTU_MASTER_KEY + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.masterKey }} + - name: GEMINI_API_KEY + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.legacyGeminiApiKey }} + optional: true + - name: GEMINI_MODEL + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.legacyGeminiModel }} + optional: true + - name: LOG_LEVEL + value: {{ .Values.runtime.logLevel | quote }} + {{- end }} + containers: + - name: utu-engine + securityContext: + runAsNonRoot: true + runAsUser: 10001 + runAsGroup: 10001 + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + image: {{ include "utu-engine.image" . | quote }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if and .Values.migration.enabled (not .Values.image.digest) }} + # No separately pulled migrator: run schema upgrade and API from + # the *same* image so mutable :main can never split their versions. + command: + - /bin/sh + - -ec + - | + until python -c 'from app.db.session import engine; c=engine.connect(); c.close()'; do + echo "waiting for PostgreSQL" + sleep 3 + done + alembic upgrade head + exec uvicorn app.main:app --host 0.0.0.0 --port {{ .Values.service.targetPort }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.targetPort }} + protocol: TCP + env: + # This must be on the application container, not the migrator. + # It is a Helm-controlled install-time capability, not a Tool setting. + - name: UTU_INCLUSTER_DEEP_PROBE_ENABLED + value: {{ and .Values.rbac.create (.Values.networkDeepProbe.enabled | default false) | quote }} + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.databaseUrl }} + - name: UTU_MASTER_KEY + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.masterKey }} + - name: GEMINI_API_KEY + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.legacyGeminiApiKey }} + optional: true + - name: GEMINI_MODEL + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.legacyGeminiModel }} + optional: true + - name: LOG_LEVEL + value: {{ .Values.runtime.logLevel | quote }} + {{- if .Values.runtime.publicBaseUrl }} + - name: PUBLIC_BASE_URL + value: {{ .Values.runtime.publicBaseUrl | quote }} + {{- end }} + - name: AUTH_ENABLED + value: {{ .Values.auth.enabled | quote }} + - name: AUTH_SESSION_TTL_SECONDS + value: {{ .Values.auth.sessionTtlSeconds | quote }} + - name: AUTH_COOKIE_SECURE + value: {{ .Values.auth.cookieSecure | quote }} + {{- if .Values.auth.enabled }} + - name: UTU_AUTH_KEY + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.authKey }} + - name: BOOTSTRAP_SUPERUSER_USERNAME + value: {{ default .Values.auth.bootstrapAdminUsername .Values.auth.bootstrapSuperuserUsername | quote }} + - name: BOOTSTRAP_SUPERUSER_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.bootstrapAdminPassword }} + {{- end }} + {{- if and .Values.migration.enabled (not .Values.image.digest) }} + {{- /* Older customized Helm values may omit the new startup section. */}} + {{- $startupProbeSettings := get (default dict .Values.probes) "startup" | default dict }} + # Disable liveness until this image's Alembic migration completes. + startupProbe: + httpGet: + path: /api/v1/health/database + port: http + initialDelaySeconds: {{ get $startupProbeSettings "initialDelaySeconds" | default 0 }} + periodSeconds: {{ get $startupProbeSettings "periodSeconds" | default 10 }} + timeoutSeconds: {{ get $startupProbeSettings "timeoutSeconds" | default 3 }} + failureThreshold: {{ get $startupProbeSettings "failureThreshold" | default 180 }} + {{- end }} + readinessProbe: + httpGet: + path: /api/v1/health/database + port: http + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.readiness.periodSeconds }} + timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} + failureThreshold: {{ .Values.probes.readiness.failureThreshold }} + livenessProbe: + httpGet: + path: /api/v1/health + port: http + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }} + failureThreshold: {{ .Values.probes.liveness.failureThreshold }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/helm/utu-engine/templates/ingress.yaml b/helm/utu-engine/templates/ingress.yaml new file mode 100644 index 0000000..fcdcbce --- /dev/null +++ b/helm/utu-engine/templates/ingress.yaml @@ -0,0 +1,35 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "utu-engine.fullname" . }} + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "utu-engine.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} + {{- with .Values.ingress.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/utu-engine/templates/network-deep-rbac.yaml b/helm/utu-engine/templates/network-deep-rbac.yaml new file mode 100644 index 0000000..f4e587f --- /dev/null +++ b/helm/utu-engine/templates/network-deep-rbac.yaml @@ -0,0 +1,53 @@ +{{- /* +B10 optional active Deep Probe: grant temporary Job create/get/delete ONLY in +explicit namespaces. Never grant cluster-wide write via an empty list. +*/ -}} +{{- $cfg := (.Values.networkDeepProbe | default dict) -}} +{{- if (get $cfg "enabled" | default false) }} +{{- if not .Values.rbac.create }} +{{- fail "networkDeepProbe.enabled requires rbac.create=true" }} +{{- end }} +{{- $namespaces := get $cfg "namespaces" | default (list) | uniq }} +{{- if eq (len $namespaces) 0 }} +{{- fail "networkDeepProbe.enabled requires a non-empty networkDeepProbe.namespaces allowlist; cluster-wide Job write access is forbidden" }} +{{- end }} +{{- range $namespace := $namespaces }} +{{- if or (not $namespace) (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $namespace)) (gt (len $namespace) 63) }} +{{- fail (printf "networkDeepProbe.namespaces contains invalid namespace: %q" $namespace) }} +{{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "utu-engine.fullname" $ }}-network-deep + namespace: {{ $namespace | quote }} + labels: + {{- include "utu-engine.labels" $ | nindent 4 }} +rules: + - apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create", "get", "delete"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["list"] + - apiGroups: [""] + resources: ["pods/log"] + verbs: ["get"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "utu-engine.fullname" $ }}-network-deep + namespace: {{ $namespace | quote }} + labels: + {{- include "utu-engine.labels" $ | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "utu-engine.serviceAccountName" $ }} + namespace: {{ $.Release.Namespace | quote }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ include "utu-engine.fullname" $ }}-network-deep +{{- end }} +{{- end }} diff --git a/helm/utu-engine/templates/networkpolicy.yaml b/helm/utu-engine/templates/networkpolicy.yaml new file mode 100644 index 0000000..54e260b --- /dev/null +++ b/helm/utu-engine/templates/networkpolicy.yaml @@ -0,0 +1,38 @@ +{{- if .Values.networkPolicy.enabled }} +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: {{ include "utu-engine.fullname" . }}-egress + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +spec: + podSelector: + matchLabels: + {{- include "utu-engine.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: api + policyTypes: + - Egress + egress: +{{ if .Values.networkPolicy.dns.enabled }} + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ .Values.networkPolicy.dns.namespace | quote }} + {{- with .Values.networkPolicy.dns.podSelector }} + podSelector: + matchLabels: + {{- toYaml . | nindent 14 }} + {{- end }} + ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 +{{ end }} +{{ with .Values.networkPolicy.egress }} +{{ toYaml . | nindent 4 }} +{{ end }} +{{ if and (not .Values.networkPolicy.dns.enabled) (not .Values.networkPolicy.egress) }} + [] +{{ end }} +{{- end }} diff --git a/helm/utu-engine/templates/postgresql-init-configmap.yaml b/helm/utu-engine/templates/postgresql-init-configmap.yaml new file mode 100644 index 0000000..80c653e --- /dev/null +++ b/helm/utu-engine/templates/postgresql-init-configmap.yaml @@ -0,0 +1,19 @@ +{{- if .Values.postgresql.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "utu-engine.fullname" . }}-postgresql-init + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: postgresql +data: + 10-utu-app.sh: | + #!/bin/sh + set -eu + # The application uses a least-privilege login; postgres remains the DB administrator. + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" \ + -v app_user="$UTU_DB_USER" -v app_password="$UTU_DB_PASSWORD" -v app_db="$UTU_DB_NAME" <<'SQL' + SELECT format('CREATE ROLE %I LOGIN PASSWORD %L NOSUPERUSER NOCREATEDB NOCREATEROLE', :'app_user', :'app_password') \gexec + SELECT format('CREATE DATABASE %I OWNER %I', :'app_db', :'app_user') \gexec + SQL +{{- end }} diff --git a/helm/utu-engine/templates/postgresql-service.yaml b/helm/utu-engine/templates/postgresql-service.yaml new file mode 100644 index 0000000..e5f7c19 --- /dev/null +++ b/helm/utu-engine/templates/postgresql-service.yaml @@ -0,0 +1,18 @@ +{{- if .Values.postgresql.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "utu-engine.fullname" . }}-postgresql + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: postgresql +spec: + clusterIP: None + selector: + {{- include "utu-engine.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: postgresql + ports: + - name: postgresql + port: 5432 + targetPort: 5432 +{{- end }} diff --git a/helm/utu-engine/templates/postgresql-statefulset.yaml b/helm/utu-engine/templates/postgresql-statefulset.yaml new file mode 100644 index 0000000..1bd3045 --- /dev/null +++ b/helm/utu-engine/templates/postgresql-statefulset.yaml @@ -0,0 +1,92 @@ +{{- if and .Values.postgresql.enabled (not .Values.postgresql.persistence.enabled) -}} +{{- fail "PostgreSQL persistence must remain enabled; refusing an ephemeral production database" -}} +{{- end -}} +{{- if .Values.postgresql.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "utu-engine.fullname" . }}-postgresql + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: postgresql +spec: + serviceName: {{ include "utu-engine.fullname" . }}-postgresql + replicas: 1 + selector: + matchLabels: + {{- include "utu-engine.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: postgresql + template: + metadata: + labels: + {{- include "utu-engine.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: postgresql + spec: + containers: + - name: postgresql + image: {{ .Values.postgresql.image | quote }} + imagePullPolicy: IfNotPresent + ports: + - name: postgresql + containerPort: 5432 + env: + - name: POSTGRES_USER + value: postgres + - name: POSTGRES_DB + value: postgres + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.postgresqlAdminPassword }} + - name: POSTGRES_INITDB_ARGS + value: "--auth-host=scram-sha-256" + - name: UTU_DB_NAME + value: {{ .Values.postgresql.database | quote }} + - name: UTU_DB_USER + value: {{ .Values.postgresql.user | quote }} + - name: UTU_DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "utu-engine.bootstrapSecretName" . }} + key: {{ .Values.secrets.keys.postgresqlPassword }} + readinessProbe: + exec: + command: ["/bin/sh", "-ec", "pg_isready -h 127.0.0.1 -p 5432 -U postgres -d postgres"] + initialDelaySeconds: {{ .Values.postgresql.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.postgresql.probes.readiness.periodSeconds }} + timeoutSeconds: {{ .Values.postgresql.probes.readiness.timeoutSeconds }} + failureThreshold: {{ .Values.postgresql.probes.readiness.failureThreshold }} + livenessProbe: + exec: + command: ["/bin/sh", "-ec", "pg_isready -h 127.0.0.1 -p 5432 -U postgres -d postgres"] + initialDelaySeconds: {{ .Values.postgresql.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.postgresql.probes.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.postgresql.probes.liveness.timeoutSeconds }} + failureThreshold: {{ .Values.postgresql.probes.liveness.failureThreshold }} + resources: + {{- toYaml .Values.postgresql.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /var/lib/postgresql + - name: init-scripts + mountPath: /docker-entrypoint-initdb.d + readOnly: true + volumes: + - name: init-scripts + configMap: + name: {{ include "utu-engine.fullname" . }}-postgresql-init + defaultMode: 0555 + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + {{- toYaml .Values.postgresql.persistence.accessModes | nindent 10 }} + {{- if .Values.postgresql.persistence.storageClass }} + storageClassName: {{ .Values.postgresql.persistence.storageClass | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.postgresql.persistence.size }} +{{- end }} diff --git a/helm/utu-engine/templates/rbac-namespaced-reader.yaml b/helm/utu-engine/templates/rbac-namespaced-reader.yaml new file mode 100644 index 0000000..a42f819 --- /dev/null +++ b/helm/utu-engine/templates/rbac-namespaced-reader.yaml @@ -0,0 +1,100 @@ +{{- if and .Values.rbac.create (eq (.Values.rbac.readerScope | default "cluster") "namespaces") }} +{{- $namespaces := (.Values.rbac.readerNamespaces | default (list)) }} +{{- if eq (len $namespaces) 0 }} +{{- fail "rbac.readerNamespaces must have at least one explicit namespace when rbac.readerScope=namespaces" }} +{{- end }} +{{- range $ns := uniq $namespaces }} +{{- if or (eq $ns "*") (not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $ns)) }} +{{- fail "rbac.readerNamespaces must contain exact valid Kubernetes namespace names" }} +{{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "utu-engine.fullname" $ }}-reader + namespace: {{ $ns | quote }} + labels: + {{- include "utu-engine.labels" $ | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["pods", "services", "endpoints", "events", "persistentvolumeclaims", "resourcequotas", "limitranges"] + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["configmaps", "pods/log"] + verbs: ["get"] + - apiGroups: ["apps"] + resources: ["deployments", "statefulsets", "daemonsets", "replicasets", "controllerrevisions"] + verbs: ["get", "list"] + - apiGroups: ["batch"] + resources: ["jobs", "cronjobs"] + verbs: ["get", "list"] + - apiGroups: ["events.k8s.io"] + resources: ["events"] + verbs: ["get", "list"] + - apiGroups: ["discovery.k8s.io"] + resources: ["endpointslices"] + verbs: ["get", "list"] + - apiGroups: ["autoscaling"] + resources: ["horizontalpodautoscalers"] + verbs: ["get", "list"] + - apiGroups: ["policy"] + resources: ["poddisruptionbudgets"] + verbs: ["get", "list"] + - apiGroups: ["networking.k8s.io"] + resources: ["ingresses", "networkpolicies"] + verbs: ["get", "list"] + {{- if $.Values.rbac.clusterDiagnosticsRead }} + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get"] + {{- end }} + {{- if $.Values.rbac.csiStorageRead }} + - apiGroups: ["storage.k8s.io"] + resources: ["csistoragecapacities"] + verbs: ["list"] + {{- end }} + {{- if $.Values.rbac.kedaRead }} + - apiGroups: ["keda.sh"] + resources: ["scaledobjects", "scaledjobs"] + verbs: ["get", "list"] + {{- end }} + {{- if $.Values.rbac.gatewayApiRead }} + - apiGroups: ["gateway.networking.k8s.io"] + resources: ["gateways", "httproutes", "grpcroutes", "tcproutes"] + verbs: ["get", "list"] + {{- end }} + {{- range $rule := ($.Values.rbac.namespacedExtraReadOnlyRules | default (list)) }} + {{- range $group := ($rule.apiGroups | default (list)) }} + {{- if or (eq $group "*") (eq $group "authentication.k8s.io") (eq $group "authorization.k8s.io") }} + {{- fail "rbac.namespacedExtraReadOnlyRules must not contain wildcard or authorization groups" }} + {{- end }} + {{- end }} + {{- range $resource := ($rule.resources | default (list)) }} + {{- if or (eq $resource "*") (contains "/" $resource) (has (lower $resource) (list "secrets" "tokenreviews" "subjectaccessreviews" "selfsubjectaccessreviews")) }} + {{- fail "rbac.namespacedExtraReadOnlyRules must not grant wildcard, subresource or Secret/authorization resources" }} + {{- end }} + {{- end }} + - apiGroups: + {{- toYaml ($rule.apiGroups | default (list)) | nindent 6 }} + resources: + {{- toYaml ($rule.resources | default (list)) | nindent 6 }} + verbs: ["get", "list"] + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "utu-engine.fullname" $ }}-reader + namespace: {{ $ns | quote }} + labels: + {{- include "utu-engine.labels" $ | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "utu-engine.serviceAccountName" $ }} + namespace: {{ $.Release.Namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ include "utu-engine.fullname" $ }}-reader +{{- end }} +{{- end }} diff --git a/helm/utu-engine/templates/rbac-optional-cluster-read.yaml b/helm/utu-engine/templates/rbac-optional-cluster-read.yaml new file mode 100644 index 0000000..63921ee --- /dev/null +++ b/helm/utu-engine/templates/rbac-optional-cluster-read.yaml @@ -0,0 +1,55 @@ +{{- /* +For rbac.readerScope=namespaces, cluster-scoped evidence requires a separate +strictly read-only ClusterRole. The ordinary reader stays namespaced. +No Secret, Job create, TokenRequest, exec or other mutable permission. +*/ -}} +{{- if and .Values.rbac.create (eq (.Values.rbac.readerScope | default "cluster") "namespaces") (or .Values.rbac.clusterDiagnosticsRead .Values.rbac.csiStorageRead .Values.rbac.gatewayApiRead .Values.rbac.kedaRead) }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "utu-engine.fullname" . }}-optional-cluster-reader + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +rules: + - nonResourceURLs: ["/api", "/apis", "/api/*", "/apis/*"] + verbs: ["get"] + {{- if .Values.rbac.clusterDiagnosticsRead }} + - nonResourceURLs: ["/version", "/livez", "/readyz"] + verbs: ["get"] + - apiGroups: ["apiregistration.k8s.io"] + resources: ["apiservices"] + verbs: ["get"] + - apiGroups: ["admissionregistration.k8s.io"] + resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"] + verbs: ["get"] + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["get"] + {{- end }} + {{- if .Values.rbac.csiStorageRead }} + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses", "csidrivers", "csinodes"] + verbs: ["get"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["list"] + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "utu-engine.fullname" . }}-optional-cluster-reader + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "utu-engine.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "utu-engine.fullname" . }}-optional-cluster-reader +{{- end }} diff --git a/helm/utu-engine/templates/rbac.yaml b/helm/utu-engine/templates/rbac.yaml new file mode 100644 index 0000000..b2b8670 --- /dev/null +++ b/helm/utu-engine/templates/rbac.yaml @@ -0,0 +1,158 @@ +{{- if and .Values.rbac.create (eq (.Values.rbac.readerScope | default "cluster") "cluster") }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "utu-engine.fullname" . }}-reader + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +rules: + - nonResourceURLs: + - /api + - /apis + - /api/* + - /apis/* + verbs: ["get"] + {{- if or .Values.rbac.clusterHealthNonResourceRead .Values.rbac.clusterDiagnosticsRead }} + - nonResourceURLs: ["/version", "/livez", "/readyz"] + verbs: ["get"] + {{- end }} + - apiGroups: [""] + resources: + - namespaces + - nodes + - pods + - services + - endpoints + - events + - persistentvolumeclaims + - persistentvolumes + - resourcequotas + - limitranges + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get"] + - apiGroups: [""] + resources: + - pods/log + verbs: ["get"] + - apiGroups: ["discovery.k8s.io"] + resources: ["endpointslices"] + verbs: ["get", "list"] + - apiGroups: ["apps"] + resources: + - deployments + - statefulsets + - daemonsets + - replicasets + - controllerrevisions + verbs: ["get", "list"] + - apiGroups: ["events.k8s.io"] + resources: + - events + verbs: ["get", "list"] + - apiGroups: ["batch"] + resources: + - jobs + - cronjobs + verbs: ["get", "list"] + - apiGroups: ["autoscaling"] + resources: + - horizontalpodautoscalers + verbs: ["get", "list"] + - apiGroups: ["policy"] + resources: + - poddisruptionbudgets + verbs: ["get", "list"] + - apiGroups: ["networking.k8s.io"] + resources: + - ingresses + - networkpolicies + verbs: ["get", "list"] + {{- if .Values.rbac.clusterDiagnosticsRead }} + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get"] + - apiGroups: ["apiregistration.k8s.io"] + resources: ["apiservices"] + verbs: ["get"] + - apiGroups: ["admissionregistration.k8s.io"] + resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"] + verbs: ["get"] + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["get"] + {{- end }} + {{- if .Values.rbac.csiStorageRead }} + - apiGroups: ["storage.k8s.io"] + resources: ["csidrivers", "csinodes"] + verbs: ["get"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["list"] + - apiGroups: ["storage.k8s.io"] + resources: ["csistoragecapacities"] + verbs: ["list"] + {{- end }} + {{- if .Values.rbac.kedaRead }} + - apiGroups: ["keda.sh"] + resources: ["scaledobjects", "scaledjobs"] + verbs: ["get", "list"] + {{- end }} + {{- if .Values.rbac.gatewayApiRead }} + - apiGroups: ["gateway.networking.k8s.io"] + resources: ["gateways", "httproutes", "grpcroutes", "tcproutes"] + verbs: ["get", "list"] + {{- end }} + - apiGroups: ["storage.k8s.io"] + resources: + - storageclasses + verbs: ["get", "list"] + - apiGroups: ["metrics.k8s.io"] + resources: + - pods + - nodes + verbs: ["get", "list"] + {{- range $index, $rule := .Values.rbac.extraReadOnlyRules }} + {{- range $group := ($rule.apiGroups | default (list)) }} + {{- if eq $group "*" }} + {{- fail "rbac.extraReadOnlyRules apiGroups may not contain wildcard *" }} + {{- end }} + {{- if or (eq $group "authentication.k8s.io") (eq $group "authorization.k8s.io") }} + {{- fail "rbac.extraReadOnlyRules may not grant authentication/authorization API groups" }} + {{- end }} + {{- end }} + {{- range $resource := ($rule.resources | default (list)) }} + {{- $resourceLower := lower $resource }} + {{- if eq $resource "*" }} + {{- fail "rbac.extraReadOnlyRules resources may not contain wildcard *" }} + {{- end }} + {{- if contains "/" $resource }} + {{- fail "rbac.extraReadOnlyRules may not grant Kubernetes subresources" }} + {{- end }} + {{- if has $resourceLower (list "secrets" "tokenreviews" "subjectaccessreviews" "selfsubjectaccessreviews" "selfsubjectrulesreviews") }} + {{- fail "rbac.extraReadOnlyRules may not grant security-sensitive resources" }} + {{- end }} + {{- end }} + - apiGroups: + {{- toYaml ($rule.apiGroups | default (list)) | nindent 6 }} + resources: + {{- toYaml ($rule.resources | default (list)) | nindent 6 }} + verbs: ["get", "list"] + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "utu-engine.fullname" . }}-reader + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "utu-engine.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "utu-engine.fullname" . }}-reader +{{- end }} diff --git a/helm/utu-engine/templates/service.yaml b/helm/utu-engine/templates/service.yaml new file mode 100644 index 0000000..d7d19cd --- /dev/null +++ b/helm/utu-engine/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "utu-engine.fullname" . }} + labels: + {{- include "utu-engine.labels" . | nindent 4 }} + app.kubernetes.io/component: api +spec: + type: {{ .Values.service.type }} + selector: + {{- include "utu-engine.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: api + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: TCP + {{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} diff --git a/helm/utu-engine/templates/serviceaccount.yaml b/helm/utu-engine/templates/serviceaccount.yaml new file mode 100644 index 0000000..61a9242 --- /dev/null +++ b/helm/utu-engine/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "utu-engine.serviceAccountName" . }} + labels: + {{- include "utu-engine.labels" . | nindent 4 }} +{{- end }} diff --git a/helm/utu-engine/values.yaml b/helm/utu-engine/values.yaml new file mode 100644 index 0000000..99f22d2 --- /dev/null +++ b/helm/utu-engine/values.yaml @@ -0,0 +1,214 @@ +# UTU Engine V1 supports one Backend Pod; the Helm Deployment uses Recreate. +# Active Investigations may fail on upgrade and can be retried manually. +replicaCount: 1 +revisionHistoryLimit: 3 +terminationGracePeriodSeconds: 30 + +image: + repository: ghcr.io/utu-engine/platform + tag: "1.0.0" + # Official stable production image; never float with :latest by default. + # With digest empty, Alembic runs inside the SAME Backend image at startup, + # preventing migrator/backend build drift. + # Optional pinned mode: specify full tested sha256 digest. That mode retains + # a dedicated migration init-container with exactly the same pinned image. + digest: "" + pullPolicy: IfNotPresent + +# References to pre-created Kubernetes registry Secrets. Store only Secret names here; +# never commit GHCR usernames, PATs, or docker config JSON to Git/values. +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "utu-engine" + +runtime: + logLevel: INFO + # Optional external base URL used to render clickable Investigation links in notifications. + # Example: https://utu-engine.example.com + publicBaseUrl: "" + +auth: + # Authentication is enabled by default. The first account must rotate its + # temporary bootstrap password before any investigation API can be used. + enabled: true + # Preferred clean-install bootstrap identity. Leave empty to use the + # deprecated bootstrapAdminUsername value for upgrade compatibility. + bootstrapSuperuserUsername: "" + # Deprecated compatibility value for existing Helm releases. + bootstrapAdminUsername: admin + sessionTtlSeconds: 28800 + # HTTPS is required for browser session cookies. The CSRF origin check uses + # this policy to understand TLS-terminating Ingress (browser HTTPS -> Pod HTTP) + # without trusting client-supplied X-Forwarded-* headers. + # For isolated HTTP-only development/port-forward, opt out in local values. + # Never disable for a public HTTPS deployment. + cookieSecure: true + +serviceAccount: + create: true + name: "" + +rbac: + create: true + # Keep existing ClusterRole unchanged unless the administrator explicitly + # migrates to namespace-scoped Roles (in-cluster connection only). + # A switch prunes Helm-managed legacy ClusterRole/Binding: review permissions + # and confirm workloads before enabling. No implicit scope expansion. + readerScope: cluster # cluster | namespaces + readerNamespaces: [] # required when readerScope=namespaces + # Optional exact namespaced resources for scoped Kubernetes Tools, e.g. + # coordination.k8s.io leases, storage.k8s.io csistoragecapacities. + # Cluster resources (PV, VolumeAttachment, APIService/CRD) need independent + # explicit cluster read grants; this Role cannot grant them. + namespacedExtraReadOnlyRules: [] + # Optional fixed non-resource API health paths. Adds no arbitrary URL/host, + # and is only applied to the legacy cluster-reader template. + # Included by default for in-cluster reader; disable any feature separately. + # Tool checkboxes do not grant RBAC. No Secrets, exec or mutation privileges. + clusterDiagnosticsRead: true + csiStorageRead: true + gatewayApiRead: true + kedaRead: true + # Legacy compatibility for /version,/livez,/readyz independent of clusterDiagnosticsRead. + clusterHealthNonResourceRead: true + # Explicit extension point for CRDs/custom APIs needed by generic read. + # Verbs are hard-coded to get/list by the template and wildcard groups/resources + # are rejected. Example: + # extraReadOnlyRules: + # - apiGroups: ["keda.sh"] + # resources: ["scaledobjects"] + extraReadOnlyRules: [] + +# B10 Deep Probe performs an ACTIVE diagnostic by creating temporary Jobs. +# Fail-closed by default. To enable it, opt in AND list explicit namespaces. +# The chart never grants cluster-wide Job create/delete access. Existing +# deployments relying on implicit cluster-wide rights must configure a scoped +# namespace allowlist before an upgrade with this chart. +# Example: +# networkDeepProbe: +# enabled: true +# namespaces: [otel-demo, shipping] +# External kubeconfig Connections need independent namespace-scoped RBAC. +networkDeepProbe: + enabled: false + namespaces: [] + +# Phase 0: present but disabled by default so upgrades and current +# investigations retain their existing network behavior. +# +# When enabled this NetworkPolicy isolates UTU Engine egress. Operators must +# explicitly add every required destination (database, Kubernetes API, +# Prometheus/Elastic/APM and LLM endpoints) using Kubernetes NetworkPolicy +# egress rules. Standard NetworkPolicy does not support FQDN peers. +networkPolicy: + enabled: false + dns: + enabled: true + namespace: kube-system + podSelector: + k8s-app: kube-dns + egress: [] + +service: + type: ClusterIP + port: 80 + targetPort: 8000 + nodePort: null + +ingress: + enabled: false + className: "" + annotations: {} + hosts: + - host: utu-engine.local + paths: + - path: / + pathType: Prefix + tls: [] + +resources: + requests: + cpu: 100m + memory: 256Mi + limits: + cpu: 500m + memory: 768Mi + +probes: + # Used when migration.enabled=true with an unpinned tag: suppress liveness + # until migrations finish, allowing up to 30 minutes before startup fails. + # Optional for legacy customized values files: the template supplies these + # defaults even if startup is missing. Override here if needed. + startup: + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 180 + readiness: + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 6 + liveness: + initialDelaySeconds: 15 + periodSeconds: 20 + timeoutSeconds: 3 + failureThreshold: 3 + +# By default the chart creates one bootstrap Secret and generates all internal +# credentials automatically. Set existingSecret only when you intentionally +# want to manage DATABASE_URL, UTU_MASTER_KEY, authentication secrets and PostgreSQL +# passwords yourself. +secrets: + existingSecret: "" + keys: + databaseUrl: database-url + masterKey: utu-master-key + authKey: utu-auth-key + # Legacy Secret key name is intentionally retained so existing managed and + # external Secrets continue to work. It now bootstraps the first superuser. + bootstrapAdminPassword: bootstrap-admin-password + postgresqlAdminPassword: postgresql-admin-password + postgresqlPassword: postgresql-password + legacyGeminiApiKey: gemini-api-key + legacyGeminiModel: gemini-model + +postgresql: + enabled: true + # Official PostgreSQL 18 (PostgreSQL License); keep storage mounted at /var/lib/postgresql. + image: postgres:18.6 + database: utu-engine + user: utu-engine + persistence: + enabled: true + size: 10Gi + storageClass: "" + accessModes: + - ReadWriteOnce + resources: + requests: + cpu: 100m + memory: 512Mi + limits: + cpu: 500m + memory: 1Gi + probes: + readiness: + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 12 + liveness: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 6 + +migration: + enabled: true + +podAnnotations: {} +podLabels: {} +nodeSelector: {} +tolerations: [] +affinity: {} From 938a1622ec22b6d0129d8acf94d778abf704c475 Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:21:03 +0500 Subject: [PATCH 2/7] docs: add UTU Engine v1.0.0 production Helm and Docker installation --- README.md | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7160d5e..4cc95d0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,82 @@ -# platform -platform +# UTU Engine · Platform + +The official production distribution of **UTU Engine**, an application-centric +incident investigation platform. This repository contains public Helm charts, +versioned releases and installation documentation; proprietary application +source code and development workflows remain private. + +## Production release: v1.0.0 + +| Artifact | Location | +| --- | --- | +| Docker image | `ghcr.io/utu-engine/platform:1.0.0` | +| Latest stable image alias | `ghcr.io/utu-engine/platform:latest` | +| Helm OCI chart | `oci://ghcr.io/utu-engine/charts/utu-engine` (version `1.0.0`) | +| Chart source | `helm/utu-engine` | +| Release archives | [GitHub Releases](https://github.com/utu-engine/platform/releases) | + +### Install + +Requires Helm 3.8+, Kubernetes, working PersistentVolume provisioning, and +network access to the container registry and your observability/LLM systems. + +```bash +helm install utu-engine oci://ghcr.io/utu-engine/charts/utu-engine \ + --version 1.0.0 --namespace utu-engine --create-namespace +``` + +### Download the chart + +```bash +helm pull oci://ghcr.io/utu-engine/charts/utu-engine --version 1.0.0 --untar +``` + +Or clone this repository and install the chart source: + +```bash +helm upgrade --install utu-engine ./helm/utu-engine \ + --namespace utu-engine --create-namespace +``` + +### Pull the application image + +```bash +docker pull ghcr.io/utu-engine/platform:1.0.0 +docker pull ghcr.io/utu-engine/platform:latest +``` + +The Helm chart defaults to the immutable `1.0.0` tag and `IfNotPresent`. +The `latest` alias is published for convenience, not used by default by Helm. + +### Internal capabilities + +The official production image is compiled with an immutable production +capability lock. **Tool Testing Lab** and **Full Technical Audit** cannot +be enabled through Helm, environment variables, or the application's API. +The standard RCA report and redacted Technical Audit remain available. + +These two internal settings do not appear in the public chart. Altering +the software or building a custom image is outside the official distribution. + +### Deployment and data considerations + +The chart runs one UTU Engine Backend and optionally creates a persistent +PostgreSQL 18 database. Bootstrap credentials and encryption keys are generated +as Kubernetes Secrets; preserve those secrets and the PostgreSQL PVC for +upgrade, restore, and recovery. Review the RBAC scope, network egress, +resource limits and HTTPS ingress configuration before external access. + +This first production chart is **not** an in-place migration for a previous +`rca-agent` Helm installation; plan migration separately. + +### Source development and release policy + +Development in `eerkalin/rca-agent` does not publish here. A production +release requires a deliberate manual promotion of an independently tested +production-build candidate. Published SemVer tags are never overwritten. + +### Licensing + +UTU Engine is proprietary software. Refer to [LICENSE](LICENSE) and the +applicable written UTU Engine license agreement before use. Third-party +components remain under their respective licenses. From f7294ddc31480b1c17d8d8b97c6e9abd406f861d Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:21:13 +0500 Subject: [PATCH 3/7] docs: add UTU Engine v1.0.0 release notes --- RELEASE_NOTES.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 RELEASE_NOTES.md diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 0000000..046b98a --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1,18 @@ +# UTU Engine v1.0.0 + +First versioned production release of the UTU Engine application-centric +incident investigation platform. + +- Official multi-architecture image: `ghcr.io/utu-engine/platform:1.0.0`. +- Alias `ghcr.io/utu-engine/platform:latest` tracks the newest stable version. +- Helm OCI chart: `oci://ghcr.io/utu-engine/charts/utu-engine`, version `1.0.0`. +- Default Helm image is pinned to `1.0.0`; pull policy is `IfNotPresent`. +- Tool Testing Lab and internal Full Technical Audit are disabled inside the + production image and cannot be enabled with Helm values or environment + variables. Standard RCA and redacted Technical Audit remain available. +- Includes optional PostgreSQL 18 database, persistent volume and automated + bootstrap secret creation. + +Check namespace RBAC, database backups, HTTPS ingress, NetworkPolicy and +external LLM/observability access before installing. The source code remains +proprietary and is not included in this repository. From 469974cbbbcd7b643a160a0ca0c3dd98aa4eb15e Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:22:18 +0500 Subject: [PATCH 4/7] ci: manually promote verified production image, chart and GitHub Release --- .github/workflows/release.yml | 158 ++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..755d9e9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,158 @@ +name: Publish production release + +# Ordinary development merges never run this workflow. The first release can +# be started by an explicit push to the one-time release/v1.0.0 branch. +# Future versions use only workflow_dispatch from GitHub Actions. +on: + workflow_dispatch: + inputs: + version: + description: Stable SemVer release (e.g. 1.0.1) + required: true + type: string + push: + branches: [release/v1.0.0] + +permissions: + contents: write + packages: write + +concurrency: + group: utu-stable-release + cancel-in-progress: false + +jobs: + release: + if: github.repository == 'utu-engine/platform' + runs-on: ubuntu-latest + timeout-minutes: 35 + env: + VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || '1.0.0' }} + TARGET: ghcr.io/utu-engine/platform + SOURCE_REPO: ghcr.io/eerkalin/incident-investigation-platform + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: azure/setup-helm@v4 + with: + version: v3.17.3 + - name: Validate requested release and public chart + shell: bash + run: | + set -euo pipefail + [[ "$VERSION" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]] + test "$(sed -n 's/^version: //p' helm/utu-engine/Chart.yaml)" = "$VERSION" + test "$(sed -n 's/^appVersion: //p' helm/utu-engine/Chart.yaml | tr -d '"')" = "$VERSION" + grep -q "repository: ghcr.io/utu-engine/platform" helm/utu-engine/values.yaml + grep -q "tag: \"$VERSION\"" helm/utu-engine/values.yaml + grep -q "pullPolicy: IfNotPresent" helm/utu-engine/values.yaml + ! grep -REq 'UTU_FULL_TECHNICAL_AUDIT|TOOL_TESTING_LAB_ENABLED|fullTechnicalAudit' helm/utu-engine/ + helm lint helm/utu-engine + helm template utu-engine helm/utu-engine -n utu-engine > "$RUNNER_TEMP/utu-chart.yaml" + grep -q "ghcr.io/utu-engine/platform:$VERSION" "$RUNNER_TEMP/utu-chart.yaml" + if helm template utu-engine helm/utu-engine --set testingLab.enabled=true > /dev/null 2>&1; then + echo "::error::Tool Lab enabled by an unsupported chart override"; exit 1 + fi + if helm template utu-engine helm/utu-engine --set internal.fullTechnicalAudit=true > /dev/null 2>&1; then + echo "::error::Full audit enabled by an unsupported chart override"; exit 1 + fi + - name: Resolve an independently built candidate + shell: bash + run: | + set -euo pipefail + source_image="$SOURCE_REPO:release-$VERSION" + # Candidate image must be anonymously readable; public workflow + # must not receive source repo read tokens or credentials. + docker manifest inspect "$source_image" >/dev/null + source_digest="$(docker buildx imagetools inspect "$source_image" | awk '$1=="Digest:" {print $2;exit}')" + [[ "$source_digest" =~ ^sha256:[0-9a-f]{64}$ ]] + echo "SOURCE_IMAGE=$SOURCE_REPO@$source_digest" >> "$GITHUB_ENV" + echo "SOURCE_DIGEST=$source_digest" >> "$GITHUB_ENV" + - name: Validate real image under attempted env override + shell: bash + run: | + set -euo pipefail + docker pull --platform linux/amd64 "$SOURCE_IMAGE" + docker run --rm --platform linux/amd64 \ + -e DATABASE_URL='postgresql+psycopg://release:release@127.0.0.1:5432/release' \ + -e TOOL_TESTING_LAB_ENABLED=true \ + -e UTU_FULL_TECHNICAL_AUDIT=true \ + --entrypoint python "$SOURCE_IMAGE" -c ' + from app.version import APP_VERSION + from app.main import app + from app.release_profile import is_production_image + from app.rca.audit_visibility import full_technical_audit_enabled, resolve_technical_audit_mode + assert APP_VERSION == "1.0.0" + assert is_production_image() + assert full_technical_audit_enabled() is False + assert resolve_technical_audit_mode("audit", is_superuser=True) == "audit" + assert not any(route.path.startswith("/api/v1/tool-testing-lab") for route in app.routes) + print("HARDENED PRODUCTION IMAGE PASS") + ' + - name: Package exact Helm chart + run: | + set -euo pipefail + mkdir -p dist + helm package helm/utu-engine --destination dist + test -s "dist/utu-engine-$VERSION.tgz" + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Promote verified immutable image to versioned GHCR package + run: | + set -euo pipefail + # Refuse to overwrite existing stable versions. + if docker buildx imagetools inspect "$TARGET:$VERSION" >/dev/null 2>&1; then + echo "::error::Stable image tag already exists. No overwrite permitted." + exit 1 + fi + docker buildx imagetools create --tag "$TARGET:$VERSION" "$SOURCE_IMAGE" + docker buildx imagetools inspect "$TARGET:$VERSION" + - name: Publish Helm OCI chart + env: + GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + echo "$GHCR_TOKEN" | helm registry login ghcr.io -u "$GITHUB_ACTOR" --password-stdin + helm push "dist/utu-engine-$VERSION.tgz" oci://ghcr.io/utu-engine/charts + - name: Update stable latest alias + run: | + set -euo pipefail + docker buildx imagetools create --tag "$TARGET:latest" "$TARGET:$VERSION" + docker buildx imagetools inspect "$TARGET:latest" + - name: Check unauthenticated download availability + shell: bash + run: | + set -euo pipefail + docker logout ghcr.io || true + helm registry logout ghcr.io || true + export DOCKER_CONFIG="$(mktemp -d)" + export HELM_REGISTRY_CONFIG="$(mktemp)" + docker manifest inspect "$TARGET:$VERSION" >/dev/null || { + echo "::error::Docker package is not public. Set GHCR package visibility to Public, then retry release validation." + exit 1 + } + helm pull oci://ghcr.io/utu-engine/charts/utu-engine --version "$VERSION" --destination "$RUNNER_TEMP" || { + echo "::error::Helm OCI package is not public. Set GHCR chart package visibility to Public." + exit 1 + } + - name: Create public GitHub Release with Helm archive + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + gh release create "v$VERSION" "dist/utu-engine-$VERSION.tgz" \ + --repo "$GITHUB_REPOSITORY" \ + --target "$GITHUB_SHA" \ + --title "UTU Engine v$VERSION" --notes-file RELEASE_NOTES.md + - name: Record provenance + run: | + { + echo "### UTU Engine v$VERSION published" + echo "Source candidate digest: $SOURCE_DIGEST" + echo "Stable image: $TARGET:$VERSION" + echo "Alias: $TARGET:latest" + echo "Helm: oci://ghcr.io/utu-engine/charts/utu-engine" + } >> "$GITHUB_STEP_SUMMARY" From e2c17666df61a9255c33d98b0d8d927ff5375f89 Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:22:54 +0500 Subject: [PATCH 5/7] ci: lint production chart and reject internal diagnostic overrides --- .github/workflows/helm-ci.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/helm-ci.yml diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml new file mode 100644 index 0000000..829b3fc --- /dev/null +++ b/.github/workflows/helm-ci.yml @@ -0,0 +1,40 @@ +name: Validate public Helm release + +on: + pull_request: + branches: [main] + paths: + - 'helm/**' + - '.github/workflows/release.yml' + - '.github/workflows/helm-ci.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + chart: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: azure/setup-helm@v4 + with: + version: v3.17.3 + - name: Lint and template official release chart + run: | + set -euo pipefail + helm lint helm/utu-engine + helm template utu-engine helm/utu-engine -n utu-engine > /tmp/utu.yaml + grep -q 'ghcr.io/utu-engine/platform:1.0.0' /tmp/utu.yaml + ! grep -E 'TOOL_TESTING_LAB_ENABLED|UTU_FULL_TECHNICAL_AUDIT' /tmp/utu.yaml + - name: Reject hidden internal values + run: | + set -euo pipefail + if helm template utu-engine helm/utu-engine --set testingLab.enabled=true >/dev/null 2>&1; then + echo "Tool Testing Lab must not be configurable in production" + exit 1 + fi + if helm template utu-engine helm/utu-engine --set internal.fullTechnicalAudit=true >/dev/null 2>&1; then + echo "Full Technical Audit must not be configurable in production" + exit 1 + fi From 25e8c3fbfb27bafe404102f103b3c0f2c5985dd5 Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:26:31 +0500 Subject: [PATCH 6/7] ci: validate public production release workflow with actionlint --- .github/workflows/helm-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml index 829b3fc..227523f 100644 --- a/.github/workflows/helm-ci.yml +++ b/.github/workflows/helm-ci.yml @@ -20,6 +20,8 @@ jobs: - uses: azure/setup-helm@v4 with: version: v3.17.3 + - name: Validate manually gated release workflow + run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 -color .github/workflows/release.yml - name: Lint and template official release chart run: | set -euo pipefail From 54bcb2411383125aa8476c30bdf92b51949629fa Mon Sep 17 00:00:00 2001 From: eerkalin <80304108+eerkalin@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:27:40 +0500 Subject: [PATCH 7/7] ci: resolve actionlint shellcheck in public release workflow --- .github/workflows/release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 755d9e9..8ddff08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,10 @@ jobs: grep -q "repository: ghcr.io/utu-engine/platform" helm/utu-engine/values.yaml grep -q "tag: \"$VERSION\"" helm/utu-engine/values.yaml grep -q "pullPolicy: IfNotPresent" helm/utu-engine/values.yaml - ! grep -REq 'UTU_FULL_TECHNICAL_AUDIT|TOOL_TESTING_LAB_ENABLED|fullTechnicalAudit' helm/utu-engine/ + if grep -REq 'UTU_FULL_TECHNICAL_AUDIT|TOOL_TESTING_LAB_ENABLED|fullTechnicalAudit' helm/utu-engine/; then + echo "::error::Internal capability leaked into public chart" + exit 1 + fi helm lint helm/utu-engine helm template utu-engine helm/utu-engine -n utu-engine > "$RUNNER_TEMP/utu-chart.yaml" grep -q "ghcr.io/utu-engine/platform:$VERSION" "$RUNNER_TEMP/utu-chart.yaml" @@ -128,8 +131,9 @@ jobs: set -euo pipefail docker logout ghcr.io || true helm registry logout ghcr.io || true - export DOCKER_CONFIG="$(mktemp -d)" - export HELM_REGISTRY_CONFIG="$(mktemp)" + DOCKER_CONFIG="$(mktemp -d)" + HELM_REGISTRY_CONFIG="$(mktemp)" + export DOCKER_CONFIG HELM_REGISTRY_CONFIG docker manifest inspect "$TARGET:$VERSION" >/dev/null || { echo "::error::Docker package is not public. Set GHCR package visibility to Public, then retry release validation." exit 1