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 the OPENSHIFT_REQUIRED_FEATURESET env var and openshift:enable:featureSet marker #11

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

deads2k
Copy link

@deads2k deads2k commented Aug 29, 2022

This allows openshift/api to have separate sets of manifests for different featuresets.

/hold

holding for discussion with @JoelSpeed

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 29, 2022
Copy link

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

Got a controller-gen binary checked in, please drop that

Do we need to be able to support a field being present in multiple FeatureSets? In Kubebuilder you can create separated lists of values, like the enum marker, perhaps we want to support this too by copying that pattern?


import "sigs.k8s.io/controller-tools/pkg/markers"

const OpenShiftFeatureSetMarkerName = "openshift:enable:featureSet"

Choose a reason for hiding this comment

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

Kubebuilder uses PascalCase for the third element, I think we should be consistent

Suggested change
const OpenShiftFeatureSetMarkerName = "openshift:enable:featureSet"
const OpenShiftFeatureSetMarkerName = "openshift:enable:FeatureSet"

Copy link
Author

Choose a reason for hiding this comment

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

Ah, coding via side-effect. change this case and we end up down a different code path that fails in controller-tools. Such a pain. I'll chase it and prepare for sadness.

var RequiredFeatureSet = os.Getenv("OPENSHIFT_REQUIRED_FEATURESET")

// mayHandleField returns true if the field should be considered by this invocation of the generator.
// Right now, the only sip is based on the featureset marker.

Choose a reason for hiding this comment

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

What's a sip in this context?

return true
}

manifestFeatureSet := manifest.GetAnnotations()["release.openshift.io/feature-set"]

Choose a reason for hiding this comment

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

Can GetAnnotations ever return a nil?

Copy link
Author

Choose a reason for hiding this comment

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

Can GetAnnotations ever return a nil?

Yes, it can. You can read values from a nil map: https://go.dev/play/p/hHg_-G6RpKE

Comment on lines 21 to 26
if len(RequiredFeatureSet) == 0 {
if len(manifestFeatureSet) == 0 {
return true
}
return false
}

Choose a reason for hiding this comment

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

Is this needed?
The output of this function is currently

required manifest required == manifest output
"" "" true true
"" foo false false
foo foo true true
foo bar false false

I think we can drop these lines unless there's something surprising happening here?

@deads2k deads2k force-pushed the techpreview-01-for-old branch 2 times, most recently from 0ab0804 to 2e4a7b9 Compare September 6, 2022 20:49
@JoelSpeed
Copy link

One outstanding question else I'm happy with this

@JoelSpeed
Copy link

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Sep 7, 2022

@JoelSpeed: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@deads2k
Copy link
Author

deads2k commented Sep 7, 2022

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 7, 2022
@deads2k deads2k merged commit 338d33b into openshift:master Sep 7, 2022
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.

2 participants