Fix quota enforcement for IPAM claims#47
Merged
Conversation
…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>
privateip
approved these changes
Jun 28, 2026
This was referenced Jun 28, 2026
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.
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
metadataJSON key), so milo's quota plugin CELtrigger.metadata.namefailed with "no such key: metadata". milo handles this when given aruntime.ObjectConvertor; IPAM never injected one, leavingobjectConvertornil. The fix adds an admission initializer (mirroring the existing loopback-config one) injectingipamapiserver.Scheme.