-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
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.
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?
pkg/crd/markers/patch_validation.go
Outdated
|
||
import "sigs.k8s.io/controller-tools/pkg/markers" | ||
|
||
const OpenShiftFeatureSetMarkerName = "openshift:enable:featureSet" |
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.
Kubebuilder uses PascalCase
for the third element, I think we should be consistent
const OpenShiftFeatureSetMarkerName = "openshift:enable:featureSet" | |
const OpenShiftFeatureSetMarkerName = "openshift:enable:FeatureSet" |
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.
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.
pkg/crd/patch_schema.go
Outdated
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. |
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.
What's a sip
in this context?
pkg/schemapatcher/patch_gen.go
Outdated
return true | ||
} | ||
|
||
manifestFeatureSet := manifest.GetAnnotations()["release.openshift.io/feature-set"] |
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.
Can GetAnnotations
ever return a nil?
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.
Can GetAnnotations ever return a nil?
Yes, it can. You can read values from a nil map: https://go.dev/play/p/hHg_-G6RpKE
pkg/schemapatcher/patch_gen.go
Outdated
if len(RequiredFeatureSet) == 0 { | ||
if len(manifestFeatureSet) == 0 { | ||
return true | ||
} | ||
return false | ||
} |
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.
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?
0ab0804
to
2e4a7b9
Compare
One outstanding question else I'm happy with this |
2e4a7b9
to
1891174
Compare
/lgtm |
@JoelSpeed: changing LGTM is restricted to collaborators In response to this:
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. |
/hold cancel |
This allows openshift/api to have separate sets of manifests for different featuresets.
/hold
holding for discussion with @JoelSpeed