Skip to content

feature-gates: adding initial structure #371

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

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

beraldoleal
Copy link
Member

This commit introduces the FeatureGates struct in the operator's configuration, enabling a flexible and controlled approach to feature rollout. The FeatureGates struct allows for the enabling or disabling of specific features, with a default behaviour based on each feature's maturity level.

Uses Kubebuilder default value annotations for CRD fields to automatically set default behaviours in the Kubernetes API.

I'm trying to use a simple approach here where we could change promote/depromote a feature by just changing the comments and the default values.

Please let know what I'm missing (probably I'm missing a lot) and what you think about this approach.

@openshift-ci openshift-ci bot requested review from bpradipt and pmores January 26, 2024 21:14
@beraldoleal beraldoleal force-pushed the feature-gates branch 2 times, most recently from e5fc400 to 90417f7 Compare January 26, 2024 21:41
Copy link
Contributor

@snir911 snir911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, however, looks like the right direction to me

@beraldoleal beraldoleal force-pushed the feature-gates branch 2 times, most recently from f017991 to 5fab1eb Compare March 12, 2024 14:40
@beraldoleal beraldoleal changed the title RFC: feature-gates: adding initial structure feature-gates: adding initial structure Mar 12, 2024
@beraldoleal beraldoleal force-pushed the feature-gates branch 6 times, most recently from 4c0ac35 to 7a017ac Compare March 12, 2024 20:40
@snir911
Copy link
Contributor

snir911 commented Mar 13, 2024

@beraldoleal thanks! LGTM overall, couple of questions:

  1. are we merging it with the dummy features? i.e. timeTrabel, AIhealing etc...?
  2. consider filtering the events using Predicate rather than handler, see this reference (IIUC it would filter the events before actually emitted and handled)
  3. Should we deploy also the osc-feature-gates CM with the default values so it can be used as a template for the user? IDK if it's even possible...

@beraldoleal
Copy link
Member Author

beraldoleal commented Mar 13, 2024

Hi @snir911 , my comments bellow:

  1. are we merging it with the dummy features? i.e. timeTrabel, AIhealing etc...?

Good question. I was planning to keep the default map empty (since is a code block) but keep the config/samples/featuregates.yaml there with some notes, saying those are fake... (since is just an example and until we have our first feature on boarded). Wdyt?

  1. consider filtering the events using Predicate rather than handler, see this reference (IIUC it would filter the events before actually emitted and handled)

When considering the implementation, my initial thought was to use Predicates. However, since the other watches were utilizing EventHandlers, I opted to maintain consistency and avoid a mix of approaches. To be honest, I also prefer using Predicates. If you see no issue with incorporating both EventHandlers and Predicates within the same setup, we could explore this option.

  1. Should we deploy also the osc-feature-gates CM with the default values so it can be used as a template for the user? IDK if it's even possible...

I believe it's possible, yes, but it might be unnecessary. The default values are intended for use as-is, without the need for user intervention. Introducing another ConfigMap into users' deployments for those adhering to the default values might not be ideal. The config/samples/ directory serves as a source of "templates" for users. So, unless there is something I'm missing, I would say to keep it just in config/samples/.

@snir911
Copy link
Contributor

snir911 commented Mar 14, 2024

Hi @snir911 , my comments bellow:

  1. are we merging it with the dummy features? i.e. timeTrabel, AIhealing etc...?

Good question. I was planning to keep the default map empty (since is a code block) but keep the config/samples/featuregates.yaml there with some notes, saying those are fake... (since is just an example and until we have our first feature on boarded). Wdyt?

IDK, we can either start with a real feature (maybe peer-pods? but just print a msg instead of actually enabling it ATM?) or maybe to leave only single dummy feature?

  1. consider filtering the events using Predicate rather than handler, see this reference (IIUC it would filter the events before actually emitted and handled)

When considering the implementation, my initial thought was to use Predicates. However, since the other watches were utilizing EventHandlers, I opted to maintain consistency and avoid a mix of approaches. To be honest, I also prefer using Predicates. If you see no issue with incorporating both EventHandlers and Predicates within the same setup, we could explore this option.

AFAIK there's no problem to mix (we do it in the credentials controller), the handlers are usually used when there are some ops needed IIUC..

  1. Should we deploy also the osc-feature-gates CM with the default values so it can be used as a template for the user? IDK if it's even possible...

I believe it's possible, yes, but it might be unnecessary. The default values are intended for use as-is, without the need for user intervention. Introducing another ConfigMap into users' deployments for those adhering to the default values might not be ideal. The config/samples/ directory serves as a source of "templates" for users. So, unless there is something I'm missing, I would say to keep it just in config/samples/.

Sure, anyway we can do it at any point..

@beraldoleal
Copy link
Member Author

beraldoleal commented Mar 14, 2024

IDK, we can either start with a real feature (maybe peer-pods? but just print a msg instead of actually enabling it ATM?) or maybe to leave only single dummy feature?

Currently peerpods is enabled by another way... adding peer-pods to the feature gates without disabling the other way it will be confuse. Also, if we add a new feature with just a print message (lets say "CoCo") it will give the users the wrong impression. IMO it will be confusing, because users might think this is actually enabling.

If we don´t have a feature to onboard now, Keeping a single dummy feature reinforces this is fake. So it think is safe (at least until we replace it with a real feature).

AFAIK there's no problem to mix (we do it in the credentials controller), the handlers are usually used when there are some ops needed IIUC..

Ok, I will send a new version with the Predicates.

Thanks again, @snir911 .

This commit introduces the `FeatureGates` struct in the operator's
configuration, enabling a flexible and controlled approach to feature
rollout. The `FeatureGates` configMap allows for the enabling or disabling
of specific features, with a default behaviour based on each feature's
maturity level.

For each new feature, developers need to modify the "default" struct,
just in case users don't have to set their desired behaviour. User's
choice will override default values.

I'm trying to use a simple approach here where we could change
promote/depromote a feature by just changing the comments and the
default values.

Fixes: #KATA-2677

Signed-off-by: Beraldo Leal <[email protected]>
Basic instructions on how to use feature gates.

Signed-off-by: Beraldo Leal <[email protected]>
@beraldoleal
Copy link
Member Author

@snir911 @bpradipt just pushed with the Predicate implementation, let me know if I'm missing something.

Copy link

openshift-ci bot commented Mar 14, 2024

@beraldoleal: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/sandboxed-containers-operator-e2e 7ac6079 link false /test sandboxed-containers-operator-e2e
ci/prow/check 7ac6079 link false /test check

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@bpradipt bpradipt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
Thanks @beraldoleal

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2024
@bpradipt bpradipt self-requested a review March 16, 2024 13:24
Copy link
Contributor

@bpradipt bpradipt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
Thanks @beraldoleal

@beraldoleal
Copy link
Member Author

@snir911 ?

Copy link
Contributor

@snir911 snir911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! (assuming it was tested)

@bpradipt bpradipt merged commit d2bb6f7 into openshift:devel Mar 25, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants