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

support hubRegistrationFeatureGates and spokeRegistrationFeatureGates #230

Conversation

ivan-cai
Copy link
Contributor

@ivan-cai ivan-cai commented Apr 1, 2022

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 and spokeRegistrationFeatureGates to registration deployment()

Signed-off-by: ivan-cai caijing.cai@alibaba-inc.com


func FeatureGatesArgs(featureGates []string) []string {
var featureGatesArgs []string
for _, featureGate := range featureGates {
Copy link
Member

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.

Copy link
Member

@qiujian16 qiujian16 left a 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!

@ivan-cai
Copy link
Contributor Author

ivan-cai commented Jun 6, 2022

@ivan-cai would you like to rebase this PR thanks!
ok👌🏻

@ivan-cai ivan-cai force-pushed the support_registration_featuregates branch from b8a1d95 to dd81e89 Compare June 7, 2022 06:42
@ivan-cai ivan-cai force-pushed the support_registration_featuregates branch 5 times, most recently from f5443c6 to 2f617c3 Compare June 7, 2022 06:53
ComponentHubKey = "hub"
ComponentSpokeKey = "spoke"

ClusterClaim featuregate.Feature = "ClusterClaim"
Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

@ivan-cai ivan-cai Jun 8, 2022

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

Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
@ivan-cai ivan-cai force-pushed the support_registration_featuregates branch from d3f1932 to a0c9a3b Compare June 8, 2022 04:11
@ivan-cai
Copy link
Contributor Author

ivan-cai commented Jun 9, 2022

@qiujian16 Plz review again. I have changed to use api repo's variables DefaultHubRegistrationFeatureGates & DefaultSpokeRegistrationFeatureGates to check registration if valid.

@ivan-cai
Copy link
Contributor Author

@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>
@ivan-cai ivan-cai force-pushed the support_registration_featuregates branch from cf83db8 to 456389c Compare June 13, 2022 03:13
@ivan-cai ivan-cai requested a review from qiujian16 June 13, 2022 03:22
Copy link
Member

@qiujian16 qiujian16 left a 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
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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>
@ivan-cai ivan-cai force-pushed the support_registration_featuregates branch from 8b368b0 to 9d957ce Compare June 14, 2022 02:47
@@ -47,7 +47,13 @@ spec:
- "agent"
- "--cluster-name={{ .ClusterName }}"
- "--bootstrap-kubeconfig=/spoke/bootstrap/kubeconfig"
{{ if gt (len .RegistrationFeatureGates) 0 }}
Copy link
Contributor Author

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

@ivan-cai
Copy link
Contributor Author

@qiujian16 I have changed by your advices, plz review again.

Copy link
Member

@qiujian16 qiujian16 left a 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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

eof

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: ivan-cai <caijing.cai@alibaba-inc.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2022

@ivan-cai: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test

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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2022

@ivan-cai: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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
Copy link
Contributor Author

@qiujian16 I have fix some errors in unit test, plz review again. Thank you very much!

@qiujian16
Copy link
Member

@ivan-cai two small nit comment. PTAL again and we are good to go! Thanks!

@ivan-cai
Copy link
Contributor Author

@qiujian16 Yes, I see, I will add more integration tests in a followup PR. Could you merge this PR?

@qiujian16
Copy link
Member

qiujian16 commented Jun 15, 2022

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>
@ivan-cai
Copy link
Contributor Author

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).

@qiujian16 I have add feature gates for egistration webhook, plz review again.

@qiujian16
Copy link
Member

/lgtm

FYI @zhiweiyin318 I think this pr is pretty careful to avoid any regression failure, but we still need to monitor it

@openshift-ci openshift-ci bot added the lgtm label Jun 22, 2022
@openshift-ci openshift-ci bot merged commit 3401c8e into open-cluster-management-io:main Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants