Skip to content

Only start CloudNodeController when nessesary#261

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
adrianmoisey:node-controller
Jul 9, 2025
Merged

Only start CloudNodeController when nessesary#261
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
adrianmoisey:node-controller

Conversation

@adrianmoisey

@adrianmoisey adrianmoisey commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

Only start the CloudNodeController when the cloud provider taint exists on any node.

Fixes #260

I don't really know if this is the right solution. Happy to take suggestions.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 7, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 7, 2025
Comment thread pkg/controller/controller.go Outdated
klog.Fatalf("error getting node: %v", err)
cancel()
}
_, exists := node.ObjectMeta.Annotations[cloudproviderapi.AnnotationAlphaProvidedIPAddr]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this annotation is to publish the ip set by the --node-ip flag, I do not know if we can depend on that convention for kind clusters, I think we always set it now, but we may not do it in the future

Comment thread pkg/controller/controller.go Outdated
Comment on lines +234 to +239
clustersInterface, ok := cloud.Clusters()
if !ok {
klog.Fatalf("Unable to use clusters interface: %v", err)
}

masterName, err := clustersInterface.Master(ctx, clusterName)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This seems overly complicated to get the masterName. I could change it to:

masterName := clusterName+'-control-plane'

Thoughts?

Comment thread pkg/controller/controller.go Outdated
klog.Fatalf("Unable to use clusters interface: %v", err)
}

masterName, err := clustersInterface.Master(ctx, clusterName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you need to identify the need of this controller by the Taint https://github.com/kubernetes/kubernetes/blob/3d13f39f24e5533286278f04702c69fbed448c35/staging/src/k8s.io/cloud-provider/controllers/node/node_controller.go#L277C1-L278C1

just create a function that gets the clientset and list all the nodes and returns tur if any of the nodes has the cloud provider taint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only start the CloudNodeController when the cloud provider taint exists
on any node
@aojea

aojea commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

is this working fine now ? have yout tested it?

@adrianmoisey

Copy link
Copy Markdown
Contributor Author

is this working fine now ? have yout tested it?

I've tested the "default" case (where the taint doesn't exist, and CloudNodeController is not started).
I haven't tested the case where the taint is present. I need to figure out how to get kind to do that.

@aojea

aojea commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

I haven't tested the case where the taint is present. I need to figure out how to get kind to do that.

@adrianmoisey https://github.com/kubernetes-sigs/cloud-provider-kind/blob/main/kind.yaml

@adrianmoisey

Copy link
Copy Markdown
Contributor Author

Perfect, thanks! I'll give it a more thorough test

@aojea

aojea commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrianmoisey, aojea

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2025
@k8s-ci-robot k8s-ci-robot merged commit bdf1655 into kubernetes-sigs:main Jul 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud-provider-kind handling IPs differently to kubelet in Docker

3 participants