Skip to content

Fix quota enforcement for IPAM claims#47

Merged
scotwells merged 1 commit into
mainfrom
fix/quota-object-convertor
Jun 28, 2026
Merged

Fix quota enforcement for IPAM claims#47
scotwells merged 1 commit into
mainfrom
fix/quota-object-convertor

Conversation

@scotwells

Copy link
Copy Markdown
Contributor

Problem

Creating an IP claim in a project failed at the quota gate with a generic error — "Something went wrong while checking your quota for this request." — so no claim could be allocated, even though quota was configured correctly and capacity was available. (Surfaced while validating the end-to-end flow in staging after the allocator tenant-key fix went live: claims now reach quota enforcement and were rejected there.)

Fix

The quota enforcement plugin builds each request's resource-claim name from the triggering object, but for IPAM it was handed the object in a form that didn't expose its name, so every quota-checked create errored internally. This wires IPAM's type scheme into the quota plugin so the object is presented in its proper form, and quota enforcement evaluates correctly. With this, a project-scoped IP claim allocates and returns its CIDR as expected.

Tests

Adds a regression test for the wiring so quota enforcement can't silently break again.

Notes for reviewers: IPAM is an aggregated apiserver whose objects reach admission as internal Go types (ObjectMeta inlined, no metadata JSON key), so milo's quota plugin CEL trigger.metadata.name failed with "no such key: metadata". milo handles this when given a runtime.ObjectConvertor; IPAM never injected one, leaving objectConvertor nil. The fix adds an admission initializer (mirroring the existing loopback-config one) injecting ipamapiserver.Scheme.

…Claim

IPAM is an aggregated apiserver: admission decodes its objects as internal
Go types (ipam.IPClaim), whose ObjectMeta is inlined with no "metadata"
JSON wrapper. milo's quota plugin renders the per-resource ResourceClaim
name from a CEL template ("trigger.metadata.name"); evaluated against an
internal object run through ToUnstructured (no "metadata" key) it fails, so
every quota-enforced IPClaim create is denied with an internal error
("Something went wrong while checking your quota").

milo's plugin handles this when given a runtime.ObjectConvertor — it first
converts the internal object to its external versioned form (which carries
metadata) before building the CEL trigger — but IPAM never injected one, so
objectConvertor stayed nil. Wire an admission initializer (mirroring the
existing loopback-config initializer) that injects IPAM's scheme, which
registers the internal<->v1alpha1 conversions.

Found by validating the end-to-end allocation flow against staging once the
allocator tenant-key fix (#44) was live: claims now reach quota enforcement
and failed there with the CEL "no such key: metadata" error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scotwells scotwells merged commit c01cfd3 into main Jun 28, 2026
10 checks passed
@scotwells scotwells deleted the fix/quota-object-convertor branch June 28, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants