-
Notifications
You must be signed in to change notification settings - Fork 447
✨ WIP Add feature gate marker support for conditional CRD field inclusion #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wazery The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @wazery! |
Hi @wazery. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keen to seen progress on this issue, thanks @wazery for starting the push forward.
Feature gating is complex when it comes to CRDs. I'd be keen to see if we can also work out a plan for how we will gate specific markers, is that something we can align on as a project before we move forward?
Specifically I've seen needs for feature gated different enum sets, different feature gated XValidations and different values for things like Min/Max items that are feature gated.
But perhaps we actually need to be able to support gating all of the various markers we support?
/ok-to-test
@wazery: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
3001605
to
b15c521
Compare
b15c521
to
de2450b
Compare
Thanks a lot Joel for your review, I truly appreciate it and learn much from it. As you can see in the current implementation it's very initial, and allows only binary field inclusion so either the entire field is in or out. Yet we can enhance the implementation further to address your cases:
For example: Option A: Inline Feature Gate Syntax
Option B: Dedicated Feature Gate Markers
Option C: Block-based Feature Gating
I love to hear your thoughts on how do you think we have to move forward on this PR, and truly appreciated your help 🙇. |
Based on feedback from PR kubernetes-sigs#1259 review comments, enhance RBAC feature gates with: - Support for complex feature gate expressions using OR (|) and AND (&) logic - Enhanced documentation with clear usage examples - Validation for feature gate expressions with proper error handling - Comprehensive test coverage for multiple gate scenarios New feature gate syntax: - Single gate: featureGate=alpha - OR logic: featureGate=alpha|beta (enabled if ANY gate is true) - AND logic: featureGate=alpha&beta (enabled if ALL gates are true) Examples: // +kubebuilder:rbac:featureGate=alpha|beta,groups=apps,resources=deployments,verbs=get;list // +kubebuilder:rbac:featureGate=alpha&beta,groups="",resources=services,verbs=get;list Addresses maintainer feedback on expression validation, multiple gate support, and improved documentation clarity.
Based on feedback from PR kubernetes-sigs#1259 review comments, enhance RBAC feature gates with: - Support for complex feature gate expressions using OR (|) and AND (&) logic - Enhanced documentation with clear usage examples - Validation for feature gate expressions with proper error handling - Comprehensive test coverage for multiple gate scenarios New feature gate syntax: - Single gate: featureGate=alpha - OR logic: featureGate=alpha|beta (enabled if ANY gate is true) - AND logic: featureGate=alpha&beta (enabled if ALL gates are true) Examples: // +kubebuilder:rbac:featureGate=alpha|beta,groups=apps,resources=deployments,verbs=get;list // +kubebuilder:rbac:featureGate=alpha&beta,groups="",resources=services,verbs=get;list Addresses maintainer feedback on expression validation, multiple gate support, and improved documentation clarity.
ff80782
to
cc41ffa
Compare
From your suggestions, I'd be interested to see if we can move towards Option A, though I don't know how simple that is for markers where we currently don't have keyed values. So for example, in XValidation, it's easy to add another value as it's already a multi-value marker. For the single value markers, adding an optional additional field isn't something I've looked into (not recently at least), but from the UX perspective sounds like the best IMO Interested to see if other maintainers have opinions on this project @alvaroaleman @sbueringer (and @everettraven who is a colleague who helps me with API review at RH) |
Introduces pkg/featuregate to eliminate code duplication across CRD, RBAC, and Webhook generators. This addresses the main architectural concerns raised in PR kubernetes-sigs#1259 review. Features: - Centralized parsing and validation logic - Strict mode for unknown gate validation - Support for complex AND/OR expressions - Backward compatible legacy functions - Uses k8s.io/apimachinery/pkg/util/sets - Comprehensive test coverage The package provides both legacy functions for backward compatibility and a new Registry API for strict validation of known feature gates.
101f809
to
2e1498d
Compare
2e1498d
to
e53dccf
Compare
e53dccf
to
53df8d4
Compare
a933760
to
73f7c9b
Compare
…ok generators - Add centralized featuregate package with evaluation and parsing logic - Implement CRD feature gate markers for conditional field inclusion - Add RBAC feature gate support with multiple gate evaluation - Extend Webhook generator with feature gate capabilities - Include comprehensive test coverage and golden output files
73f7c9b
to
e3a9853
Compare
Implements
+kubebuilder:feature-gate=<gate-name>
marker that allows fields to be conditionally included in generated CRDs based on enabled feature gates.Addresses #1238