quota-controller

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0

README

quota-controller

CI Release Go License

IPCEI-CIS Badge

Hierarchical quota delegation for the edge-connect platform — the implementation of ADR-0026.

quota-controller is part of the IPCEI-CIS cloud infrastructure initiative. Within the IPCEI-CIS edge framework it provides the multi-tenant quota governance layer: workspace admins delegate resource budgets down the kcp workspace tree, and admission-time reservation enforces them exactly at every level.

Workspace admins divide their granted budget among sub-workspaces via a QuotaPolicy CR (one per workspace, named default). The system enforces:

  • Tightening invariant — a child's limits never exceed what its parent has left; checked at admission via CAS reservation against the parent's status.allocatedToChildren (§7).
  • Root ceiling — the org-root QuotaPolicy must fit inside TenantPolicy.spec.quotas (ADR-0018 commercial ceiling, §3.2).
  • Exact create gating — a thin admission webhook CAS-reserves against QuotaEnforcement.status.usage; trueup owners (the components that already watch each kind) converge the counter to ground truth (§4).

Components

Binary Role
cmd/quota-controller Owns QuotaPolicy: translates admitted limits into per-(workspace, enforcer) QuotaEnforcement directives, mirrors usage back onto QuotaPolicy.status.used, derives path/parentPath, trues up allocatedToChildren. Multicluster over the quotapolicies + quotaenforcements APIExports.
cmd/quota-admission-webhook Serves both admission paths: reservation on creates of quota-managed kinds (§4a) and QuotaPolicy validation (tightening + root ceiling + allocation reservation, §3/§7).

Trueup reconcilers for counted kinds live with their existing watchers (platform controller, workspace-controller — see ADR-0026 §4b). This module ships the shared QuotaEnforcement contract and its enforcer-side implementation: pkg/trueup owns the trueup protocol (identity filtering, usage overwrite, observedGeneration, the Accepted condition, no-op write suppression); a host controller implements only the trueup.Counter hook over its existing informer cache and wires SetupWithManager with its counted kinds.

config/kcp embeds the generated APIResourceSchema manifests, so a host's integration suite can publish the quota APIs against a real kcp from the same bytes the Helm chart installs:

schema, err := kcpconfig.APIResourceSchemaYAML("quotaenforcements")

Development

make help          # all targets
make test          # unit tests
make test-e2e      # envtest integration suite
make test-kcp      # e2e against kcp (downloads and starts a throwaway kcp; set KCP_KUBECONFIG to reuse a running one)
make manifests     # regenerate CRDs + kcp APIResourceSchemas

Conventions mirror ../tenant-controller.

Architecture, decision flows and operating notes: docs/quota-controller.md.

License

Apache-2.0 — see LICENSE.

Funding and Support

This open source project is part of activities carried out within the Important Project of Common European Interest on Next Generation Cloud Infrastructure and Services (IPCEI-CIS) — FKZ 13IPC005, an EU initiative to build a sovereign, interoperable and energy-efficient cloud-to-edge infrastructure in Europe.

The work in this repository has been supported and co-funded by Deutsche Telekom in the context of IPCEI-CIS, where Deutsche Telekom contributes its expertise in secure, sustainable connectivity and cloud-edge platform orchestration for a European cloud-edge continuum.

Where applicable, further national or European public funding instruments associated with IPCEI-CIS may also have contributed to the development of this software.

IPCEI-CIS

Directories

Path Synopsis
api
v1alpha1
+kubebuilder:object:generate=true +groupName=tenancy.edgeconnect.eu
+kubebuilder:object:generate=true +groupName=tenancy.edgeconnect.eu
cmd
quota-admission-webhook command
ABOUTME: Entry point for the quota-admission-webhook binary — serves the §4a reservation gate ABOUTME: and the QuotaPolicy validation (§3/§7), both dispatched from the APIExport owner workspace.
ABOUTME: Entry point for the quota-admission-webhook binary — serves the §4a reservation gate ABOUTME: and the QuotaPolicy validation (§3/§7), both dispatched from the APIExport owner workspace.
quota-controller command
ABOUTME: Entry point for the quota-controller binary — owns QuotaPolicy across all bound ABOUTME: workspaces via the quotapolicies APIExport and emits QuotaEnforcement directives.
ABOUTME: Entry point for the quota-controller binary — owns QuotaPolicy across all bound ABOUTME: workspaces via the quotapolicies APIExport and emits QuotaEnforcement directives.
config
kcp
ABOUTME: Ships the generated kcp APIResourceSchemas as module content so trueup hosts in other ABOUTME: repositories can publish the quota APIs in their integration suites.
ABOUTME: Ships the generated kcp APIResourceSchemas as module content so trueup hosts in other ABOUTME: repositories can publish the quota APIs in their integration suites.
internal
quota
ABOUTME: Pure reservation decision logic — the count-vs-limit core both admission paths share ABOUTME: (ADR-0026 §4a resource creates, §7 child-grant allocation).
ABOUTME: Pure reservation decision logic — the count-vs-limit core both admission paths share ABOUTME: (ADR-0026 §4a resource creates, §7 child-grant allocation).
quotapolicy
ABOUTME: Reconciler for QuotaPolicy — translates limits into per-enforcer QuotaEnforcement ABOUTME: directives, mirrors usage, derives path/parentPath, trues up allocatedToChildren (ADR-0026).
ABOUTME: Reconciler for QuotaPolicy — translates limits into per-enforcer QuotaEnforcement ABOUTME: directives, mirrors usage, derives path/parentPath, trues up allocatedToChildren (ADR-0026).
readiness
ABOUTME: Cache-sync readiness gate for controller-runtime managers.
ABOUTME: Cache-sync readiness gate for controller-runtime managers.
webhook
ABOUTME: Production implementations of the handler contracts: Resolver over the multicluster ABOUTME: manager + aggregate QuotaPolicy cache, and the TenantPolicy ceiling read (unstructured).
ABOUTME: Production implementations of the handler contracts: Resolver over the multicluster ABOUTME: manager + aggregate QuotaPolicy cache, and the TenantPolicy ceiling read (unstructured).
pkg
registry
ABOUTME: The GVK->enforcer registry (ADR-0026 §4b/§6) — names, per quota-managed kind, the one ABOUTME: component that owns its count.
ABOUTME: The GVK->enforcer registry (ADR-0026 §4b/§6) — names, per quota-managed kind, the one ABOUTME: component that owns its count.
trueup
ABOUTME: The shared §4b trueup reconciler every enforcer embeds — converges QuotaEnforcement ABOUTME: .status.usage to the enforcer's ground-truth count.
ABOUTME: The shared §4b trueup reconciler every enforcer embeds — converges QuotaEnforcement ABOUTME: .status.usage to the enforcer's ground-truth count.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL