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
Parse CustomNoUpgrade feature gates #262
Parse CustomNoUpgrade feature gates #262
Conversation
/assign @soltysh |
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.
This change looks fine to me, but does it need to be broken into a new function like you have currently? It looks like there's now 5 helpers all <20 lines that are called in a row to parse the feature gate. That's not your fault, but I don't know if this is helping the readability.
I think this change can be added to the checkForFeatureGates
function like so:
func checkForFeatureGates(featureGateLister configlistersv1.FeatureGateLister) map[string]bool {
featureGateListConfig, err := featureGateLister.Get("cluster")
var enabledFeatureSets, disabledFeatureSets []string
var featureGates = make(map[string]bool)
if err != nil {
klog.Infof("Error while listing features.config.openshift.io/cluster with %v: so return default feature gates", err.Error())
if featureSet, ok := v1.FeatureSets[v1.Default]; ok {
enabledFeatureSets = featureSet.Enabled
disabledFeatureSets = featureSet.Disabled
}
return generateFeatureGates(enabledFeatureSets, disabledFeatureSets, featureGates)
}
if featureGateListConfig.Spec.FeatureSet == v1.CustomNoUpgrade {
if featureGateListConfig.Spec.FeatureGateSelection.CustomNoUpgrade != nil {
enabledFeatureSets = featureGateListConfig.Spec.FeatureGateSelection.CustomNoUpgrade.Enabled
disabledFeatureSets = featureGateListConfig.Spec.FeatureGateSelection.CustomNoUpgrade.Disabled
}
} else if featureSet, ok := v1.FeatureSets[featureGateListConfig.Spec.FeatureSet]; ok {
enabledFeatureSets = featureSet.Enabled
disabledFeatureSets = featureSet.Disabled
} else {
klog.Infof("Invalid feature set config found in features.config.openshift.io/cluster %v. Please look at allowed features", featureGateListConfig.Spec.FeatureSet)
}
return generateFeatureGates(enabledFeatureSets, disabledFeatureSets, featureGates)
}
Does that look reasonable? The if/elseif/else
isn't quite as clean as using straight returns, but I think this would help keep this code more readable. I won't block on this though so I'll approve now, and if you want to push that change then someone can lgtm
/approve
Currently if we add a feature gate to the featuregates.config.openshift.io/cluster object, the controller-manager and the apiserver correctly enable the feature, but the scheduler does not. This patch adds the missing code that handles this functionality.
cf768bf
to
01373c1
Compare
Hi Mike, I'm fine with that. PTAL |
/retest |
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.
/lgtm
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bertinatto, damemi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
14 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Currently if we add a feature gate to the
featuregates.config.openshift.io/cluster
object, the controller-manager and the apiserver correctly enable the feature, but the scheduler does not.This patch adds the missing code that handles this functionality.