Skip to content

fix: add mlflow client to Keycloak realm import, enable MLflow/Phoenix for Kind - #1243

Merged
pdettori merged 17 commits into
rossoctl:mainfrom
Ladas:fix/mlflow-otel-realm-client
Apr 20, 2026
Merged

pdettori merged 17 commits into
rossoctl:mainfrom
Ladas:fix/mlflow-otel-realm-client

Conversation

@Ladas

@Ladas Ladas commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add mlflow confidential client to Keycloak realm import JSON (both OpenShift CR and K8s ConfigMap paths) so the client exists from initial deployment
  • Strip mlflow-oauth-secret-job to read-only — reads existing client secret from Keycloak, no longer creates the client or manages groups/mappers
  • Enable MLflow and Phoenix components for Kind CI (dev_values.yaml)
  • Remove xfail and openshift_only markers from 9 MLflow trace tests

Problem

OTel collector → MLflow OTLP export fails with HTTP 401 because the mlflow OAuth2 client is created dynamically by a Helm hook job that fails when Keycloak admin credentials are stale (common on reinstall). On Kind, MLflow was disabled entirely.

Design

See docs/plans/2026-04-14-mlflow-otel-fix-design.md

Test plan

  • Kind CI passes with MLflow and Phoenix enabled (monitor memory)
  • MLflow trace tests pass (9 previously xfail tests)
  • Pre-commit hooks pass
  • OpenShift/HyperShift deployment still works with realm-imported client

🤖 Generated with Claude Code

@Ladas

Ladas commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: d1d996901f8fb1a77de15e5cf0f5c577f889d047
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 35bc880

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: d1d996901f8fb1a77de15e5cf0f5c577f889d047
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@Ladas

Ladas commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 1ffee11a813d7f10228b88fdf5cc9bf319666609
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 1ffee11a813d7f10228b88fdf5cc9bf319666609
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: b6d88b2

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@Ladas

Ladas commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: b6d88b22f96774ee8a6284dff7f1e4b831a5770a
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: b6d88b22f96774ee8a6284dff7f1e4b831a5770a
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 7c792ea

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@Ladas

Ladas commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 15, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 7c792eab35b79e6bfbd772eac6c860a177fdef69
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 7c792eab35b79e6bfbd772eac6c860a177fdef69
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 560bffe

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 15, 2026
@Ladas

Ladas commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 15, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 560bffe7404531e67acdbce2839397f6aadb33f1
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 560bffe7404531e67acdbce2839397f6aadb33f1
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 11c0e31

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@Ladas

Ladas commented Apr 20, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 20, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 11c0e31bd70f00af9ba9578440847d6df9e970e4
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Passed

Commit: 11c0e31bd70f00af9ba9578440847d6df9e970e4
Result: All tests passed
Workflow Run: View logs

The safe-to-test label indicates this commit has been approved for E2E testing.


If you push new commits, the label will be removed and you'll need to comment /run-e2e again.

Ladas added 17 commits April 20, 2026 15:51
…enix for Kind

The OTel→MLflow trace pipeline fails with HTTP 401 because the mlflow
OAuth2 client is created dynamically by a Helm hook job that breaks when
Keycloak admin credentials are stale.  Fix by declaring the mlflow
confidential client in the Keycloak realm import JSON so it exists from
initial deployment.

- Add mlflow client to realm import (both OpenShift CR and K8s ConfigMap)
- Strip mlflow-oauth-secret-job to read-only (no client creation logic)
- Enable MLflow and Phoenix components for Kind CI
- Remove xfail/openshift_only markers from 9 MLflow trace tests

