Skip to content

Commit 58197d6

Browse files
authored
feat: deploy AWS Load Balancer controller in EKS clusters (#1341)
**What problem does this PR solve?**: Add support for deploying https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/. While we work on finalizing the API, the handler will always deploy the controller in EKS clusters. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> Deployed a Deployment and Service ``` $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE cluster-autoscaler-0199bac8-d50f-7889-bbd8-fab1f853bd7c ClusterIP 172.20.53.99 <none> 8085/TCP 22m kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 24m test-app LoadBalancer 172.20.90.40 k8s-default-testapp-038ab69da9-08a89fe0eeadfd48.elb.us-west-2.amazonaws.com 80:30577/TCP 3m50s $ curl http://k8s-default-testapp-038ab69da9-08a89fe0eeadfd48.elb.us-west-2.amazonaws.com NOW: 2025-10-06 19:01:55.459707791 +0000 UTC m=+234.997554945 ``` ``` apiVersion: apps/v1 kind: Deployment metadata: name: test-app namespace: default spec: replicas: 1 selector: matchLabels: app: test-app template: metadata: labels: app: test-app spec: containers: - name: test-app image: k8s.gcr.io/e2e-test-images/agnhost:2.33 args: - netexec - --http-port=8080 ports: - name: http containerPort: 8080 --- apiVersion: v1 kind: Service metadata: name: test-app namespace: default annotations: service.beta.kubernetes.io/aws-load-balancer-scheme: internal spec: type: LoadBalancer selector: app: test-app ports: - name: http port: 80 protocol: TCP targetPort: 8080 loadBalancerClass: service.k8s.aws/nlb ``` **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent cdc3963 commit 58197d6

File tree

24 files changed

+595
-40
lines changed

24 files changed

+595
-40
lines changed

api/v1alpha1/addon_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const (
2929

3030
RegistryProviderCNCFDistribution = "CNCF Distribution"
3131

32+
IngressProviderAWSLoadBalancerController = "aws-lb-controller"
33+
3234
AddonStrategyClusterResourceSet AddonStrategy = "ClusterResourceSet"
3335
AddonStrategyHelmAddon AddonStrategy = "HelmAddon"
3436

@@ -65,6 +67,9 @@ type AWSAddons struct {
6567

6668
// +kubebuilder:validation:Optional
6769
CSI *AWSCSI `json:"csi,omitempty"`
70+
71+
// +kubebuilder:validation:Optional
72+
Ingress *Ingress `json:"ingress,omitempty"`
6873
}
6974

7075
type DockerAddons struct {
@@ -359,3 +364,10 @@ type RegistryAddon struct {
359364
// +kubebuilder:validation:Enum="CNCF Distribution"
360365
Provider string `json:"provider"`
361366
}
367+
368+
type Ingress struct {
369+
// The Ingress provider to deploy.
370+
// +kubebuilder:validation:Required
371+
// +kubebuilder:validation:Enum="aws-lb-controller"
372+
Provider string `json:"provider"`
373+
}

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ spec:
226226
- defaultStorage
227227
- providers
228228
type: object
229+
ingress:
230+
properties:
231+
provider:
232+
description: The Ingress provider to deploy.
233+
enum:
234+
- aws-lb-controller
235+
type: string
236+
required:
237+
- provider
238+
type: object
229239
nfd:
230240
description: NFD tells us to enable or disable the node feature discovery addon.
231241
properties:

api/v1alpha1/crds/caren.nutanix.com_eksclusterconfigs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ spec:
228228
- defaultStorage
229229
- providers
230230
type: object
231+
ingress:
232+
properties:
233+
provider:
234+
description: The Ingress provider to deploy.
235+
enum:
236+
- aws-lb-controller
237+
type: string
238+
required:
239+
- provider
240+
type: object
231241
nfd:
232242
description: NFD tells us to enable or disable the node feature discovery addon.
233243
properties:

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/variables/aggregate_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ type Addons struct {
6666
CSI *CSI `json:"csi,omitempty"`
6767

6868
COSI *COSI `json:"cosi,omitempty"`
69+
70+
Ingress *Ingress `json:"ingress,omitempty"`
6971
}
7072

7173
type CSI struct {
@@ -77,3 +79,7 @@ type CSI struct {
7779
type COSI struct {
7880
carenv1.GenericCOSI `json:",inline"`
7981
}
82+
83+
type Ingress struct {
84+
carenv1.Ingress `json:",inline"`
85+
}

charts/cluster-api-runtime-extensions-nutanix/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
8888
| hooks.csi.nutanix.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-nutanix-csi-helm-values-template"` | |
8989
| hooks.csi.snapshot-controller.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
9090
| hooks.csi.snapshot-controller.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-snapshot-controller-helm-values-template"` | |
91+
| hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.create | bool | `true` | |
92+
| hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.name | string | `"default-aws-load-balancer-controller-helm-values-template"` | |
9193
| hooks.nfd.crsStrategy.defaultInstallationConfigMap.name | string | `"node-feature-discovery"` | |
9294
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
9395
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-nfd-helm-values-template"` | |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The clusterName refers the kubernetes.io/cluster/ tag on AWS resources.
2+
# For EKS clusters, the name will be based on the cluster's namespace + a random suffix.
3+
# For AWS clusters, the name will just be based on the cluster name.
4+
{{- $capiProvider := index .Cluster.metadata.labels "cluster.x-k8s.io/provider" }}
5+
{{- if eq $capiProvider "eks" }}
6+
clusterName: "{{ .ControlPlane.spec.eksClusterName }}"
7+
{{- else }}
8+
clusterName: "{{ .Cluster.metadata.name }}"
9+
{{- end }}
10+
# Set this value to avoid stutter in the resource names.
11+
fullnameOverride: aws-load-balancer-controller
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
{{- if .Values.hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.create }}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: '{{ .Values.hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.name }}'
9+
data:
10+
values.yaml: |-
11+
{{- .Files.Get "addons/aws-load-balancer-controller/values-template.yaml" | nindent 4 }}
12+
{{- end -}}

charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ data:
1515
ChartName: aws-ebs-csi-driver
1616
ChartVersion: 2.51.0
1717
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/aws-ebs-csi-driver{{ end }}'
18+
aws-load-balancer-controller: |
19+
ChartName: aws-load-balancer-controller
20+
ChartVersion: 1.13.4
21+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://aws.github.io/eks-charts{{ end }}'
1822
cilium: |
1923
ChartName: cilium
2024
ChartVersion: 1.18.2

charts/cluster-api-runtime-extensions-nutanix/values.schema.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,27 @@
499499
}
500500
}
501501
},
502+
"ingress": {
503+
"type": "object",
504+
"properties": {
505+
"awsLoadBalancerController": {
506+
"type": "object",
507+
"properties": {
508+
"defaultValueTemplateConfigMap": {
509+
"type": "object",
510+
"properties": {
511+
"create": {
512+
"type": "boolean"
513+
},
514+
"name": {
515+
"type": "string"
516+
}
517+
}
518+
}
519+
}
520+
}
521+
}
522+
},
502523
"nfd": {
503524
"type": "object",
504525
"properties": {

0 commit comments

Comments
 (0)