Skip to content
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

Add enable function to schema and addFeature functions #289

Merged
merged 1 commit into from
Jul 2, 2019

Conversation

rmweir
Copy link
Contributor

@rmweir rmweir commented May 31, 2019

Related feature
Add feature flags

Rancher PR:
rancher/rancher#20593

@rmweir rmweir force-pushed the feature-flags-v2 branch 5 times, most recently from 04e5a84 to 122bc76 Compare June 7, 2019 23:00
@rmweir rmweir changed the title WIP Feature flags v2 Add enable function to schema and addFeature functions Jun 8, 2019
@rmweir rmweir marked this pull request as ready for review June 8, 2019 00:59
@@ -169,6 +189,21 @@ func (c *{{.schema.ID}}Controller) AddClusterScopedHandler(ctx context.Context,
})
}

func (c *{{.schema.ID}}Controller) AddClusterScopedFeatureHandler(enabled func() bool, ctx context.Context, name, cluster string, handler {{.schema.CodeName}}HandlerFunc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific case this satisfies?
Can a user enable a feature on a per cluster basis?

@@ -74,7 +74,9 @@ type {{.schema.CodeName}}Controller interface {
Informer() cache.SharedIndexInformer
Lister() {{.schema.CodeName}}Lister
AddHandler(ctx context.Context, name string, handler {{.schema.CodeName}}HandlerFunc)
AddFeatureHandler(enabled func() bool, ctx context.Context, name string, sync {{.schema.CodeName}}HandlerFunc)
Copy link
Contributor

Choose a reason for hiding this comment

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

context should always be the first arg to a function

@rmweir rmweir force-pushed the feature-flags-v2 branch from 122bc76 to 868477f Compare June 12, 2019 16:30
Added enable function to schemas. This allows filtering of schemas
which is a required part of feature flagging in rancher. Added
addFeature functions to controller template for adding handlers that
can be disabled if their associated feature is disabled.
@rmweir rmweir force-pushed the feature-flags-v2 branch from 868477f to 48968c1 Compare June 12, 2019 18:42
@cjellick
Copy link

cjellick commented Jul 2, 2019

lgtm

@cjellick cjellick merged commit 2da1bd2 into rancher:master Jul 2, 2019
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.

4 participants