Skip to content

Conversation

@AshleyDumaine
Copy link
Contributor

There's currently a bug that leaves an orphaned NodeBalancer if a Service's type changes to no longer be LoadBalancer. If the type is changed back, a new NodeBalancer is created.
This PR detects a change in Service type and deletes the NodeBalancer if necessary.

e.g. when doing a kubectl edit on a Service to instead be a NodePort type:

I0521 14:43:02.423709       1 service_controller.go:61] ServiceController will handle service (test-ns2/test-svc) LoadBalancer deletion
I0521 14:43:02.423736       1 service_controller.go:111] ServiceController handling service (test-ns2/test-svc) deletion
I0521 14:43:02.424889       1 controller.go:969] Removing finalizer from service test-ns2/test-svc
I0521 14:43:02.425893       1 event.go:376] "Event occurred" object="test-ns2/test-svc" fieldPath="" kind="Service" apiVersion="v1" type="Normal" reason="Type" message="LoadBalancer -> NodePort"
I0521 14:43:02.431744       1 event.go:376] "Event occurred" object="test-ns2/test-svc" fieldPath="" kind="Service" apiVersion="v1" type="Normal" reason="DeletedLoadBalancer" message="Deleted load balancer"
I0521 14:43:02.527551       1 loadbalancers.go:498] found NodeBalancer (675801) for service (test-ns2/test-svc) via IPv4 (172.232.16.7)
I0521 14:43:02.668512       1 loadbalancers.go:471] successfully deleted NodeBalancer (675801) for service (test-ns2/test-svc)

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

@AshleyDumaine AshleyDumaine added the bugfix for any bug fixes in the changelog. label May 21, 2024
Copy link
Contributor

@rahulait rahulait left a comment

Choose a reason for hiding this comment

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

LGTM, works fine and lb ip gets deleted if service type is changed.

@AshleyDumaine AshleyDumaine merged commit 58731f5 into main May 21, 2024
@AshleyDumaine AshleyDumaine deleted the handle-type-change branch May 21, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants