Add CRD detection guard and unit tests for Agones views#12
Open
NAME-ASHWANIYADAV wants to merge 3 commits into
Open
Add CRD detection guard and unit tests for Agones views#12NAME-ASHWANIYADAV wants to merge 3 commits into
NAME-ASHWANIYADAV wants to merge 3 commits into
Conversation
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
13b713b to
b33c7f0
Compare
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.
Type of change
What this PR does
This PR introduces a robust detection mechanism to verify if the Agones Custom Resource Definitions (CRDs) are installed on the active Kubernetes cluster before attempting to render Agones-specific UI views.
Key additions:
isAgonesInstalledutility: Queries the/apis/agones.dev/v1endpoint and explicitly validates that the response is a valid KubernetesAPIResourceList.useAgonesInstalledhook: A React hook to manage the asynchronous loading state.AgonesInstallCheckwrapper component: Intercepts routes and is designed to display a helpful banner if the API is missing.src/index.tsxare wrapped with this component.Screenshots / recordings
(I am currently facing a UI rendering issue locally. Attached are the screenshots showing
minikubevstest-no-agoneswhere the UI still renders the default view instead of the fallback banner).Test plan
Automated checks
npm cinpm run buildnpm run tscnpm run lintnpm run format -- --checknpm run testManual verification
minikube)test-no-agones)(See Notes for Reviewers regarding the local UI verification issue).
RBAC considerations
No additional RBAC permissions are required beyond what the plugin already needs.
Notes for reviewers
I have successfully implemented the logic, wrapped the components in
index.tsx, and all automated unit tests pass perfectly.However, when I test this locally on the Headlamp Desktop App (using my
test-no-agonescluster), I am facing a weird issue: TheisAgonesInstalledcheck should catch the missing API, but the UI still renders the defaultAgonesOverviewcomponent instead of myNotInstalledBanner(as seen in the second screenshot).I suspect this might be related to how
registerRoutehandles wrapped components in Headlamp, or perhaps UI caching in the Desktop app (though I have cleared the.pluginscache).I've opened this PR so you can review the code structure. Any pointers on why the route wrapper isn't displaying the fallback banner would be hugely appreciated!