aws-eks: hardcoded AWS LB Controller Helm chart version
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
When **not the latest CDK** version is used with **the most recent** version of the AWS Load Balancer Controller, incompatibility between the AWS Load Balancer Controller Helm chart version (hardcoded) and the AWS Load Balancer Controller Docker images is possible. As the result, the ALB controller does not work.
Concrete example:
- CDK version 2.28.1, implicitly uses AWS Load Balancer Controller Helm chart of version **1.2.7** - https://github.com/aws/aws-cdk/blob/v2.28.1/packages/@aws-cdk/aws-eks/lib/alb-controller.ts#L234
- AWS Load Balancer Controller version - `AlbControllerVersion.V2_4_1`
### Expected Behavior
Successfully create `Ingress` objects after deploying CDK stack with the EKS cluster and AWS Load Balancer Controller using the reproduction steps below.
### Current Behavior
After deploying CDK stack with the EKS cluster and AWS Load Balancer Controller, creating `Ingress` objects in the cluster would fail with `Internal error occurred: failed calling webhook "vingress.elbv2.k8s.aws": the server could not find the requested resource\n'`
### Reproduction Steps
- Clone https://github.com/zhukovsd/cdk-eks-alb-controller-bug-stack. The repo contains a CDK stack with an EKS cluster, ALB controller and an `Ingress` object
- Deploy with `npx cdk deploy`
- It'll fail with error `CREATE_FAILED`
```
1:30:01 AM | CREATE_FAILED | Custom::AWSCDK-EKS-KubernetesResource | ingress-manifest/Resource/Defau
lt
Received response status [FAILED] from custom resource. Message returned: Error: b'Error from server (Inter
nalError): error when creating "/tmp/manifest.yaml": Internal error occurred: failed calling webhook "vingr
ess.elbv2.k8s.aws": the server could not find the requested resource\n'
```
---
A separate branch `fix` has a more recent CDK version and, thus, a more recent Helm chart version. The following steps result in a successful deploy, which proves the point that the issue is in CDK and the Helm chart version:
- `git checkout fix`
- `npx cdk deploy`
- In the cluster - `kubectl get ingress -A` to see the created `Ingress`
### Possible Solution
I suggest removing the hardcoded Helm chart version and make it a part of [AlbControllerVersion](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-eks/lib/alb-controller.ts#L18) class. So this class would have the following fields:
- ALB controller version
- Helm chart version
Helm chart version would correspond to the ALB controller version. For instance, ALB controller 2.4.1 would use Helm chart 1.4.1 and so on, as `helm search repo eks-charts/aws-load-balancer-controller --versions` output suggests:
```
$ helm search repo eks-charts/aws-load-balancer-controller --versions
NAME CHART VERSION APP VERSION
eks-charts/aws-load-balancer-controller 1.4.1 v2.4.1
eks-charts/aws-load-balancer-controller 1.4.0 v2.4.0
```
As for the custom versions, created with `AlbControllerVersion.of()`, a user would supply both ALB controller version and Helm chart version.
### Additional Information/Context
_No response_
### CDK CLI Version
2.28.1 (build d035432)
### Framework Version
_No response_
### Node.js Version
v18.7.0
### OS
MacOS
### Language
Typescript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.