Open
Conversation
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
81bc3e6 to
46ddb6d
Compare
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
46ddb6d to
209af96
Compare
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
0e5c591 to
9ebd73c
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces custom quota enforcement capabilities by adding CustomQuota (namespaced) and ClusterCustomQuota (cluster-scoped) CRDs with their associated controllers and webhooks. These quotas dynamically source usage values from Kubernetes resources using JSONPath expressions and enforce limits based on label selectors.
Key Changes
- Added new CRDs for CustomQuota and ClusterCustomQuota with status subresources to track usage, available, and claims
- Implemented controllers to reconcile quota status based on matching resources in target namespaces
- Implemented validating webhooks to enforce quota limits on resource create, update, and delete operations
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| api/v1beta2/customquota_types.go | Defines the CustomQuota CRD structure with spec for limit, source, and scope selectors |
| api/v1beta2/customquota_status.go | Defines status fields for tracking used, available quantities and claims list |
| api/v1beta2/clustercustomquota_types.go | Extends CustomQuota spec with namespace selectors for cluster-scoped quotas |
| api/v1beta2/zz_generated.deepcopy.go | Auto-generated deep copy methods for the new types |
| internal/controllers/customquotas/customquota_controller.go | Controller that reconciles CustomQuota status by aggregating resource usage |
| internal/controllers/customquotas/clustercustomquota_controller.go | Controller that reconciles ClusterCustomQuota status across multiple namespaces |
| internal/controllers/customquotas/utils.go | Utility functions for extracting usage from resources and matching namespaces |
| internal/controllers/customquotas/manager.go | Registers both quota controllers with the manager |
| internal/webhook/customquota/validation/customquota.go | Validating webhook handlers that enforce quota limits on resource operations |
| internal/webhook/customquota/validation/utils.go | Helper function to determine quota type from namespace presence |
| internal/webhook/route/customquotas.go | Webhook route registration for custom quotas |
| cmd/main.go | Integrates custom quota controllers and webhooks into the main application |
| charts/capsule/values.yaml | Adds Helm values for configuring the custom quotas webhook |
| charts/capsule/values.schema.json | JSON schema validation for the new webhook configuration |
| charts/capsule/templates/validatingwebhookconfiguration.yaml | Webhook configuration for quota enforcement on all namespaced resources |
| charts/capsule/templates/crd-lifecycle/rbac.yaml | Adds RBAC permissions for custom quota CRDs |
| charts/capsule/crds/capsule.clastix.io_customquotas.yaml | CRD manifest for namespaced CustomQuota |
| charts/capsule/crds/capsule.clastix.io_clustercustomquotas.yaml | CRD manifest for cluster-scoped ClusterCustomQuota |
| charts/capsule/README.md | Documents the new webhook configuration options |
| e2e/customresource_quota_exceeded_test.go | E2E tests verifying CustomQuota enforcement and resize scenarios |
| e2e/clustercustomresource_quota_exceeded_test.go | E2E tests verifying ClusterCustomQuota enforcement across namespaces |
internal/controllers/customquotas/clustercustomquota_controller.go
Outdated
Show resolved
Hide resolved
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
internal/controllers/customquotas/clustercustomquota_controller.go
Outdated
Show resolved
Hide resolved
internal/controllers/customquotas/clustercustomquota_controller.go
Outdated
Show resolved
Hide resolved
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
internal/controllers/customquotas/clustercustomquota_controller.go
Outdated
Show resolved
Hide resolved
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
Signed-off-by: CorentinPtrl <pitrel.corentin@gmail.com>
|
This pull request has been marked as stale because it has been inactive for more than 30 days. Please update this pull request or it will be automatically closed in 30 days. |
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.
This PR adds
CustomQuotaandClusterCustomQuotafrom #1745 CRDs with their controllers to enforce quota limits based on values sourced from Kubernetes resources.Quotas can be scoped using label selectors and dynamically resolved from objects like
ConfigMapExamples