Design: docs/plans/2026-04-14-mlflow-otel-fix-design.md

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
MLflow v3.9.0 defaults max_results to 0 which is invalid (must be a
positive integer). The two connectivity tests that call this endpoint
without params now get HTTP 400 on Kind where auth is disabled.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The mlflow_configured fixture called pytest.fail() when no OAuth token
was available. On Kind, mlflow.auth.enabled=false so no mlflow-oauth-secret
exists and no token is needed. Allow the fixture to proceed without a
token for the non-auth path.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
get_mlflow_client() raised ValueError when no token was set, which
broke all 28 MLflow trace tests on Kind where auth is disabled. The
token check is unnecessary — when auth is off, MLflow accepts
unauthenticated requests. Token refresh still works when credentials
are available (OpenShift path).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
On OpenShift, the KeycloakRealmImport CR (hook weight 2) is processed
asynchronously by the RHBK operator. The mlflow-oauth-secret-job
(hook weight 10) may start before the realm import finishes creating
the mlflow client. Add polling with 120s timeout to wait for the
client to appear.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The mlflow-oauth-secret-job uses a pre-built container image that
doesn't include PR code changes. Add a CI build step (matching the
existing ui-oauth-secret pattern) to all 4 E2E workflows. The script
skips when mlflow.auth.enabled=false (Kind without auth).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The e2e-hypershift-pr workflow uses issue_comment trigger which reads
the workflow YAML from main, not the PR branch. The new workflow step
won't run until merged. Work around by calling the mlflow script from
the existing 25-build-oauth-secret-image.sh which IS checked out from
the PR branch.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The mlflow-oauth-secret-job is a Helm hook (post-install,post-upgrade),
so `helm upgrade --no-hooks` skips creating it entirely. Fix by
rendering the job template with `helm template --show-only` and
applying it directly with `kubectl apply`. This correctly handles
the Helm hook lifecycle while using the freshly-built PR image.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The job name in the Helm template is 'mlflow-oauth-secret-job' (hardcoded,
no release name prefix), but the CI script waited for
'kagenti-mlflow-oauth-secret-job'. Fix to match the actual template name.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
mlflow-oidc-auth v7+ adds a FastAPI permission middleware that checks
experiment UPDATE permission for the OTel trace endpoint. The existing
patch only bypassed the OIDC auth middleware (_is_unprotected_route)
but the permission middleware still rejected requests because no
username was set. Add a second patch to skip _find_fastapi_validator
for /v1/traces paths.

Also remove the otel_router get_all_routers() patch since v7+ includes
the OTel router natively.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The experiment INSERT and users INSERT were in the same transaction.
The users table is created by mlflow-oidc-auth alembic migrations which
run slower than MLflow core migrations. When users table doesn't exist
yet, the whole transaction rolls back — including the experiment INSERT.
Split into two independent phases so the experiment is committed before
attempting users.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
test_traces_filter_by_session_id tried to match a UUID generated in
Phase 1 (agent tests) with Phase 2 (observability tests), but these
are separate pytest invocations with independent session IDs. The test
always skipped. Session correlation is already covered by
test_traces_have_genai_conversation_id which asserts the attribute
exists without requiring cross-phase UUID sharing.

Also removes the unused get_traces_by_session_id helper.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
- Tighten redirectUris from ["*"] to ["*/callback"] in realm import
- Add startup assertions for monkey-patched mlflow-oidc-auth APIs
  (fail fast on upgrades that change internal method names)
- Fix stale comment in dev_values.yaml
- Document generate_client_secrets write in read-only job

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Adding MLflow + Phoenix + Kuadrant (upstream rossoctl#1262) exceeds the Kind
CI runner's CPU capacity. Keep MLflow (the focus of this PR) and
disable Phoenix to stay within resource limits. Phoenix can be
re-enabled when CI runner resources are increased.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Kuadrant operator + Authorino (merged upstream rossoctl#1262) consumes too
much CPU on Kind CI runners. Disable for Kind — Kuadrant AuthPolicy
is OpenShift-specific and not needed for local development/testing.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Kuadrant operator defaults consume 860m CPU across 5 deployments,
which exceeds the 4-vCPU Kind CI runner when combined with MLflow.
Patch Kuadrant deployments after installation to reduce CPU requests
from 860m to 150m, leaving room for agent pods. Only applies on Kind
(non-OpenShift) where kuadrant-system namespace exists.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas
Ladas force-pushed the fix/mlflow-otel-realm-client branch from 11c0e31 to 6c0a8a1 Compare April 20, 2026 13:52
@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 20, 2026
@github-actions

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: 6c0a8a1

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@pdettori
pdettori merged commit 0b98d5c into rossoctl:main Apr 20, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants