-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
don't start the cloud node controller if cloudprovider.Instances is not supported #82329
Conversation
Hi @m3ngyang. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @andrewsykim |
) | ||
if err != nil { | ||
klog.Warningf("failed to start cloud node controller: %s", err) | ||
return nil, false, err |
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.
To be consistent with the other controllers here, I think this should be
return nil, false, nil
Otherwise the entire process exits on err.
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.
Please make it consistent with other controllers as this will be important for future work making the controller initialization generic.
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.
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.
minor comment, lgtm otherwise :)
/assign @cheftako |
} | ||
|
||
if cloud == nil { | ||
return nil, errors.New("no cloud provider provided") |
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.
Something has gone very wrong to get here. Failure to init the cloud provider in the CCM is a fatal error...
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.
Yes, cloud
has been checked before passing to the constructor, and kubeClient
is created by ctx.ClientBuilder.ClientOrDie("node-controller")
kubernetes/pkg/controller/client_builder.go
Lines 81 to 87 in 3a50184
func (b SimpleControllerClientBuilder) ClientOrDie(name string) clientset.Interface { | |
client, err := b.Client(name) | |
if err != nil { | |
klog.Fatal(err) | |
} | |
return client | |
} |
so, we don't need to check cloud
and kubeClient
in the controller initializers.
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.
Agree we probably don't need those checks but probably doesn't hurt to keep them
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.
emmm, I think it could be viewed as a cleanup for codes. There are many controllers consist of cloud
and kubeClient
, we don't need to check them every time.
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.
Fine with me :)
5086981
to
c287ca1
Compare
/ok-to-test |
|
||
eventBroadcaster := record.NewBroadcaster() | ||
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "cloud-node-controller"}) | ||
eventBroadcaster.StartLogging(klog.Infof) | ||
if kubeClient != 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.
Let's add a cloud.Instances() check similar to NewCloudNodeLifecycleController
?
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.
It sounds good.
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.
cloud.Instances()
has been added.
c287ca1
to
a480f03
Compare
/retitle don't start the cloud node controller if cloudprovider.Instances is not supported |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim, m3ngyang 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 |
/priority important-longterm |
/test pull-kubernetes-integration |
/retest Review the full test history for this PR. Silence the bot with an |
1 similar comment
/retest Review the full test history for this PR. Silence the bot with an |
a480f03
to
b463851
Compare
I made a mistake about |
/lgtm |
Would this pr be included in 1.16? @andrewsykim |
I think this is more a sanity check then it is a bug so I don't think we need to push this to v1.16, what do you think? |
It makes sense. This pr can be merged after releasing 1.16. |
/lgtm |
What type of PR is this?
/kind bug
/kind cleanup
What this PR does / why we need it:
There are some tiny bugs in the cloud node controller:
node_controller
doesn't checkcloud
,kubeClient
before using them.node_lifecycle_controller
checkskubeClient
after using it.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: