Skip to content

feat(kubernetes): laptop-client docs, security chart settings and the notebook operator - #38

Open
KFilippopolitis wants to merge 12 commits into
masterfrom
feat/k8s-security-and-notebook-operator
Open

KFilippopolitis wants to merge 12 commits into
masterfrom
feat/k8s-security-and-notebook-operator

Conversation

@KFilippopolitis

Copy link
Copy Markdown
Contributor

Supersedes #36 (closed unmerged; its chart settings are all contained here).

Summary

Kubernetes chart and docs (deployment/kubernetes)

  • Pass EXAFLOW_API_TOKEN (optional secret), KEYCLOAK_REQUIRED_AUDIENCE, KEYCLOAK_CLI_CLIENT_ID and KEYCLOAK_ORIGIN to the backend/UI; keycloak.cliClientId and keycloak.requiredAudience are new values, empty by default.
  • Security rollout order for each federation in the README (per-federation platform client, backchannel logout, notebook NetworkPolicy via mip-infra, Exaflow API token, requiredAudience with token decode checks; laptop sign-in stays off until the audience is set).
  • Laptop-client setup text tightened: PKCE S256 enforced, implicit/direct-grant/service-accounts off, Full scope allowed off with data roles (or a composite) in the dedicated scope plus the new-dataset-role rule, offline session idle 30 days, EBRAINS flow-override and consent request.
  • Turn-on checklist next to cliClientId (README and values.yaml comment) and a new Ending a laptop sign-in runbook section (user/admin/lost-laptop revocation).

Notebook operator (operator/)

  • The notebook operator moved here from mip-jupyter, with the operator-api JupyterHub spawner (no Kubernetes credentials on the hub), CI tests/scan/publish workflows, and fixes for keeping notebooks running on profile loss, pod-ownership checks, and scan gates failing open.

Tests

  • helm lint . and helm template with keycloak.cliClientId/keycloak.requiredAudience set; template renders with the security settings on and off.
  • Operator Go tests and CI workflows run on push (see the checks).

Not applied to a real cluster, and nothing has run against the EBRAINS realm. The README leaves two placeholders: the EBRAINS admin contact for the runbook and the minimum platform-ui prompt=login version.

Rollback

Revert the PR; all new chart values default to empty/off.

…sers' own computers

keycloak.cliClientId (empty by default, which keeps the feature off) names the
public Keycloak client the mip Python client and the portal's token page use.
Wire it through the chart, the dev compose stack, and document the per-federation
Keycloak client setup in the README.
jupyterhub.spawner: operator-api renders the same NotebookProfile as operator,
but the hub calls the notebook operator's HTTPS spawn API (jupyterhub.operatorApi)
instead of the Kubernetes API. The hub pod gets no ServiceAccount token at the
standard path, only a projected token bound to audience mip-notebook-operator
plus its CA, and the chart renders no Role or RoleBinding whatever rbac.create
says. The operator-mode Role drops list and watch on notebooks. Rendering fails
on an unknown spawner.
Source is mip-jupyter master at 1665367; its history stays there. The chart
already ships the NotebookProfile, so the CRD and the template now change in
one PR and share one version. The Go module becomes
github.com/Medical-Informatics-Platform/mip/operator.

The spawn API RBAC and the token Secret policy move to operator/testdata: they
are test fixtures, deployed from mip-infra. The policy fixture now follows the
one staging deploys (name binding to the owner's UID, jupyter-* owners only)
and still admits the hub while production runs operator mode. Controller tests
use federation-* namespaces, as the policy expects.
Ported from mip-jupyter and limited to operator/: envtest and image build, image
scan, SCA, SAST, gitleaks, publish on release (Docker Hub and Harbor), and a
manual sha-<commit> preview build for staging. The per-federation staging-b and
staging-c builds are not ported: there is one operator per cluster.
Replaces the manual preview build. Every operator change on master now publishes
dev and sha-<commit> to Docker Hub; a MIP release still publishes the versioned
image.
Pass EXAFLOW_API_TOKEN from an optional secret and KEYCLOAK_REQUIRED_AUDIENCE to the backend, and KEYCLOAK_ORIGIN to platform-ui for its CSP. KEYCLOAK_ORIGIN is omitted when keycloak.host is empty, so the image default applies.
… runbook and the turn-on gate

- Full scope allowed off, with the platform client's data roles (or one
  composite role) in the laptop client's dedicated scope, and the rule to
  add new dataset roles there.
- PKCE S256 enforced; implicit flow, direct access grants and service
  accounts off; Client Offline Session Idle 30 days next to Max 180 days.
- Ask EBRAINS for the flow override without the Cookie execution and for
  Consent required.
- New 'Ending a laptop sign-in' runbook: user, admin and lost-laptop
  revocation steps, with a placeholder for the EBRAINS admin contact.
- Turn-on checklist next to cliClientId in the README, and a values.yaml
  comment pointing at it; step 6 of the rollout order now states that
  laptop sign-in stays off until requiredAudience is set, with the
  laptop-token decode checks (azp, aud, typ).
…okens

Passes KEYCLOAK_CLI_REQUIRE_DPOP to the backend, defaulting to false, for
platform-backend PR #53. Turns on only together with DPoP on the laptop
client in Keycloak and a DPoP-capable mip-client.
After revocation an already-issued access token still works for up to
5 minutes, instead of the backwards 'once renewal fails' phrasing.
KEYCLOAK_REQUIRED_AUDIENCE and KEYCLOAK_CLI_REQUIRE_DPOP on the backend
and KEYCLOAK_ORIGIN on the UI, matching the chart so local testing of
the laptop-sign-in checklist has the same shape as Kubernetes.
@KFilippopolitis
KFilippopolitis force-pushed the feat/k8s-security-and-notebook-operator branch from 6639f4b to b88ba92 Compare November 9, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants