feat: Add CRD guard, RBAC-aware actions, AppProject views, and enhanced Application detail#906
Open
Joshna907 wants to merge 8 commits into
Open
Conversation
4d69da2 to
d36362f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the Argo CD Headlamp plugin with safer visibility/UX behavior (CRD guard + RBAC-aware actions) and substantially richer UI surfaces for Argo CD resources (Application detail enhancements and new AppProject list/detail views).
Changes:
- Add CRD-based sidebar filtering and register new routes (Application detail + AppProject list/detail) with an offline Argo CD icon.
- Introduce shared operation hooks plus Kubernetes-native sync/refresh APIs (with snackbar feedback and unit tests).
- Extend ArgoApplication resource modeling (multi-source support, sync policy, managed resources, conditions) and render these in enhanced list/detail views.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| argocd/src/resources/appproject.ts | Adds an AppProject KubeObject wrapper with typed spec helpers for the new views. |
| argocd/src/resources/application.ts | Extends Application typing and adds getters for multi-source, sync policy, resources, and conditions. |
| argocd/src/index.tsx | Registers CRD sidebar guard, Argo icon, and new routes/sidebar entries. |
| argocd/src/index.test.tsx | Updates plugin registration tests/mocks for sidebar filter, routes, and icon registration. |
| argocd/src/hooks/useArgoOperation.ts | Adds reusable operation hooks used by list/detail actions (loading + snackbar). |
| argocd/src/components/appprojects/List.tsx | Introduces AppProject list view via ResourceListView. |
| argocd/src/components/appprojects/Detail.tsx | Introduces AppProject detail view with extra sections (repos/destinations/roles/whitelist). |
| argocd/src/components/applications/statusHelpers.ts | Centralizes health/sync status → StatusLabel severity mapping. |
| argocd/src/components/applications/List.tsx | Adds RBAC-aware sync/refresh actions and multi-source display in the list view. |
| argocd/src/components/applications/Detail.tsx | Adds Application detail route UI with actions plus managed resources/sync policy/conditions sections. |
| argocd/src/api/argoClient.ts | Implements Kubernetes-native sync/refresh via merge-patch to Application resources. |
| argocd/src/api/argoClient.test.ts | Adds unit tests for sync/refresh behavior and RBAC-friendly error handling. |
| argocd/README.md | Documents features, behavior differences vs Argo UI, and required RBAC permissions. |
| argocd/package.json | Bumps plugin version to 0.2.0. |
| argocd/package-lock.json | Updates lockfile metadata to match the new package name/version. |
Files not reviewed (1)
- argocd/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d36362f to
fcbc2a7
Compare
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
fcbc2a7 to
b229ebb
Compare
… and conditions Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
… sync policy Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
…iews Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
b229ebb to
309a482
Compare
…ests Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Contributor
Author
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
This PR adds a CRD detection guard, RBAC-aware Sync/Refresh buttons, enhanced Application detail sections, shared operation hooks, multi-source Application support, and AppProject list/detail views.
Why CRD Detection Guard?
On clusters where Argo CD is not installed, the sidebar entries should not appear. This follows the exact same pattern used by the Flux plugin — a module-level cache with a 30s TTL checks for
argoproj.ioCRDs viaK8s.ResourceClasses.CustomResourceDefinition.apiList(). If no CRDs are found, the sidebar children are hidden viaregisterSidebarEntryFilter.Why RBAC-aware buttons?
Previously, users without
patchpermission onapplications.argoproj.iowould see Sync/Refresh buttons but get 403 errors when clicking them. Now both buttons are wrapped with Headlamp'sAuthVisiblecomponent — they only render when the user haspatchpermission. This is the same approach used by the Volcano and Kyverno plugins.Changes
Added
src/hooks/useArgoOperation.ts— Shared operation hook with loading state and snackbar feedback.useArgoOperationfor the detail view (single loading state),useArgoOperationMapfor the list view (per-app loading state keyed bynamespace/name).src/resources/appproject.ts—ArgoAppProjectKubeObject class for the AppProject CRD with typed getters for destinations, source repos, roles, and cluster resource whitelist.src/components/appprojects/List.tsx— AppProject list view usingResourceListViewwith columns for description, source repos count, and destinations count.src/components/appprojects/Detail.tsx— AppProject detail view usingDetailsGridwith extra sections for Source Repositories, Destinations, Cluster Resource Whitelist, and Roles.src/components/applications/Detail.tsx— Application detail view with Managed Resources table, Sync Policy section, and Conditions table asextraSections.src/components/applications/statusHelpers.ts— Sync and health status toStatusLabelbadge mapping.src/api/argoClient.ts— Kubernetes-native sync (merge-patch.operation) and refresh (annotation patch) functions.src/api/argoClient.test.ts— Unit tests for sync and refresh API functions (8 tests).Changed
src/resources/application.ts— Extended withSourceSpec,ManagedResource,ArgoConditioninterfaces,syncPolicyfield, multi-source support (spec.sources[]), and convenience getters.src/index.tsx— Added CRD detection guard viaregisterSidebarEntryFilter, registered detail route, AppProject routes and sidebar entry, added official Argo CD logo icon viaaddIcon().src/components/applications/List.tsx— Replaced inline handlers withuseArgoOperationMaphook, wrapped action buttons withAuthVisible, shows "N sources" for multi-source apps.src/index.test.tsx— Updated mocks forregisterSidebarEntryFilter,Utils,K8s.ResourceClasses,AuthVisible,ConditionsTable. Added assertions for AppProject routes, sidebar entry, and CRD filter registration.README.md— Updated with new features and RBAC permissions documentation.Screenshots
Steps to Test