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

feat: add AWS Global Accelerator support

Open taylorsmithgg opened this issue 4 months ago • 12 comments

What this PR does / why we need it

This PR implements comprehensive AWS Global Accelerator support for the AWS Load Balancer Controller, addressing the feature request in issue #1572.

AWS Global Accelerator is a networking service that improves the performance of your users' traffic by up to 60% using Amazon Web Services' global network infrastructure. This implementation allows Kubernetes users to create and manage Global Accelerators through native Kubernetes resources.

Which issue(s) this PR fixes

Fixes #1572

Key Features

  • Complete CRD Implementation: New GlobalAccelerator Custom Resource Definition with comprehensive spec and status fields
  • Multi-Region Support: Configure endpoint groups across different AWS regions with traffic dial control
  • Service Integration: Automatic endpoint discovery from Kubernetes LoadBalancer services
  • Protocol Support: TCP and UDP protocols with configurable port ranges
  • Health Checks: Configurable health check settings for endpoint groups
  • Validation: Comprehensive webhook validation for all configuration aspects
  • Traffic Control: Traffic dial percentage for gradual traffic shifting between regions
  • Port Overrides: Route traffic to different ports on endpoints

Implementation Details

  • Controller: Full reconciliation logic with create, update, delete operations and proper finalizer handling
  • AWS SDK Integration: Complete integration with AWS SDK v2 Global Accelerator service
  • Webhook Validation: Input validation for listeners, endpoint groups, and service endpoints
  • RBAC: Updated permissions for Global Accelerator operations
  • Testing: Comprehensive unit tests for controller and webhook validator
  • Documentation: Complete user guide with examples and best practices

Testing

  • [x] Unit tests pass (make test)
  • [x] Code formatting and linting (make fmt, make vet)
  • [x] CRD generation works (make manifests)
  • [x] All existing tests continue to pass

Example Usage

apiVersion: elbv2.k8s.aws/v1beta1
kind: GlobalAccelerator
metadata:
  name: example-ga
spec:
  listeners:
    - protocol: "TCP"
      portRanges:
        - fromPort: 80
          toPort: 80
  endpointGroups:
    - region: "us-west-2"
      endpoints:
        - endpointID: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-alb/1234567890abcdef"

Documentation

  • Added comprehensive user guide: docs/guide/globalaccelerator/globalaccelerator.md
  • Added configuration examples: docs/examples/globalaccelerator.yaml
  • Includes IAM permissions, troubleshooting, and best practices

Files Changed

  • 20 files changed with 3,310 additions and 44 deletions
  • 9 new files created for the complete Global Accelerator implementation
  • Complete CRD with validation webhooks
  • Controller with full reconciliation logic
  • AWS SDK v2 integration
  • Service endpoint discovery
  • Comprehensive test coverage

Breaking Changes

None. This is a purely additive feature that doesn't affect existing functionality.

taylorsmithgg avatar Aug 20 '25 18:08 taylorsmithgg

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: taylorsmithgg / name: Taylor Smith (79ee771afe51fe37b67822e1dd4f8160a2bd33c8, 8ed6e92f9cccafd5fc35bfd5550cd4e4e5d6ca7f, 8f7071b675b2d61c3432222f7286274556e1c46e)

Welcome @taylorsmithgg!

It looks like this is your first PR to kubernetes-sigs/aws-load-balancer-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-load-balancer-controller has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Aug 20 '25 18:08 k8s-ci-robot

Hi @taylorsmithgg. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Aug 20 '25 18:08 k8s-ci-robot

/ok-to-test

shraddhabang avatar Aug 21 '25 17:08 shraddhabang

@taylorsmithgg Thank you for contributing this important feature. I will take a look at this. Please note that we will require an internal security review done on this before merging and releasing. I will handle that for you.

shraddhabang avatar Aug 21 '25 17:08 shraddhabang

@taylorsmithgg: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command pull-aws-load-balancer-controller-e2e-test 79ee771 link true /test pull-aws-load-balancer-controller-e2e-test Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

I investigated the automated test failure and found that the Gateway tests were actually being skipped, not failing. The tests are disabled by default in the CI environment.

