[ocp4_workload_ols] Grant lightspeed-operator-query-access to non-admin users#19
Merged
[ocp4_workload_ols] Grant lightspeed-operator-query-access to non-admin users#19
Conversation
Automatically discover and grant lightspeed-operator-query-access to all non-admin users created by ocp4_workload_authentication. - htpasswd: parse the htpasswd secret in openshift-config to get the authoritative list of all configured usernames - keycloak: query the Keycloak REST API (master realm token → realm users endpoint) to get the live user list - Admin user is excluded from grants in both paths - ClusterRoleBinding created per user, idempotent via k8s state: present
… CR lookup Read users directly from the KeycloakRealmImport Kubernetes CR instead of authenticating to the Keycloak REST API. This avoids token management, URL construction issues, and Keycloak admin permission variability across RHBK versions.
wkulhanek
previously approved these changes
Feb 27, 2026
wkulhanek
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lightspeed-operator-query-accesshtpasswdandkeycloakauth providers with provider-specific discovery logicChanges
roles/ocp4_workload_ols/defaults/main.yamlAdded a new User Access Configuration section with 5 variables that mirror
ocp4_workload_authenticationdefaults:ocp4_workload_ols_auth_providerhtpasswdorkeycloakocp4_workload_ols_admin_usernameocp4_workload_ols_htpasswd_secret_nameopenshift-configocp4_workload_ols_keycloak_namespaceocp4_workload_ols_keycloak_realmsso)roles/ocp4_workload_ols/tasks/workload.yamlAdded tasks at the end of the workload to build a user list and grant
ClusterRoleBindingper user:openshift-config— captures all configured users (numbered users, cluster accounts, any naming convention) automaticallykeycloak-initial-adminsecret, then queries/admin/realms/{realm}/usersvia the REST APIClusterRoleBindingcreation is idempotent (state: present)no_log: true