Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions charts/insight/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ Invoked from NOTES.txt so they fire on every install.
{{- end -}}
{{- end -}}

{{- /* The authenticator's login-bootstrap resolve
(GET /internal/persons/by-external-id / by-email-override) exists on
identity-resolution only (constructorfabric/insight#1960). Refuse to
render a config that would point it at a service that was never
deployed. */ -}}
{{- if not (default dict .Values.identityResolution).deploy -}}
{{- fail "identityResolution.deploy must be true — the authenticator's login-bootstrap resolve only exists on identity-resolution (constructorfabric/insight#1960)." -}}
{{- end -}}
{{- if not $aoidc.sourceType -}}
{{- fail "authenticator.oidc.sourceType is required — the identity-resolution source_type (e.g. \"ms-entra\") the login-bootstrap resolve is scoped to." -}}
{{- end -}}

{{- /* External hosts (L2 infra is out-of-chart → consumer must supply
host/brokers): the helper templates `insight.<dep>.host` and
`insight.redpanda.brokers` already `required`-fail when empty, so
Expand Down
12 changes: 12 additions & 0 deletions charts/insight/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ metadata:
type: Opaque
stringData:
APP__gears__authenticator__config__redis_url: {{ $redisUrl | quote }}
# The login-bootstrap resolve (GET /internal/persons/by-external-id /
Comment thread
cyberantonz marked this conversation as resolved.
Resolved
# by-email-override) exists on identity-resolution only
# (constructorfabric/insight#1960). `insight.validate` (NOTES.txt) requires
# identityResolution.deploy=true whenever the authenticator is installed,
# so this is never a dangling host.
APP__gears__authenticator__config__identity_url: {{ printf "http://%s:8082" (include "insight.identityResolution.host" .) | quote }}
# Discovery/JWKS issuer served by the authn-tls sidecar. Downstream verifiers
# trust this over https; it is also the minted token `iss`.
Expand All @@ -214,6 +219,13 @@ stringData:
# on the per-user claim (fail closed when neither is present).
APP__gears__authenticator__config__idp__tenant_claim: {{ .Values.authenticator.oidc.tenantClaim | default "tenant_id" | quote }}
APP__gears__authenticator__config__idp__default_tenant_id: {{ .Values.authenticator.oidc.defaultTenantId | default (default "" (default dict .Values.global).tenantDefaultId) | quote }}
# The identity-resolution source_type this IdP is seeded under (e.g.
# "ms-entra") — required; drives the login-bootstrap person lookup
# (GET /internal/persons/by-external-id?source_type=...&external_id=...).
APP__gears__authenticator__config__idp__source_type: {{ required "authenticator.oidc.sourceType is required" .Values.authenticator.oidc.sourceType | quote }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not forget to put proper values to the gitlab gitops

# id_token claim carrying the IdP's stable external user id for source_type
# (Entra: "oid"; the generic OIDC "sub" is not the same directory-stable id).
APP__gears__authenticator__config__idp__external_id_claim: {{ .Values.authenticator.oidc.externalIdClaim | default "sub" | quote }}
{{- with .Values.authenticator.oidc.scopes }}
# Requested OIDC scopes (space-delimited; the gear splits on space/comma).
# `offline_access` is what makes the IdP issue a refresh token — required for
Expand Down
16 changes: 13 additions & 3 deletions charts/insight/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ authenticator:
clientId: "insight-authenticator"
clientSecret: ""
redirectUri: "" # browser-facing callback, through the gateway edge
# The identity-resolution source_type this IdP is seeded under (e.g.
# "ms-entra") — required; the login-bootstrap person lookup is scoped to
# it. No default: an empty value fails config validation at boot.
sourceType: ""
# id_token claim carrying the IdP's stable external user id for
# sourceType (e.g. Entra's "oid"). Defaults to "sub".
externalIdClaim: "sub"
# Honor `/auth/login?__override=<email>` (view-as, #1941): the session is
# minted for that person instead of the authenticated one. Dev/demo
# environments ONLY — MUST stay false anywhere real users log in.
Expand Down Expand Up @@ -441,14 +448,17 @@ analytics:
# The persons-store API. Reads from MariaDB `persons` written by the seed
# pipeline (src/backend/services/identity-resolution/seed/seed-persons-from-identity-input.py)
# fed off ClickHouse `identity.identity_inputs`. NOT an OIDC provider.
# Off by default — enable only after at least one connector sync has
# populated `identity_inputs` and the seed has written `persons` rows.
# Consumers reach it at `http://<release>-identity-resolution:8082`.
# `deploy: true` is mandatory: the authenticator's login-bootstrap resolve
# (GET /internal/persons/by-external-id / by-email-override) lives here
# (constructorfabric/insight#1960), and the authenticator is always installed
# (its "no deploy flag" app-service contract); `insight.validate` fails the
# render otherwise.
# SCHEMA OWNER: identity-resolution's migrate initContainer applies the
# migrations + first-admin bootstrap against `databaseName` — see ADR-0006
# (service-owned migrations).
identityResolution:
deploy: false
deploy: true
replicaCount: 1
image:
repository: ghcr.io/constructorfabric/insight-identity-resolution
Expand Down
28 changes: 18 additions & 10 deletions deploy/HELM_DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ Insight reads engineering and collaboration data from your tools (Jira, Slack, G
- **Gateway** (`insight-gateway`, alias `gateway`) — the OpenResty edge. It owns the public ingress and is the single entrance to the cluster: it routes `/*` to the Frontend and `/api/*` to Analytics/Identity, performing a cached cookie-to-JWT exchange against the Authenticator's `/internal/authz` endpoint (a per-pod Lua cosocket lookup, not nginx's `auth_request`) and injecting the resulting gateway JWT into upstream requests.
- **Authenticator** (`insight-authenticator`, alias `authenticator`) — a separate pod that performs the OIDC login with your IdP, keeps Redis-backed sessions, and mints the ES256 gateway JWT the Gateway injects downstream.
- **Analytics** (`insight-analytics`, alias `analytics`) — serves metrics from the ClickHouse Gold layer.
- **Identity Resolution** (`insight-identity-resolution`, alias `identityResolution`) — resolves people and org data from MariaDB; optional (`identityResolution.deploy`, default `false`).
- **Identity Resolution** (`insight-identity-resolution`, alias `identityResolution`) — resolves people and org data from MariaDB. `identityResolution.deploy: true` is the chart default and effectively required: the Authenticator's login-bootstrap person lookup only exists on this service (constructorfabric/insight#1960), so the chart's `insight.validate` render-time check refuses to install with it off.
- **Frontend** (`insight-frontend`, alias `frontend`) — the web UI (dashboard); optional (`frontend.deploy`, default `true`).

A sixth first-party subchart, `insight-identity-resolution` (alias `identityResolution`), is bundled but off by default and is not part of this install — leave `identityResolution.deploy: false`.

Two more subcharts are bundled for local development only, off by default: `keycloak` (dev mode, embedded database, known admin login) and `fakeidp` (a stateless stub). Neither is a stand's IdP — this runbook expects the real one from [Prerequisites](#cluster-level-dependencies).

You supply one values file, secret files, and optionally one Secret per connector (see [deploy/CONNECTORS.md](./CONNECTORS.md)) — no GitOps repo, CI or auto-reconciliation. The data infrastructure is your side of the contract; see [Prerequisites](#running-external-infrastructure).
Expand Down Expand Up @@ -245,11 +243,19 @@ authenticator:
clientSecret: "<OIDC_CLIENT_SECRET>"
redirectUri: "https://<HOST>/auth/callback" # MUST be set — browser-facing callback through the gateway
scopes: ["openid", "profile", "email", "offline_access"]
sourceType: "<IDP_SOURCE_TYPE>" # MUST be set — the identity-resolution source_type
# your IdP's connector seeds `persons` under (e.g. "ms-entra").
# Scopes the login-bootstrap resolve (constructorfabric/insight#1960).
externalIdClaim: "sub" # id_token claim carrying your IdP's stable external user id
# for sourceType. Default "sub" is correct when `sub` itself is
# that stable id; Entra needs "oid" instead (its `sub` is
# pairwise-unique per client, NOT the directory-stable id).
# csrfOrigins: ["https://<HOST>"] # fail-closed by default: if the UI's POST /auth/logout,
# /auth/refresh or DELETE /auth/sessions return 403, set this

identityResolution:
deploy: true # MUST be true (chart default false)
deploy: true # chart default — the authenticator's login-bootstrap resolve
# only exists here (constructorfabric/insight#1960)
replicaCount: 1
databaseName: "identity"
resources:
Expand Down Expand Up @@ -283,13 +289,14 @@ Fill each placeholder:
| `<CLUSTER_ISSUER>` | A cert-manager `ClusterIssuer` in your cluster, for the authenticator's internal JWKS certificate. Self-signed is fine; the chart's `local-ca` default exists only in this repo's local sandbox |
| `<OIDC_ISSUER>` | Your IdP's issuer URL. Its `/.well-known/openid-configuration` document must resolve from inside the cluster |
| `<OIDC_CLIENT_ID>` / `<OIDC_CLIENT_SECRET>` | Your OIDC client / application registration credentials |
| `<IDP_SOURCE_TYPE>` | The identity-resolution `insight_source_type` your IdP's connector seeds `persons` under (e.g. `ms-entra`) — required, scopes the login-bootstrap resolve |

For infrastructure in the same cluster, use `<service>.<namespace>.svc.cluster.local`. Any resolvable host or IP also works.

Check these four before installing:
Check these before installing:

- Set `identityResolution.deploy: true`. The chart default is `false`, and without the override Identity Resolution — and person resolution for the whole app — never deploys.
- Set real values for `authenticator.oidc.issuerUrl` and `redirectUri`. The chart wraps both in Helm's `required`, and there is no auth-off switch.
- `identityResolution.deploy: true` is the chart default — leave it alone unless you have a specific reason to disable it. This is what the authenticator's login-bootstrap resolve actually depends on; `insight.validate` refuses to render without it.
- Set real values for `authenticator.oidc.issuerUrl`, `redirectUri`, and `sourceType`. The chart wraps all three in Helm's `required`, and there is no auth-off switch.
- Create the Secret named in `authenticator.signingKeysSecret` before installing (Step 2). The chart does not generate it.
- Point the OIDC fields at the real IdP from Prerequisites. The bundled `keycloak`/`fakeidp` subcharts are dev-mode servers for local development, not a stand's IdP.

Expand Down Expand Up @@ -369,10 +376,10 @@ Run all four checks:
```sh
kubectl -n insight get pods
# expect insight-gateway, -authenticator, -analytics, -identity-resolution, -frontend all Running
# (Identity Resolution only with identityResolution.deploy: true; fakeidp/keycloak only with their deploy flag)
# (fakeidp/keycloak only appear with their own deploy flag)

kubectl -n insight get secret insight-analytics-config insight-authenticator-config insight-identity-resolution-config
# the chart composes these from insight-db-creds (the identity-resolution one only when identityResolution.deploy=true)
# the chart composes these from insight-db-creds

helm -n insight history insight
# the ClickHouse migration runs as a post-install/post-upgrade hook Job; Helm deletes it
Expand Down Expand Up @@ -411,12 +418,13 @@ See [deploy/CONNECTORS.md](./CONNECTORS.md) for the connector list and a copy-pa
| `<CLUSTER_ISSUER>` | `authenticator.tlsDiscovery.issuerRef.name` | A cert-manager `ClusterIssuer` that exists in your cluster; internal cert, so self-signed is fine |
| `<OIDC_ISSUER>` | `authenticator.oidc.issuerUrl` | Your IdP's issuer URL |
| `<OIDC_CLIENT_ID>` / `<OIDC_CLIENT_SECRET>` | `authenticator.oidc.clientId`/`clientSecret` | Your OIDC client / application registration credentials. The authenticator is the only OIDC client — the frontend does not register one |
| `<IDP_SOURCE_TYPE>` | `authenticator.oidc.sourceType` | The identity-resolution source_type your IdP's connector seeds `persons` under; required, no default |

Other notable (non-placeholder) settings in this file:

- Image tags are omitted deliberately. Each subchart renders `image.tag | default .Chart.AppVersion`, so a chart release already carries a tested set of product images. Set `<service>.image.tag` only to pin one service to a different build.
- `credentials.deploymentMode: helm` and `credentials.autoGenerate: true` — this enables the "bring your own" credentials path, where the chart keeps a labelless `insight-db-creds` Secret instead of generating random passwords.
- `identityResolution.deploy: true` — required override; the chart's own default is `false`.
- `identityResolution.deploy: true` — the chart default; don't flip it off.
- `authenticator.tlsDiscovery.issuerRef.name` — the cert-manager `ClusterIssuer` the JWKS-discovery Certificate is issued from. Always set this: the chart ships `local-ca`, which is the self-signed root that `make bootstrap-cert-manager ENV=local` creates for the local k3s sandbox, not anything a real cluster has.
- There is no auth-off toggle anywhere in this chart. `authenticator.oidc.issuerUrl` and `authenticator.oidc.redirectUri` are hard `required` fields, so a real IdP is a prerequisite; install Keycloak as a separate release if the stand has none. The bundled `keycloak`/`fakeidp` subcharts are local-development servers (embedded database, known passwords) and not a substitute.

Expand Down
14 changes: 14 additions & 0 deletions deploy/gitops/environments/functional-ci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ authenticator:
issuerUrl: 'http://{{ .Release.Name }}-fakeidp.{{ .Release.Namespace }}.svc.cluster.local:8084'
clientId: "insight-authenticator"
redirectUri: "http://localhost/auth/callback"
# fakeidp's `sub` claim IS the stable per-user id (see users.yaml) — no
# real connector backs it, but the persons-seed fixtures used in this
# environment key their `value_type='id'` rows on this made-up source_type.
sourceType: "fakeidp"

fakeidp:
deploy: true
Expand All @@ -58,3 +62,13 @@ analytics:

identityResolution:
deploy: true

# The authenticator's login-bootstrap resolve (GET /internal/persons/
# by-external-id / by-email-override) is Rust-only — the frozen .NET
# `identity` twin above never gained it (constructorfabric/insight#1960) — so
# identity-resolution must ALSO be deployed here, and the authenticator talks
# to it unconditionally (deploy/gitops/scripts/compose-app-secrets.sh enforces
# this at apply time regardless of what `.identityUrl` — analytics' own
# .NET<->Rust switch — is set to).
identityResolution:
deploy: true
Comment on lines 63 to +74

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win

Remove the duplicated identityResolution mapping.

identityResolution is declared twice: at Line 63 and again at Line 73. The new comment block was inserted before a second copy of the key instead of before the existing one. Strict YAML parsers reject duplicate mapping keys, and yamllint already fails on it. Keep one mapping with the comment above it.

🐛 Proposed fix
-identityResolution:
-  deploy: true
-
 # The authenticator's login-bootstrap resolve (GET /internal/persons/
 # by-external-id / by-email-override) is Rust-only — the frozen .NET
 # `identity` twin above never gained it (constructorfabric/insight#1960) — so
 # identity-resolution must ALSO be deployed here, and the authenticator talks
 # to it unconditionally (deploy/gitops/scripts/compose-app-secrets.sh enforces
 # this at apply time regardless of what `.identityUrl` — analytics' own
 # .NET<->Rust switch — is set to).
 identityResolution:
   deploy: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
identityResolution:
deploy: true
# The authenticator's login-bootstrap resolve (GET /internal/persons/
# by-external-id / by-email-override) is Rust-only — the frozen .NET
# `identity` twin above never gained it (constructorfabric/insight#1960) — so
# identity-resolution must ALSO be deployed here, and the authenticator talks
# to it unconditionally (deploy/gitops/scripts/compose-app-secrets.sh enforces
# this at apply time regardless of what `.identityUrl` — analytics' own
# .NET<->Rust switch — is set to).
identityResolution:
deploy: true
# The authenticator's login-bootstrap resolve (GET /internal/persons/
# by-external-id / by-email-override) is Rust-only — the frozen .NET
# `identity` twin above never gained it (constructorfabric/insight#1960) — so
# identity-resolution must ALSO be deployed here, and the authenticator talks
# to it unconditionally (deploy/gitops/scripts/compose-app-secrets.sh enforces
# this at apply time regardless of what `.identityUrl` — analytics' own
# .NET<->Rust switch — is set to).
identityResolution:
deploy: true
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 73-73: duplication of key "identityResolution" in mapping

(key-duplicates)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deploy/gitops/environments/functional-ci/values.yaml` around lines 63 - 74,
Remove the duplicate identityResolution mapping in the values configuration,
keeping a single deploy: true declaration. Preserve the explanatory comment by
placing it directly above the remaining identityResolution block.

Source: Linters/SAST tools

10 changes: 10 additions & 0 deletions deploy/gitops/environments/local/values.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ authenticator:
clientId: "insight-authenticator"
clientSecret: "insight-authenticator-dev-secret"
redirectUri: "http://localhost/auth/callback"
# The identity-resolution source_type this IdP is seeded under — required
# (constructorfabric/insight#1960): the login-bootstrap resolve
# (GET /internal/persons/by-external-id) is scoped to it, and it only
# exists on identity-resolution (Rust), never the .NET identity twin.
sourceType: "keycloak"
# id_token claim carrying the stable external user id for sourceType.
# gen-realm.py pins each realm user's `id` to their OWN roster uuid (see
# deploy/compose/keycloak/gen-realm.py), so Keycloak's `sub` (the default)
# already IS that stable id — no Entra-style non-default claim needed here.
externalIdClaim: "sub"
# Optional tenant sourcing: `tenantClaim` names the id_token claim carrying
# the single tenant (default `tenant_id` — fakeidp/Keycloak; Entra: `tid`);
# `defaultTenantId` is the fallback for a claim-less IdP (e.g. Okta),
Expand Down
Loading
Loading