feat: add cloud-portal-usage-metering feature flag#600
Closed
kevwilliams wants to merge 4 commits into
Closed
Conversation
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
Contributor
Contributor
Author
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.
Summary
config/services/features/Kustomize scaffold (Component hierarchy) for all future feature flags in miloResourceRegistrationoftype: Feature:feature-cloud-portal-usage-metering, scoped toOrganizationconsumersfeaturescomponent intoconfig/services/kustomization.yamlalongsideiam,resourcemanager, andquotaDetails
The
cloud-portal-usage-meteringregistration 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 #594consumerType:resourcemanager.miloapis.com/OrganizationresourceType:features.miloapis.com/cloud-portal-usage-meteringclaimingResources:features.miloapis.com/FeatureGrantsentinel (satisfiesminItems: 1without enabling admission enforcement)Per-org
ResourceGrantobjects live indatum-cloud/infra, not here.Validation
kustomize build config/services/builds cleanly with the new resource rendered correctly.References
type: FeatureCRD change: feat: feature-flagging via Milo entitlements (#577) datum-cloud/enhancements#695Test plan
kustomize build config/services/produces theResourceRegistrationwith correct fields