feat: implement all quota features - #17
Merged
Merged
Conversation
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
There was a problem hiding this comment.
Pull request overview
This PR expands the Capsule Headlamp plugin to cover the full “quota” surface area (resource pools, global resource quotas, custom quotas), adds richer Capsule CR navigation/detail experiences (canonical CR routes, docs actions, conditions/events layout), and improves the in-cluster development workflow and alignment of list/detail pages.
Changes:
- Adds/extends Capsule CR models (Tenant, TenantOwner, ResourcePool/Claim, GlobalResourceQuota, CapsuleConfiguration) plus route helpers for canonical CustomResource URLs.
- Implements shared quota aggregation + flow visualizations and integrates quota systems into Tenant/Namespace experiences.
- Introduces dev tooling/docs (Makefile targets, pinned Node versions, in-cluster Headlamp chart values) and standardizes summary card layouts.
Reviewed changes
Copilot reviewed 127 out of 129 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Suppresses TypeScript deprecation warnings up to TS 6.0. |
| src/utils/tenantMeta.ts | Updates doc comment wording for Tenant metadata parsing. |
| src/resources/tenants.ts | Extends Tenant spec/status typing (cordon/quota/promotion-related fields). |
| src/resources/tenantResources.ts | Adds cordon + dependency typing; re-exports new helper APIs/types. |
| src/resources/tenantResources.test.ts | Adds tests for new replication helper behaviors. |
| src/resources/tenantOwners.ts | Adds TenantOwner CR model/types. |
| src/resources/resourcePools.ts | Adds ResourcePool + ResourcePoolClaim CR models/types. |
| src/resources/globalResourceQuotas.ts | Adds GlobalResourceQuota CR model/types. |
| src/resources/capsuleCustomResources.ts | Adds canonical Capsule CRD constants + route helpers. |
| src/resources/capsuleCustomResources.test.ts | Tests canonical CRD route helpers. |
| src/resources/capsuleConfigurations.ts | Adds CapsuleConfiguration CR model/types. |
| src/components/tenants/tenantStatusHelpers.ts | Adds helpers for promotions + namespace quota display. |
| src/components/tenants/tenantStatusHelpers.test.ts | Tests Tenant status helper behavior. |
| src/components/tenants/tenantQuotaOverviewHelpers.ts | Builds Tenant quota systems/resources/usage rows from labeled quota objects. |
| src/components/tenants/tenantQuotaOverview.test.ts | Tests Tenant quota overview helpers and flow graph behaviors. |
| src/components/tenants/TenantNamespaceFlow.test.ts | Adds flow-graph tests for Tenant owners/namespaces rendering. |
| src/components/tenants/TenantList.tsx | Switches to canonical Capsule CR links; aligns summary cards with SummaryCardGrid; removes Owners column. |
| src/components/tenants/tenantContext.ts | Adds storage parsing + context resolution for selected Tenants. |
| src/components/tenants/tenantContext.test.ts | Tests tenant context selection parsing and context ordering. |
| src/components/tenants/TenantBox.tsx | Updates comment about selection-change event consumers. |
| src/components/tenants/ServiceAccountPromotionAction.tsx | Adds ServiceAccount promotion/revocation header action with gates + optimistic UI. |
| src/components/tenants/serviceAccountPromotion.ts | Adds promotion label logic + patch request builder + object replacement helper. |
| src/components/tenants/serviceAccountPromotion.test.ts | Tests promotion request building and replacement logic. |
| src/components/tenant-resources/TenantResourceList.tsx | Adds cordon action, dependencies column, Ready/Message columns; switches to canonical links. |
| src/components/tenant-resources/GlobalTenantResourceList.tsx | Adds cordon action, dependencies column, Ready/Message columns; switches to canonical links. |
| src/components/tenant-owners/tenantOwnerReferences.ts | Adds TenantOwner identity parsing + referenced Tenant union logic. |
| src/components/tenant-owners/tenantOwnerReferences.test.ts | Tests TenantOwner identity + tenant reference union logic. |
| src/components/tenant-owners/TenantOwnerFlow.test.ts | Adds flow-graph tests for TenantOwner references. |
| src/components/tenant-owners/TenantOwnerDetail.tsx | Adds TenantOwner rich detail page: Conditions/Events + flow + references table. |
| src/components/settings/CapsuleSettings.tsx | Adds plugin settings UI for documentation base URL. |
| src/components/quotas/ResourcePoolClaimReleaseAction.tsx | Adds UI action to request ResourcePoolClaim release when eligible. |
| src/components/quotas/resourcePoolClaimRelease.ts | Adds release eligibility + patch request builder + object replacement helper. |
| src/components/quotas/resourcePoolClaimRelease.test.ts | Tests claim release eligibility and patch request building. |
| src/components/quotas/resourcePoolClaimGraph.ts | Builds ResourcePoolClaim → ResourcePool graph nodes/edges. |
| src/components/quotas/ResourcePoolClaimFlow.tsx | Renders ResourcePoolClaim relationship flow with custom node types. |
| src/components/quotas/ResourcePoolClaimFlow.test.ts | Tests ResourcePoolClaim relationship graph centering and edge/linking. |
| src/components/quotas/ResourcePoolClaimDetail.tsx | Adds rich ResourcePoolClaim detail page with conditions/events + relationship + requested allocation table. |
| src/components/quotas/globalResourceQuotaHelpers.test.ts | Adds tests for GRQ aggregation/namespace linking/summaries. |
| src/components/quotas/GlobalResourceQuotaFlow.tsx | Adds GRQ flow builder + component wrapper around shared quota flow. |
| src/components/quotas/GlobalResourceQuotaFlow.test.ts | Tests GRQ quota→namespace graph behavior and pointer interactions. |
| src/components/quotas/GlobalResourceQuotaDetail.tsx | Adds rich GRQ detail page: Conditions/Events + aggregation + configuration display. |
| src/components/quotas/GlobalCustomQuotaList.tsx | Adds namespaces-in-scope stats; aligns summary cards; switches to canonical links. |
| src/components/quotas/GlobalCustomQuotaDetail.tsx | Moves detail layout into DetailsGrid children; uses Conditions/Events + shared aggregation view. |
| src/components/quotas/CustomQuotaList.tsx | Adds namespaces-in-scope stats; aligns summary cards; switches to canonical links. |
| src/components/quotas/CustomQuotaDetail.tsx | Moves detail layout into DetailsGrid children; uses Conditions/Events + shared aggregation view. |
| src/components/quotas/customQuotaAggregationHelpers.ts | Adds shared CustomQuota/GlobalCustomQuota aggregation + quantity formatting helpers. |
| src/components/quotas/customQuotaAggregationHelpers.test.ts | Tests custom quota aggregation, claim summing, and unit-preserving formatting. |
| src/components/overview/overviewStats.ts | Adds shared overview stats helpers for readiness/quota health/resource pools. |
| src/components/overview/overviewStats.test.ts | Tests overview readiness/quota-health/resource-pool stats helpers. |
| src/components/overview/CapsuleEvents.tsx | Adds overview Events list filtered to Capsule API group with per-resource links. |
| src/components/overview/capsuleEvents.test.ts | Tests Capsule events filtering and timestamp selection. |
| src/components/overview/capsuleEventHelpers.ts | Adds Capsule event API-group filter + timestamp selector helpers. |
| src/components/namespaces/namespaceQuotaSystems.test.ts | Adds tests for namespace quota references + graph behavior. |
| src/components/namespaces/namespaceQuotaReferences.ts | Finds Capsule quota systems referencing a namespace via aggregation status. |
| src/components/namespaces/namespaceQuotaGraph.ts | Builds namespace→quota-systems flow graph with centering logic. |
| src/components/namespaces/namespaceEffectiveQuota.ts | Computes effective per-resource limits across Capsule quotas + native ResourceQuotas. |
| src/components/namespaces/namespaceEffectiveQuota.test.ts | Tests effective quota row selection/tie-breaking behavior. |
| src/components/namespaces/namespaceDetailsSections.ts | Adds section insertion helper + Tenant name resolution for Namespace metadata. |
| src/components/namespaces/namespaceDetailsSections.test.ts | Tests section insertion and tenant-name resolution precedence. |
| src/components/namespaces/NamespaceDetailsIntegration.tsx | Adds Namespace DetailsGrid processor: inject Tenant row + quota systems section. |
| src/components/namespaces/NamespaceDetailsIntegration.test.tsx | Tests section ordering + metadata Tenant-row injection. |
| src/components/map/tenantGrouping.test.ts | Adds tests for tenant grouping behavior in map data model. |
| src/components/map/mapTypes.ts | Adds map tree node types + object ID helper. |
| src/components/common/TenantResourcesStats.tsx | Reworks summary layout to SummaryCardGrid; separates Unknown from Ready. |
| src/components/common/tenantCordon.ts | Adds Tenant cordon request builder + convergence checks + refresh event dispatch. |
| src/components/common/tenantCordon.test.ts | Tests tenant cordon request and convergence logic. |
| src/components/common/SummaryCardGrid.tsx | Adds shared summary-card layout primitive for aligned list/overview pages. |
| src/components/common/statCardVisibility.ts | Adds helpers to omit zero-value segments/chips for StatCards. |
| src/components/common/statCardVisibility.test.ts | Tests segment/chip visibility filtering behavior. |
| src/components/common/ssaDiff.test.ts | Adds SSA ownership rendering tests, including manager field-set union. |
| src/components/common/ReplicationDependencies.tsx | Adds dependency cell/section components for replication resources. |
| src/components/common/replicationCordon.ts | Adds TR/GTR cordon request builder + convergence checks + refresh event dispatch. |
| src/components/common/replicationCordon.test.ts | Tests replication cordon request building and convergence logic. |
| src/components/common/QuotaMetricSummary.tsx | Adds compact metric summary UI for quota metrics. |
| src/components/common/QuotaClaims.tsx | Tweaks spacing between grouped claim sections. |
| src/components/common/quotaAggregation.ts | Adds shared quota aggregation contract + URL-backed resource selector helpers. |
| src/components/common/quotaAggregation.test.ts | Tests quota ordering + URL round-trip behavior. |
| src/components/common/ManagedResourceFlow.test.ts | Adds/extends tests for managed-resource flow + dependency node placement. |
| src/components/common/flowLayout.ts | Adds shared centering helper for source nodes against target columns. |
| src/components/common/DetailsSectionStack.tsx | Adds wrapper to keep custom sections aligned inside DetailsGrid gutter. |
| src/components/common/ConditionStatusChip.tsx | Adds consistent condition chip coloring (incl. Cordoned/Bound/Exhausted semantics). |
| src/components/common/ConditionStatusChip.test.ts | Tests condition chip color mapping rules. |
| src/components/common/ConditionsAndEvents.tsx | Adds shared Conditions + Events detail subsection with newest-first Events. |
| src/components/common/CapsuleResourceLink.tsx | Adds canonical Capsule CR link component that bypasses drawer interception. |
| src/components/common/CapsuleDocumentationAction.tsx | Adds docs header action backed by configurable base URL. |
| src/components/common/capsuleDocumentation.ts | Adds kind→docs-path mapping, safe URL normalization, and action insertion helper. |
| src/components/common/capsuleDocumentation.test.ts | Tests doc URL joining/validation and action insertion semantics. |
| src/components/common/CapsuleCustomResourceDetail.tsx | Adapts canonical Headlamp CR routes to reuse rich Capsule list/detail components. |
| package.json | Adds engines constraints and the React Flow dependency. |
| Makefile | Adds convenience targets for in-cluster Headlamp dev workflow. |
| Dockerfile | Switches init-container base to pinned multi-arch busybox:1.37.0. |
| deploy/headlamp/values.yaml | Adds dev chart values: plugin sync sidecar, plugin init container, dev-only cluster-admin binding. |
| deploy/headlamp/README.md | Documents in-cluster dev workflow, overrides, and security boundary. |
| .nvmrc | Pins Node major version for contributors. |
| .node-version | Pins Node major version for contributors. |
Suppressed comments (1)
src/resources/tenantResources.ts:113
- GlobalTenantResource.spec.cordoned is patched to
nullwhen uncordoning, so the API can represent it asnull. This interface declares it asbooleanonly; widen the type toboolean | nullto match the actual API contract.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| export interface TenantsObject extends KubeObjectInterface { | ||
| spec?: { | ||
| cordoned?: boolean; |
|
|
||
| export interface TenantResourceObject extends KubeObjectInterface { | ||
| spec?: { | ||
| cordoned?: boolean; |
Comment on lines
+25
to
+27
| const labels = json.metadata?.labels || {}; | ||
| const labeledTenant = labels['capsule.clastix.io/tenant'] || labels['projectcapsule.dev/tenant']; | ||
| if (labeledTenant) return labeledTenant; |
Comment on lines
+48
to
+52
| <Link | ||
| routeName="customresource" | ||
| params={{ | ||
| crName: object.name, | ||
| crd: `${plural}.capsule.clastix.io`, |
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.
No description provided.