From ac4f261951bd751a52ec6e824838f09e79e76934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Mac=C3=ADk?= Date: Tue, 1 Oct 2024 13:16:28 +0200 Subject: [PATCH] fix(RHIDP-3670): Reduce user and group name sizes to support bigger RBAC policies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel MacĂ­k --- ci-scripts/rhdh-setup/create_resource.sh | 10 +++++----- ci-scripts/rhdh-setup/deploy.sh | 5 +++-- .../template/backstage/app-rbac-patch.yaml | 4 ++-- .../template/backstage/helm/app-rbac-patch.yaml | 2 +- .../template/backstage/olm/app-rbac-patch.yaml | 2 +- .../template/backstage/rbac-config.yaml | 13 +++++++------ .../rhdh-setup/template/component/api.template | 2 +- .../template/component/component.template | 2 +- .../template/keycloak/keycloakUser.yaml | 16 ++++++++++------ 9 files changed, 31 insertions(+), 25 deletions(-) diff --git a/ci-scripts/rhdh-setup/create_resource.sh b/ci-scripts/rhdh-setup/create_resource.sh index 69eca9d..76c234c 100755 --- a/ci-scripts/rhdh-setup/create_resource.sh +++ b/ci-scripts/rhdh-setup/create_resource.sh @@ -168,7 +168,7 @@ create_group() { attempt=1 while ((attempt <= max_attempts)); do token=$(get_token) - groupname="group${0}" + groupname="g${0}" response="$(curl -s -k --location --request POST "$(keycloak_url)/auth/admin/realms/backstage/groups" \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer '"$token" \ @@ -189,7 +189,7 @@ create_group() { create_groups() { log_info "Creating Groups in Keycloak" for i in $(seq 1 "$GROUP_COUNT"); do - echo " g, group:default/group${i}, role:default/perf_admin" >>"$TMP_DIR/group-rbac.yaml" + echo " g, group:default/g${i}, role:default/a" >>"$TMP_DIR/group-rbac.yaml" done sleep 5 seq 1 "${GROUP_COUNT}" | xargs -n1 -P"${POPULATION_CONCURRENCY}" bash -c 'create_group' @@ -202,8 +202,8 @@ create_user() { token=$(get_token) grp=$(echo "${0}%${GROUP_COUNT}" | bc) [[ $grp -eq 0 ]] && grp=${GROUP_COUNT} - username="test${0}" - groupname="group${grp}" + username="t${0}" + groupname="g${grp}" response="$(curl -s -k --location --request POST "$(keycloak_url)/auth/admin/realms/backstage/users" \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer '"$token" \ @@ -264,7 +264,7 @@ keycloak_token() { rhdh_token() { REDIRECT_URL="$(backstage_url)/oauth2/callback" REFRESH_URL="$(backstage_url)/api/auth/oauth2Proxy/refresh" - USERNAME="test1" + USERNAME="guru" PASSWORD=$(oc -n "${RHDH_NAMESPACE}" get secret perf-test-secrets -o template --template='{{.data.keycloak_user_pass}}' | base64 -d) REALM="backstage" CLIENTID="backstage" diff --git a/ci-scripts/rhdh-setup/deploy.sh b/ci-scripts/rhdh-setup/deploy.sh index 9b76fa0..47532b7 100755 --- a/ci-scripts/rhdh-setup/deploy.sh +++ b/ci-scripts/rhdh-setup/deploy.sh @@ -186,7 +186,8 @@ keycloak_install() { fi fi envsubst