I verified locally that the Gateway tests run properly with these Global Accelerator changes:

  • All Gateway API CRDs install correctly alongside the new GlobalAccelerator CRD
  • No conflicts with existing controller initialization or AWS service layers
  • Gateway resource creation works as expected (GatewayClass, LoadBalancerConfiguration, etc.)

The "failure" in CI occurs because:

  • Gateway tests require --enable-gateway-tests=true flag but default to false (test/framework/options.go:53)
  • Required Gateway API CRDs are not installed in the CI environment
  • When prerequisites are missing, the tests skip with [SKIPPED] Skipping gateway tests

Local verification steps:

Install project CRDs and Gateway API CRDs from our go.mod version

make install kubectl apply -f "$(go env GOMODCACHE)/sigs.k8s.io/[email protected]/config/crd/experimental"

Run Gateway tests

cd test/e2e/gateway && go test -enable-gateway-tests=true -cluster-name= -aws-region= -aws-vpc-id=

The Global Accelerator implementation is self-contained and doesn't modify any Gateway-related code paths, so there's no risk of breaking existing functionality.

taylorsmithgg avatar Aug 21 '25 21:08 taylorsmithgg

Hi. The gateway failures are actually skipped. It looks like the controller isn't starting up for the service tests (but weirdly enough runs fine for the ingress tests).

The controller isn't coming up because of this error:

{"level":"error","ts":"2025-08-21T20:10:46Z","logger":"controller-runtime.source.Kind","msg":"if kind is a CRD, it should be installed before calling Start","kind":"GlobalAccelerator.elbv2.k8s.aws","error":"no matches for kind \"GlobalAccelerator\" in version \"elbv2.k8s.aws/v1beta1\""}

It's because the new CRD wasn't added to the helm CRDs list: https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/helm/aws-load-balancer-controller/crds/crds.yaml (I thought we fixed the automation to generate in both places, sorry)

zac-nixon avatar Aug 22 '25 22:08 zac-nixon

Hi. The gateway failures are actually skipped. It looks like the controller isn't starting up for the service tests (but weirdly enough runs fine for the ingress tests).

The controller isn't coming up because of this error:

{"level":"error","ts":"2025-08-21T20:10:46Z","logger":"controller-runtime.source.Kind","msg":"if kind is a CRD, it should be installed before calling Start","kind":"GlobalAccelerator.elbv2.k8s.aws","error":"no matches for kind \"GlobalAccelerator\" in version \"elbv2.k8s.aws/v1beta1\""}

It's because the new CRD wasn't added to the helm CRDs list: https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/helm/aws-load-balancer-controller/crds/crds.yaml (I thought we fixed the automation to generate in both places, sorry)

I conducted my local testing using the CRDs from the project, as shown in my above comment. Let me know if there's anything I can do to help!

taylorsmithgg avatar Aug 22 '25 22:08 taylorsmithgg

To fix the e2e tests / have our helm users be happy can you add your new crd defintiion config/crd/bases/elbv2.k8s.aws_globalaccelerators.yaml to https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/helm/aws-load-balancer-controller/crds/crds.yaml :)

zac-nixon avatar Aug 22 '25 23:08 zac-nixon

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: taylorsmithgg Once this PR has been reviewed and has the lgtm label, please ask for approval from shraddhabang. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Aug 27 '25 00:08 k8s-ci-robot

Hi @taylorsmithgg ,

Thank you so much for taking the time and effort to contribute AGA support for LBC! We really appreciate you driving this initiative and submitting your work.

Your contribution has been extremely valuable as a Proof-of-Concept (POC). It has helped us confirm the feasibility and is a great foundation to build upon.

However, after reviewing it, we've determined that the implementation will need to be rewritten to be truly production-ready, specifically to cover the necessary testing, robustness, and comprehensive integration requirements.

Because the final version will be a significant reimplementation, we won't be merging your pull request as is.

I do, however, want to ensure your foundational work is properly recognized. I plan to incorporate the functional spirit of your initial POC, and I will be sure to credit your name as the original author of the concept in the commit history of the new implementation.

Thanks again for your valuable contribution. We look forward to seeing more of your work in the future!

Best regards, Shraddha.

shraddhabang avatar Oct 13 '25 22:10 shraddhabang

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Oct 14 '25 11:10 k8s-ci-robot