From d8f526242d814b4563f86ec35ea56bde482bf1a9 Mon Sep 17 00:00:00 2001 From: yogananth subramanian Date: Mon, 1 Jul 2024 15:57:02 +0530 Subject: [PATCH] Enable RBAC Enable RBAC for 1.2 and 1.1. Patch introduces a new ENV variable ENABLE_RBAC to enable RBAC, by setting ENABLE_RBAC=true --- ci-scripts/rhdh-setup/create_resource.sh | 1 + ci-scripts/rhdh-setup/deploy.sh | 13 ++++ .../template/backstage/app-rbac-patch.yaml | 8 +++ .../backstage/helm/extravolume-patch-1.1.yaml | 61 +++++++++++++++++++ .../backstage/helm/extravolume-patch-1.2.yaml | 61 +++++++++++++++++++ .../backstage/helm/rbac-plugin-patch.yaml | 3 + .../template/backstage/rbac-config.yaml | 11 ++++ 7 files changed, 158 insertions(+) create mode 100644 ci-scripts/rhdh-setup/template/backstage/app-rbac-patch.yaml create mode 100644 ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.1.yaml create mode 100644 ci-scripts/rhdh-setup/template/backstage/helm/extravolume-patch-1.2.yaml create mode 100644 ci-scripts/rhdh-setup/template/backstage/helm/rbac-plugin-patch.yaml create mode 100644 ci-scripts/rhdh-setup/template/backstage/rbac-config.yaml diff --git a/ci-scripts/rhdh-setup/create_resource.sh b/ci-scripts/rhdh-setup/create_resource.sh index 6ae78ab..6d842ee 100755 --- a/ci-scripts/rhdh-setup/create_resource.sh +++ b/ci-scripts/rhdh-setup/create_resource.sh @@ -152,6 +152,7 @@ create_cmp() { create_group() { token=$(get_token) groupname="group${0}" + echo " g, group:default/${groupname}, role:default/perf_admin" >> "$TMP_DIR/group-rbac.yaml" curl -s -k --location --request POST "$(keycloak_url)/auth/admin/realms/backstage/groups" \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer '"$token" \ diff --git a/ci-scripts/rhdh-setup/deploy.sh b/ci-scripts/rhdh-setup/deploy.sh index 8c06b02..8a9f3b6 100755 --- a/ci-scripts/rhdh-setup/deploy.sh +++ b/ci-scripts/rhdh-setup/deploy.sh @@ -52,6 +52,7 @@ export API_COUNT="${API_COUNT:-1}" export COMPONENT_COUNT="${COMPONENT_COUNT:-1}" export KEYCLOAK_USER_PASS=${KEYCLOAK_USER_PASS:-$(mktemp -u XXXXXXXXXX)} export AUTH_PROVIDER="${AUTH_PROVIDER:-''}" +export ENABLE_RBAC="${ENABLE_RBAC:-false}" export INSTALL_METHOD=helm @@ -157,7 +158,11 @@ backstage_install() { if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '. |= . + {"signInPage":"oauth2Proxy"}' "$TMP_DIR/app-config.yaml"; fi if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '. |= . + {"auth":{"environment":"production","providers":{"oauth2Proxy":{}}}}' "$TMP_DIR/app-config.yaml"; else yq -i '. |= . + {"auth":{"providers":{"guest":{"dangerouslyAllowOutsideDevelopment":true}}}}' "$TMP_DIR/app-config.yaml"; fi until envsubst