Skip to content

Conversation

@Cali0707
Copy link

This PR adds the code changes required to get the keycloak token exchange to work, as well as fixes the cluster keycloak config to work correctly

To use this you will need two openshift clusters, and then follow these steps:

  1. Run make acm-install with your current context set to the cluster that will be your hub cluster
  2. Run make keycloak-acm-setup-hub - this will take 20-30min as it needs to restart the api server
  3. Create a kubeconfig that will connect to what will be your managed cluster
  4. Run make keycloak-acm-register-managed-cluster CLUSTER_NAME=<your-choice-of-name> MANAGED_KUBECONFIG=<path-to-managed-kubeconfig>
  5. Run make keycloak-acm-generate-toml
  6. Run make build
  7. Run ./kubernetes-mcp-server --port 8080 --config _output/acm-kubeconfig.toml

Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2025
Signed-off-by: Calum Murray <cmurray@redhat.com>
…ecureskiptlsverify

Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2025
@openshift-merge-robot
Copy link

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Cali0707
Copy link
Author

/hold

Will upstream as much as possible first, resync, then revisit this

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 11, 2025
Copy link

@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

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

First set of comments

@echo " 2. Apply ACM import manifests (starts cluster-proxy agents)"
@echo " 3. Create managed cluster realm in Keycloak"
@echo " 4. Configure cross-realm token exchange"
@echo " 5. Enable TechPreviewNoUpgrade on managed cluster"

Choose a reason for hiding this comment

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

External Authentication is now GA on OpenShift 4.20. It is very important that this feature set is only enabled on versions that truely require it. Recommend a check that determines if it is currently installed or not

oc get featuregate cluster -o json | jq -r '.status.featureGates[0].enabled[] | select(.name == "ExternalOIDC") | length > 0'

echo ""
echo "Adding scopes to mcp-server client..."
curl -sk -X PUT "$KEYCLOAK_URL/admin/realms/$HUB_REALM/clients/$CLIENT_UUID/default-client-scopes/$OPENID_SCOPE_UUID" \
-H "Authorization: Bearer $ADMIN_TOKEN" > /dev/null 2>&1

Choose a reason for hiding this comment

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

While not specific to this file, just a heads up that there is no need to explicitly install MCE. It is installed automatically when ACM is installed.

@echo " 3. Create managed cluster realm in Keycloak"
@echo " 4. Configure cross-realm token exchange"
@echo " 5. Enable TechPreviewNoUpgrade on managed cluster"
@echo " 6. Configure OIDC authentication"

Choose a reason for hiding this comment

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

My cluster became inaccessible after attempting to enable external OIDC. I see some challenges in the current implementation as it does not properly set the client ID's for either the console or the CLI as well as the secret associated with the console client

labels:
app: keycloak
spec:
containers:

Choose a reason for hiding this comment

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

Is there a reason why we are not using the Red Hat Build of Keycloak Operator instead? We do still need to manage PostgreSQL as well as some of the ingress concerns. I can share some examples if it would be desired

Copy link
Author

Choose a reason for hiding this comment

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

I'm not fully sure - I think Matthias added this originally. My understanding is that since this is a dev env setup only, the simpler deployment was used here as we didn't need all of the production ready setup for the keycloak instance.

Do you think we should switch to the Red Hat Build of Keycloak Operator here?

Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Dec 15, 2025

@Cali0707: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images be5a5aa link true /test images
ci/prow/lint be5a5aa link true /test lint
ci/prow/test be5a5aa link true /test test
ci/prow/security be5a5aa link false /test security
ci/prow/fips-image-scan-openshift-mcp-server be5a5aa link true /test fips-image-scan-openshift-mcp-server

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants