Skip to content

feat: implement standard Kubernetes feature gates#1077

Closed
shivansh-gohem wants to merge 2 commits intokubernetes-sigs:mainfrom
shivansh-gohem:feat/510-feature-gates
Closed

feat: implement standard Kubernetes feature gates#1077
shivansh-gohem wants to merge 2 commits intokubernetes-sigs:mainfrom
shivansh-gohem:feat/510-feature-gates

Conversation

@shivansh-gohem
Copy link
Contributor

Fixes #510

Description

As suggested by @ramonvermeulen, this implements a Kubernetes-style feature gate registry using k8s.io/component-base/featuregate (the same package used by Kubernetes core). This provides standard --feature-gates=MyFeature=true CLI parsing, lifecycle tracking (Alpha/Beta/GA), and default states.

Changes Made

  • pkg/features/features.go: Implemented the global feature registry (FeatureGate), starting with ParallelDagWalking as the first Alpha feature gate placeholder.
  • pkg/features/features_test.go: Added a test suite covering default states, overriding via Set(), and error handling for unknown features.
  • cmd/controller/main.go: Wired the -feature-gates string directly into KRO's existing flag setup, successfully bridging it to featuregate.Set(). Added startup logging for known feature gates.
  • go.mod: Promoted k8s.io/component-base to a direct dependency.

Verification

  • Verified go test ./pkg/features/... passes.
  • Verified go run ./cmd/controller/main.go --help properly displays the newly registered -feature-gates flag.
  • Verified controller boots successfully against a live kind cluster with the flag enabled.

…s via component-base

Signed-off-by: Shivansh Sahu <sahushivansh142@gmail.com>
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shivansh-gohem
Once this PR has been reviewed and has the lgtm label, please assign bridgetkromhout for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 27, 2026
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @shivansh-gohem. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 27, 2026
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2026
@shivansh-gohem
Copy link
Contributor Author

/cc @jakobmoellerdev

@jakobmoellerdev
Copy link
Member

I dont really see any features that need gating like this. what were you thinking of when writing this?

@shivansh-gohem
Copy link
Contributor Author

shivansh-gohem commented Feb 27, 2026

@jakobmoellerdev as in the Issue #510. In that thread, @ramonvermeulen suggested implementing the standard k8s.io/component-base/featuregate registry for future use, and explicitly mentioned ParallelDagWalking as a potential first candidate, which is why I used it as the initial Alpha placeholder here. if you would suggest I'll remove the ParallelDagWalking placeholder and just leave an empty registry, or if the core team has decided feature gates aren't needed anymore, just let me know! I am happy to adjust the PR

@jakobmoellerdev
Copy link
Member

what would parallel dag walking even be? I feel like this can be brought back in when we actually want any gating to happen. currently I dont see a need for gating and we should stabilize and work with what we have. happy to revisit this anytime though

/close

@k8s-ci-robot
Copy link
Contributor

@jakobmoellerdev: Closed this PR.

Details

In response to this:

what would parallel dag walking even be? I feel like this can be brought back in when we actually want any gating to happen. currently I dont see a need for gating and we should stabilize and work with what we have. happy to revisit this anytime though

/close

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.

@shivansh-gohem
Copy link
Contributor Author

Understood! That makes complete sense regarding stabilization. I'll leave this closed for now, but the implementation is here in the commit history whenever the project is ready for it down the road. I'll take a look at the active issues and see where else I can help out!

@ramonvermeulen
Copy link

I mentioned the two options mainly to open up the discussion about requirements and usage of feature gates, to figure out if there is really a need / use-case for this. That's also why I didn't start implementing right away.

In the example I mentioned parallel dag walking because I know it is a feature for which there is an open issue, and with feature gates it could theoretically be added as experimental / "non-GA" feature first. It has nothing to do specifically with feature gates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature flags

4 participants