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
support hubRegistrationFeatureGates and spokeRegistrationFeatureGates #230
support hubRegistrationFeatureGates and spokeRegistrationFeatureGates #230
Conversation
02056ec
to
b8a1d95
Compare
|
||
func FeatureGatesArgs(featureGates []string) []string { | ||
var featureGatesArgs []string | ||
for _, featureGate := range featureGates { |
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.
let's filter out the unknown features and output an error condition if some features are not correct.
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.
@ivan-cai would you like to rebase this PR thanks!
|
b8a1d95
to
dd81e89
Compare
f5443c6
to
2f617c3
Compare
pkg/helpers/helpers.go
Outdated
ComponentHubKey = "hub" | ||
ComponentSpokeKey = "spoke" | ||
|
||
ClusterClaim featuregate.Feature = "ClusterClaim" |
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.
@qiujian16 We need know registration's featrue gates. So should we import registration project in registration-operator to use constants or variables in open-cluster-management-io/registration/pkg/features/feature.go
? Or, we write these constants or variables to open-cluster-management-io/api, then, we import api project in registration and registration-operator?
And, registration project can not go get.
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.
I think we put those in api repo
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.
@qiujian16 ok, I would move open-cluster-management-io/registration/pkg/features/feature.go
to open-cluster-management-io/api/operator/v1/feature.go
. what do you think?
I commit a pr in api repo for this: open-cluster-management-io/api#162
2f617c3
to
d3f1932
Compare
Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
d3f1932
to
a0c9a3b
Compare
@qiujian16 Plz review again. I have changed to use api repo's variables |
@qiujian16 Plz review again for registration-operator repo |
…tionFeatureGates in api repo to check registration variable if valid Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
cf83db8
to
456389c
Compare
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.
I notice that with this change we will disable addonmanaged and defaultClusterset feature by default. It will bring some backward compatible problem. How about we keep the original setting if RegistrationConfiguration is nil?
if clusterManager.Spec.RegistrationConfiguration != nil && len(clusterManager.Spec.RegistrationConfiguration.FeatureGates) > 0 { | ||
featureGateArgs, invalidFeatureGates := helpers.FeatureGatesArgs(clusterManager.Spec.RegistrationConfiguration.FeatureGates, helpers.ComponentHubKey) | ||
if len(invalidFeatureGates) == 0 { | ||
config.RegistrationFeatureGates = featureGateArgs |
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.
I think you would want to set the same condition to true when there is no invalid feature gates.
Otherwise, we will always see false condition if user change the feature gates to correct
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.
I notice that with this change we will disable addonmanaged and defaultClusterset feature by default. It will bring some backward compatible problem. How about we keep the original setting if RegistrationConfiguration is nil?
Yes, you are right. I have fixed.
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.
I think you would want to set the same condition to true when there is no invalid feature gates.
Otherwise, we will always see false condition if user change the feature gates to correct
ok
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.
nit comment. Other looks good.
/approve
I think we should add some integration tests to check whether the condition is returned correctly with invalid features. Not a blocker for this one, but could be in a followup PR,
👌🏻
Type: hubRegistrationFeatureGatesInvalid, Status: metav1.ConditionFalse, Reason: "InvalidFeatureGatesExisting", | ||
Message: invalidFGErr.Error(), | ||
})) | ||
return invalidFGErr |
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.
I think we only return updateErr here. It is not necessary to return invalidErr, since backoff does not help here, right? It may need some doc here also.
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.
I think we only return updateErr here. It is not necessary to return invalidErr, since backoff does not help here, right? It may need some doc here also.
👌🏻
…onfiguration is nil Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
8b368b0
to
9d957ce
Compare
@@ -47,7 +47,13 @@ spec: | |||
- "agent" | |||
- "--cluster-name={{ .ClusterName }}" | |||
- "--bootstrap-kubeconfig=/spoke/bootstrap/kubeconfig" | |||
{{ if gt (len .RegistrationFeatureGates) 0 }} |
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.
@qiujian16 I have check len(RegistrationFeatureGates) ,if equal 0, using original setting
@qiujian16 I have changed by your advices, plz review again. |
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.
nit comment. Other looks good.
/approve
I think we should add some integration tests to check whether the condition is returned correctly with invalid features. Not a blocker for this one, but could be in a followup PR,
registrationConfiguration: | ||
featureGates: | ||
- feature: DefaultClusterSet | ||
mode: Enable |
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.
eof
registrationConfiguration: | ||
featureGates: | ||
- feature: AddonManagement | ||
mode: Enable |
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.
eof
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ivan-cai, qiujian16 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 |
Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
@ivan-cai: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
@ivan-cai: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
@qiujian16 I have fix some errors in unit test, plz review again. Thank you very much! |
@ivan-cai two small nit comment. PTAL again and we are good to go! Thanks! |
@qiujian16 Yes, I see, I will add more integration tests in a followup PR. Could you merge this PR? |
ah, sorry, I think I forgot to push the comment...I think you would also need to add default feature gates for registration webhooks and also this one #230 (comment). |
Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
@qiujian16 I have add feature gates for egistration webhook, plz review again. |
/lgtm FYI @zhiweiyin318 I think this pr is pretty careful to avoid any regression failure, but we still need to monitor it |
This PR is depend on the PR in api open-cluster-management-io/api#149, must modifying go.mod and updating vendor afeter api pr 149 is merged
reconcile
hubRegistrationFeatureGates
andspokeRegistrationFeatureGates
to registration deployment()Signed-off-by: ivan-cai caijing.cai@alibaba-inc.com