feat: add the ability to deploy plugin integrations#30
Open
PatAKnight wants to merge 1 commit intoredhat-developer:mainfrom
Open
feat: add the ability to deploy plugin integrations#30PatAKnight wants to merge 1 commit intoredhat-developer:mainfrom
PatAKnight wants to merge 1 commit intoredhat-developer:mainfrom
Conversation
Signed-off-by: Patrick Knight <pknight@redhat.com>
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.
PR Change Summary
This document summarizes all changes made in this PR, grouped by concern. Each section links to the relevant files and explains the motivation behind the change.
Overview
This PR introduces a plugin-aware deployment system for RHDH test instances. The core goals are:
rhdh-secretsis seeded early and patched incrementally by each plugin as it runsteardown.shwith plugin-aware cleanup at the right granularity1. Centralized URL Resolution
Files:
deploy.sh,helm/deploy.sh,operator/deploy.shPreviously,
CLUSTER_ROUTER_BASE,RHDH_PROTOCOL, andRHDH_BASE_URLwere each calculated independently in bothhelm/deploy.shandoperator/deploy.sh, with slightly different logic. This caused inconsistencies and meant plugin scripts (which run before the method-specific deploy scripts) never had access toRHDH_BASE_URL.The calculation was moved into
deploy.shbeforesetup_resourcesruns, and the result isexported. Both sub-scripts now rely on the exported value.2. Secrets Management
Files:
scripts/setup-resources.sh,scripts/plugins/config-keycloak-plugin.sh,scripts/plugins/config-lighthouse-plugin.sh,config/rhdh-secrets.yamlrhdh-secretsis created in two phases so that each plugin only needs to know about its own keys:Phase 1 —
setup-resources.shcreates the Secret idempotently usingoc create --dry-run=client | oc apply. At this point onlyRHDH_BASE_URLis known; all Keycloak and Lighthouse keys are seeded as empty strings.Phase 2 — Plugin scripts patch only their own keys into the existing Secret using
oc patch secret rhdh-secrets --type=merge. This avoids one plugin clobbering keys written by another:config-keycloak-plugin.shpatchesKEYCLOAK_BASE_URL,KEYCLOAK_METADATA_URL,KEYCLOAK_CLIENT_ID,KEYCLOAK_CLIENT_SECRET,KEYCLOAK_REALM,KEYCLOAK_LOGIN_REALMconfig-lighthouse-plugin.shpatchesLIGHTHOUSE_URL(set to the RHDH backend proxy path) andLIGHTHOUSE_SVC_URL(set to the in-cluster service URL used as the proxy target)config/rhdh-secrets.yamlserves as a reference template showing all expected keys — it is not applied directly.3. Keycloak Credential Surfacing
File:
scripts/plugins/config-keycloak-plugin.shTest users are provisioned with a single randomly generated password at runtime. Previously this password was only printed to stdout during standalone execution and was otherwise lost. Now it is stored in a dedicated cluster Secret:
Secret keys:
KEYCLOAK_URLKEYCLOAK_USERNAMESusers.jsonat runtime — not hardcoded)KEYCLOAK_USER_PASSWORDAdmin credentials are stored by the Bitnami Helm chart in
keycloak-keycloak(a standard Bitnami-managed Secret).The
keycloak-test-credentialsSecret is deleted during teardown.4. Idempotent Re-Runs
File:
helm/deploy.shhelm installwas replaced withhelm upgrade --install. This allows re-running the deploy script with a different plugin configuration (or after a failed run) without needing to tear everything down first.All
ocoperations that create resources already use--dry-run=client -o yaml | oc apply -f -oroc apply -f -, making them safe to re-run.5. Teardown
Files:
teardown.sh(new),MakefileA dedicated
teardown.shscript was created to orchestrate full or partial cleanup. It mirrorsdeploy.sh's argument structure and runs cleanup in the correct order:helm uninstalloroc delete backstage)app-config-rhdh,dynamic-plugins)scripts/setup-resources.sh teardown_resources(catalog ConfigMaps, RBAC, image streams,rhdh-secrets)A
--cleanflag was added toteardown.shto support full namespace deletion after the standard teardown steps complete. This is the recommended approach when you are done with a test instance entirely, as pre-deleting resources (Helm releases, StatefulSets, PVCs) before namespace deletion significantly reduces the time OpenShift spends in theTerminatingstate.PVCs created by StatefulSets are intentionally not deleted by Helm uninstall (Kubernetes default behavior). The teardown scripts now delete them explicitly to prevent conflicts on re-deploy:
data-redhat-developer-hub-postgresql-0— deleted inteardown.shafter RHDH Helm uninstalldata-keycloak-postgresql-0— deleted inuninstall_keycloak()after Keycloak Helm uninstallThe
Makefilewas updated with new targets:make undeploy-helmmake undeploy-operatormake undeploy-helm PLUGINS=keycloak,lighthousemake undeploy-plugins PLUGINS=keycloakmake clean6. Default Guest Authentication
Files:
config/app-config-rhdh.yaml,resources/catalog-entities/users.yaml,resources/keycloak/dynamic-plugins.yamlPreviously RHDH was configured with OIDC (Keycloak) as the only sign-in provider, meaning Keycloak had to be running for any login to work.
The base configuration now uses the Backstage
guestprovider viadangerouslyAllowOutsideDevelopment: true, allowing immediate sign-in without any plugin dependencies. Auser:default/guestentity is pre-registered in the catalog via the newusers-config-map.When
--plugins keycloakis used, thepluginConfigblock insideresources/keycloak/dynamic-plugins.yamloverridesauth.providersandsignInPageto switch the portal to OIDC — without requiring a separateapp-config-keycloakConfigMap.7. Shared Catalog Entity ConfigMaps
Files:
resources/catalog-entities/,scripts/setup-resources.sh,helm/value_file.yaml,operator/subscription.yamlFive catalog entity ConfigMaps are now applied unconditionally by
setup-resources.sh:users-config-mapuser:default/guestentityoperators-config-mapplugins-config-mapcomponents-config-mapresources-config-mapBoth
helm/value_file.yamlandoperator/subscription.yamlwere updated to mount all five ConfigMaps as a projected volume at/opt/app-root/src/catalog-entities, which maps to the catalog location paths inapp-config-rhdh.yaml.8. Restructured Plugin Resources
Files:
resources/keycloak/,resources/lighthouse/,resources/image-stream-imports/,resources/rhdh-script-examples/Plugin-specific resources were moved from
utils/keycloak/into a structuredresources/directory:utils/keycloak/keycloak-values.yamlresources/keycloak/keycloak-values.yamlutils/keycloak/rhdh-client.jsonresources/keycloak/rhdh-client.jsonutils/keycloak/users.jsonresources/keycloak/users.json(expanded to 50 users)utils/keycloak/groups.jsonresources/keycloak/groups.jsonresources/keycloak/dynamic-plugins.yamlresources/lighthouse/dynamic-plugins.yamlresources/lighthouse/lighthouse-deployment.yamlresources/lighthouse/lighthouse-scan-job.yamlresources/image-stream-imports/lighthouse-import.yamlresources/rhdh-script-examples/backstage-test.yamlutils/keycloak/keycloak-deploy.sh,utils/keycloak/users.json, andutils/keycloak/groups.jsonare deleted — this logic is now handled byscripts/plugins/config-keycloak-plugin.sh.9. New Scripts
scripts/setup-resources.shscripts/config-plugins.shscripts/plugins/config-keycloak-plugin.shscripts/plugins/config-lighthouse-plugin.shteardown.shdeploy.shargument structure10. Lighthouse Backend Proxy
Files:
config/app-config-rhdh.yaml,resources/lighthouse/dynamic-plugins.yaml,scripts/plugins/config-lighthouse-plugin.shThe Lighthouse frontend plugin makes direct browser requests to the Lighthouse audit service API. Pointing it at an OpenShift Route with a self-signed cluster cert causes
ERR_CERT_AUTHORITY_INVALIDin the browser.To avoid this, Lighthouse traffic is routed through RHDH's built-in backend proxy. The browser only ever communicates with RHDH (which has a valid cert), and RHDH forwards requests to the Lighthouse service over plain HTTP on the cluster-internal network.
Two URL values are now managed separately:
LIGHTHOUSE_SVC_URLhttp://lighthouse.<namespace>.svc.cluster.local:3003LIGHTHOUSE_URL${RHDH_BASE_URL}/api/proxy/lighthousebaseUrl— what the frontend plugin calls; routes through RHDHThe proxy endpoint is configured in
app-config-rhdh.yaml:Files Changed at a Glance
deploy.sh--pluginsarghelm/deploy.shhelm upgrade --install; removed duplicate URL calc and envsubstoperator/deploy.shMakefileundeploy-plugins,PLUGINSvar; updated all cleanup targetsREADME.mdconfig/app-config-rhdh.yamlconfig/rhdh-secrets.yamlconfig/dynamic-plugins.yamlhelm/value_file.yamloperator/subscription.yamlextraFilesfor all catalog ConfigMaps and RBAC policyconfig/rbac-policies.yamlteardown.shscripts/setup-resources.shscripts/config-plugins.shscripts/plugins/config-keycloak-plugin.shscripts/plugins/config-lighthouse-plugin.shresources/catalog-entities/users.yamlresources/catalog-entities/components.yamlresources/catalog-entities/operators.yamlresources/catalog-entities/plugins.yamlresources/catalog-entities/resources.yamlresources/keycloak/dynamic-plugins.yamlresources/keycloak/users.jsonresources/keycloak/groups.jsonutils/keycloak/keycloak-values.yaml→resources/keycloak/keycloak-values.yamlutils/keycloak/rhdh-client.json→resources/keycloak/rhdh-client.jsonresources/lighthouse/dynamic-plugins.yamlresources/lighthouse/lighthouse-deployment.yamlresources/lighthouse/lighthouse-scan-job.yamlresources/image-stream-imports/lighthouse-import.yamlresources/rhdh-script-examples/backstage-test.yamlutils/keycloak/keycloak-deploy.shscripts/plugins/config-keycloak-plugin.shutils/keycloak/users.jsonresources/keycloak/utils/keycloak/groups.jsonresources/keycloak/