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

Give each kops-controller controller unique names #16812

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

rifelpet
Copy link
Member

@rifelpet rifelpet commented Sep 6, 2024

This makes progress on fixing ipv6 support.

For IPV6 clusters we enable an ipam controller in kops-controller:

func (c *ClusterSpec) IsKopsControllerIPAM() bool {
return c.IsIPv6Only()
}

if cluster.Spec.IsKopsControllerIPAM() {
config.EnableCloudIPAM = true
}

if opt.EnableCloudIPAM {
if err := setupCloudIPAM(ctx, mgr, &opt); err != nil {
setupLog.Error(err, "unable to setup cloud IPAM")
os.Exit(1)
}
}

controller-runtime's manager picks "names" for each controller it manages, and defaults to the kind it watches:

https://github.com/kubernetes-sigs/controller-runtime/blob/38546806f2faf5973e3321a7bd5bb3afdbb5767d/pkg/builder/controller.go#L247-L257

This means that alongside the node bootstrap controller, there are multiple controllers watching nodes. This results in a conflict which causes kops-controller to crash loop:

I0906 00:17:26.074975       1 main.go:373] "msg"="enabling IPAM controller" "logger"="setup"
I0906 00:17:26.075026       1 awsipam.go:47] Starting aws ipam controller
E0906 00:17:26.077961       1 main.go:230] "msg"="unable to create controller" "error"="controller with name node already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric" "controller"="NodeController" "logger"="setup"

This PR gives each controller a unique name to avoid the conflict.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 6, 2024
@k8s-ci-robot k8s-ci-robot requested a review from zetaab September 6, 2024 00:36
@justinsb
Copy link
Member

justinsb commented Sep 6, 2024

/approve
/lgtm

(We discussed in office hours, this uniqueness requirement was introduced in kubernetes-sigs/controller-runtime@2b94165 )

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 6, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9666e6f into kubernetes:master Sep 6, 2024
23 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone Sep 6, 2024
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. area/kops-controller 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants