aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

Cannot set the IPv6 addresses in dualstack mode during modification

Open witalisoft opened this issue 1 year ago • 4 comments

Describe the bug

Changing the IP Address Type to dualstack (via annotation service.beta.kubernetes.io/aws-load-balancer-ip-address-type) with a provided list of IPv6 addresses (via annotation service.beta.kubernetes.io/aws-load-balancer-ipv6-addresses) is not being reflected (still using the randomly selected IP from IPv6 range). AWS Console gives the option to specify the IPv6 address. Creating instead of modifying the LoadBalancer, which works as expected.

Steps to reproduce

Initial Kubernetes service specification:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-name: test
    service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
    service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
    service.beta.kubernetes.io/aws-load-balancer-type: external
  name: test
spec:
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https
  selector:
    app.kubernetes.io/name: kubernetes-ingress
  type: LoadBalancer

Migration to dualstack mode with specified IPv6 addresses

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-ip-address-type: dualstack
    service.beta.kubernetes.io/aws-load-balancer-ipv6-addresses: <list of IPv6 addresses>
    service.beta.kubernetes.io/aws-load-balancer-name: test
    service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
    service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
    service.beta.kubernetes.io/aws-load-balancer-type: external
  name: test
spec:
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https
  selector:
    app.kubernetes.io/name: kubernetes-ingress
  type: LoadBalancer

Expected outcome

IPv6 addresses specified in annotation service.beta.kubernetes.io/aws-load-balancer-ipv6-addresses should be taken in a dualstack mode.

Environment

  • AWS Load Balancer controller version

2.8.0

  • Kubernetes version

v1.27

  • Using EKS (yes/no), if so version?

v1.27.13-eks-3af4770

Additional Context:

I haven't found any references during the update process to make it possible - https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/pkg/deploy/elbv2/load_balancer_manager.go#L88

witalisoft avatar Jun 14 '24 07:06 witalisoft

Thanks for bringing this to our attention. We are currently working to reproduce this issue on our end

ChuksGrinage avatar Jun 19 '24 23:06 ChuksGrinage

I can reproduce this issue. The reason the specified IPv6 address is not set because we are only checking subnetID to determine if we need to update SubnetMappings, we also need to check IPv6Address updates.

wweiwei-li avatar Jun 24 '24 02:06 wweiwei-li

Hi @wweiwei-li , I would like to take this up if this is a good first issue for a newbie :)

parambath92 avatar Jun 25 '24 20:06 parambath92

@parambath92 That would be great. Thanks for your contribution.

wweiwei-li avatar Jun 26 '24 22:06 wweiwei-li

Hey @witalisoft , I took another look at this issue. I think it is not a bug. Apologies for any confusion earlier.

You cannot change the IPv6 address for existing subnets. Otherwise, you will get an API error. AWS Console gives the option to specify the IPv6 address. I think that's because you are adding a new subnet. As for controller, if you add a new subnet, the subnet mapping will be updated as well since the SubnetIDs are changed (a new subnetID is added)

Please let me know if you have any questions.

wweiwei-li avatar Nov 05 '24 00:11 wweiwei-li

Hello @wweiwei-li, you cannot change the address IPv6, when it is already been defined. The only option is to set the IPv6 address when changing the Load balancer IP address type ie. from IPv4 to dualstack, can this path be implemented ?

witalisoft avatar Nov 13 '24 12:11 witalisoft

@wweiwei-li ping

witalisoft avatar Nov 22 '24 09:11 witalisoft

@witalisoft Yeah, I think allowing the setting of IPv6 address when changing Load balancer IP address type to dualstack is a valid case. I can work on a fix.

wweiwei-li avatar Nov 27 '24 03:11 wweiwei-li

@wweiwei-li The PR was merged. Are there any blockers to close this issue?

witalisoft avatar Jan 17 '25 09:01 witalisoft

@witalisoft Hey, No, we can close it. This PR was merged and will be included in an upcoming release. Thanks for waiting.

wweiwei-li avatar Jan 21 '25 17:01 wweiwei-li