Skip to content

feat: add cloud-portal-usage-metering feature flag#600

Closed
kevwilliams wants to merge 4 commits into
mainfrom
feat/cloud-portal-usage-metering-flag
Closed

feat: add cloud-portal-usage-metering feature flag#600
kevwilliams wants to merge 4 commits into
mainfrom
feat/cloud-portal-usage-metering-flag

Conversation

@kevwilliams
Copy link
Copy Markdown
Contributor

Summary

  • Establishes the config/services/features/ Kustomize scaffold (Component hierarchy) for all future feature flags in milo
  • Adds the first ResourceRegistration of type: Feature: feature-cloud-portal-usage-metering, scoped to Organization consumers
  • Wires the new features component into config/services/kustomization.yaml alongside iam, resourcemanager, and quota

Details

The cloud-portal-usage-metering registration controls visibility of the Usage & Metering section in the Datum Cloud portal navigation. Key fields:

  • type: Feature — valid since milo#575 / PR feat(quota): add Feature to ResourceRegistration type enum #594
  • consumerType: resourcemanager.miloapis.com/Organization
  • resourceType: features.miloapis.com/cloud-portal-usage-metering
  • claimingResources: features.miloapis.com/FeatureGrant sentinel (satisfies minItems: 1 without enabling admission enforcement)

Per-org ResourceGrant objects live in datum-cloud/infra, not here.

Validation

kustomize build config/services/ builds cleanly with the new resource rendered correctly.

References

Test plan

  • kustomize build config/services/ produces the ResourceRegistration with correct fields
  • No existing resources in the build output are affected
  • After merge, apply to staging cluster and verify the registration is accepted by the quota webhook

Add pkg/featureflags package providing an OpenFeature-compatible
FeatureProvider backed by the Milo AllowanceBucket API.

A feature flag is enabled for an org when an AllowanceBucket with
status.available > 0 exists for the (org, resourceType) pair where
resourceType is "features.miloapis.com/<flagKey>".

Key design decisions:
- AllowanceBucketLister interface accepts any controller-runtime client,
  enabling easy injection and testing without a live API server
- BooleanEvaluation queries by spec.consumerRef.name and spec.resourceType
  field selectors (both are indexed in the quota system)
- Non-boolean evaluations return TYPE_MISMATCH; feature flags are boolean
  entitlements only
- API errors return defaultValue with DEFAULT reason (no panics)
- Missing or empty targetingKey returns defaultValue with DEFAULT reason

Also fix fmt.Errorf with non-literal format strings in project webhook,
surfaced as a vet error after upgrading to Go 1.25 (required by the
openfeature SDK's go.mod minimum version).

Closes #577
go.mod requires go 1.25 (introduced by the openfeature go-sdk v1.17.2
dependency); update the builder stage to match.
golang.org/x/net/http2 < v0.51.0 is vulnerable to an uncaught exception
via missing nil check on HTTP/2 frames with values 0x0a-0x0f (CVSS 6.9).
Upgrade resolves the Snyk finding introduced by the openfeature SDK adding
a fresh transitive path to the affected version.
Add the first ResourceRegistration of type Feature to milo, establishing
the config/services/features/ Kustomize scaffold for future feature flags.

The cloud-portal-usage-metering registration controls visibility of the
Usage & Metering section in the Datum Cloud portal navigation. It is
scoped to Organizations as the consumer type and uses FeatureGrant as
the claiming resource sentinel (satisfying minItems:1 without enabling
admission enforcement for arbitrary grants).

Closes datum-cloud/enhancements#711
@joggrbot
Copy link
Copy Markdown
Contributor

joggrbot Bot commented May 6, 2026

📝 Documentation Analysis

All docs are up to date! 🎉


✅ Latest commit analyzed: ac0317e | Powered by Joggr

@kevwilliams
Copy link
Copy Markdown
Contributor Author

Replaced by #601 — the branch was accidentally based on feat/openfeature-provider instead of main, pulling in unrelated provider changes. #601 contains only the 4 config files.

@kevwilliams kevwilliams closed this May 6, 2026
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.

1 participant