Skip to content

Controller leaks Load Balancer when Service annotation service.beta.kubernetes.io/aws-load-balancer-type is added/removed #1254

@mtulio

Description

@mtulio

What happened:

The controller is leaking load balancers when the annotation service.beta.kubernetes.io/aws-load-balancer-type is updated (added or removed). This is not something usual, but it's a valid user flow that can lead to unexpected leaked resources.

Scenarios:

    1. Given a Service created without annotation service.beta.kubernetes.io/aws-load-balancer-type, then updated to the annotation service.beta.kubernetes.io/aws-load-balancer-type=nlb, a NLB will be created, and CLB will be leaked (and it's SGs)
    1. Given a Service created with annotation service.beta.kubernetes.io/aws-load-balancer-type=nlb, then the annotation is removed, the controller will create a CLB and leak the NLB

What you expected to happen:

Options to discuss with community:

  • Controller should not create a new load balancer when the annotation service.beta.kubernetes.io/aws-load-balancer-type is added or removed from existing services which already have load balancers
  • Controller should "recreate" (e.g. delete CLB and add NLB) when the annotation is service.beta.kubernetes.io/aws-load-balancer-type

How to reproduce it (as minimally and precisely as possible):

CLB leak:

  1. Create a Service (without annotation service.beta.kubernetes.io/aws-load-balancer-type
  2. Add the annotation service.beta.kubernetes.io/aws-load-balancer-type=nlb
  3. Check in the AWS console that the NLB has been created
  4. Check in the AWS Console that the CLB has been leaked

Anything else we need to know?:

What is the expected option/behavior in this case considering there is no validation webhook available in CCM?

Environment:

  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

/kind bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions