Skip to content

Commit a3a0f64

Browse files
committed
feat: Support AL2023 for EKS clusters
1 parent 7a29de5 commit a3a0f64

File tree

27 files changed

+935
-141
lines changed

27 files changed

+935
-141
lines changed

api/external/sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2/network_types.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
"sort"
2222
"time"
2323

24-
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
2524
"github.com/aws/aws-sdk-go/aws"
25+
"github.com/aws/aws-sdk-go/service/ec2"
2626
"k8s.io/utils/ptr"
2727
)
2828

@@ -207,14 +207,6 @@ type TargetGroupAttribute string
207207
var (
208208
// TargetGroupAttributeEnablePreserveClientIP defines the attribute key for enabling preserve client IP.
209209
TargetGroupAttributeEnablePreserveClientIP = "preserve_client_ip.enabled"
210-
211-
// TargetGroupAttributeEnableConnectionTermination defines the attribute key for terminating
212-
// established connections to unhealthy targets.
213-
TargetGroupAttributeEnableConnectionTermination = "target_health_state.unhealthy.connection_termination.enabled"
214-
215-
// TargetGroupAttributeUnhealthyDrainingIntervalSeconds defines the attribute key for the
216-
// unhealthy target connection draining interval.
217-
TargetGroupAttributeUnhealthyDrainingIntervalSeconds = "target_health_state.unhealthy.draining_interval_seconds"
218210
)
219211

220212
// LoadBalancerAttribute defines a set of attributes for a V2 load balancer.
@@ -667,11 +659,11 @@ func (s *SubnetSpec) IsEdgeWavelength() bool {
667659
}
668660

669661
// SetZoneInfo updates the subnets with zone information.
670-
func (s *SubnetSpec) SetZoneInfo(zones []types.AvailabilityZone) error {
671-
zoneInfo := func(zoneName string) *types.AvailabilityZone {
662+
func (s *SubnetSpec) SetZoneInfo(zones []*ec2.AvailabilityZone) error {
663+
zoneInfo := func(zoneName string) *ec2.AvailabilityZone {
672664
for _, zone := range zones {
673665
if aws.StringValue(zone.ZoneName) == zoneName {
674-
return &zone
666+
return zone
675667
}
676668
}
677669
return nil
@@ -826,7 +818,7 @@ func (s Subnets) GetUniqueZones() []string {
826818
}
827819

828820
// SetZoneInfo updates the subnets with zone information.
829-
func (s Subnets) SetZoneInfo(zones []types.AvailabilityZone) error {
821+
func (s Subnets) SetZoneInfo(zones []*ec2.AvailabilityZone) error {
830822
for i := range s {
831823
if err := s[i].SetZoneInfo(zones); err != nil {
832824
return err

api/external/sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/api/v1beta2/eksconfig_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,20 @@ import (
2222
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2323
)
2424

25+
// NodeType specifies the type of nodeq
26+
// +kubebuilder:validation:Enum=al2023
27+
type NodeType string
28+
29+
const (
30+
// NodeTypeAL2023 represents the AL2023 node type.
31+
NodeTypeAL2023 NodeType = "al2023"
32+
)
33+
2534
// EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration.
2635
type EKSConfigSpec struct {
36+
// NodeType specifies the type of node (e.g., "al2023")
37+
// +optional
38+
NodeType NodeType `json:"nodeType,omitempty"`
2739
// KubeletExtraArgs passes the specified kubelet args into the Amazon EKS machine bootstrap script
2840
// +optional
2941
KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ replace github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/c
1111

1212
require (
1313
github.com/aws/aws-sdk-go v1.55.8
14-
github.com/aws/aws-sdk-go-v2/service/ec2 v1.240.0
1514
github.com/aws/aws-sdk-go-v2/service/eks v1.69.0
1615
github.com/blang/semver/v4 v4.0.0
1716
github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common v0.7.0
@@ -47,6 +46,7 @@ require (
4746
github.com/google/go-cmp v0.7.0 // indirect
4847
github.com/google/gofuzz v1.2.0 // indirect
4948
github.com/google/uuid v1.6.0 // indirect
49+
github.com/jmespath/go-jmespath v0.4.0 // indirect
5050
github.com/josharian/intern v1.0.0 // indirect
5151
github.com/json-iterator/go v1.1.12 // indirect
5252
github.com/mailru/easyjson v0.7.7 // indirect

api/go.sum

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ=
22
github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
3-
github.com/aws/aws-sdk-go-v2/service/ec2 v1.240.0 h1:/NUzag+6BGBNvM7FEHDsDK8itSgWEUVhmC2HDBR8NrM=
4-
github.com/aws/aws-sdk-go-v2/service/ec2 v1.240.0/go.mod h1:HDxGArx3/bUnkoFsuvTNIxEj/cR3f+IgsVh1B7Pvay8=
53
github.com/aws/aws-sdk-go-v2/service/eks v1.69.0 h1:eiZOCsKGl0D7M3FSeSJwJbsikxowCMVz513WDFCe6HY=
64
github.com/aws/aws-sdk-go-v2/service/eks v1.69.0/go.mod h1:u3CDoNUAkSIGKNiA6LfQtApPmHPGRuAjikx3ObM5XBs=
75
github.com/aws/smithy-go v1.22.5 h1:P9ATCXPMb2mPjYBgueqJNCA5S9UfktsW0tTxi+a7eqw=
@@ -62,6 +60,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
6260
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
6361
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
6462
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
63+
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
64+
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
6565
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
6666
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
6767
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@@ -184,6 +184,9 @@ gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSP
184184
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
185185
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
186186
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
187+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
188+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
189+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
187190
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
188191
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
189192
k8s.io/api v0.32.8 h1:PhuKPnqsaXYuwmLXRLAmdDJ9EZ2R2kEbOZTq4UE3lGc=

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ spec:
8989
default: m5.2xlarge
9090
description: The AWS instance type to use for the cluster Machines.
9191
type: string
92+
nodeType:
93+
description: |-
94+
nodeType specifies the node type to use for the node. This affects the bootstrap format created
95+
for the node. If `nodeType` is specified as `al2023`, the bootstrap format will be `nodeadm`, otherwise
96+
the format will be `cloud-init`.
97+
enum:
98+
- al2023
99+
type: string
92100
placementGroup:
93101
description: PlacementGroup specifies the placement group in which
94102
to launch the instance.

api/v1alpha1/nodeconfig_types.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,23 @@ func (s EKSWorkerNodeConfig) VariableSchema() clusterv1.VariableSchema { //nolin
136136
// Otherwise, it should go into the ClusterConfigSpec.
137137
type EKSWorkerNodeConfigSpec struct {
138138
// +kubebuilder:validation:Optional
139-
EKS *AWSWorkerNodeSpec `json:"eks,omitempty"`
139+
EKS *EKSWorkerNodeSpec `json:"eks,omitempty"`
140140

141-
EKSNodeSpec `json:",inline"`
141+
EKSGenericNodeSpec `json:",inline"`
142142
}
143143

144-
type EKSNodeSpec struct {
144+
type EKSWorkerNodeSpec struct {
145+
AWSWorkerNodeSpec `json:",inline"`
146+
147+
// nodeType specifies the node type to use for the node. This affects the bootstrap format created
148+
// for the node. If `nodeType` is specified as `al2023`, the bootstrap format will be `nodeadm`, otherwise
149+
// the format will be `cloud-init`.
150+
// +kubebuilder:validation:Optional
151+
// +kubebuilder:validation:Enum:=al2023
152+
NodeType string `json:"nodeType,omitempty"`
153+
}
154+
155+
type EKSGenericNodeSpec struct {
145156
// Taints specifies the taints the Node API object should be registered with.
146157
// +kubebuilder:validation:Optional
147158
Taints []Taint `json:"taints,omitempty"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 22 additions & 6 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type WorkerNodeConfigSpec struct {
5050

5151
Nutanix *carenv1.NutanixWorkerNodeSpec `json:"nutanix,omitempty"`
5252

53-
EKS *carenv1.AWSWorkerNodeSpec `json:"eks,omitempty"`
53+
EKS *carenv1.EKSWorkerNodeSpec `json:"eks,omitempty"`
5454

5555
carenv1.GenericNodeSpec `json:",inline"`
5656
}

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/eks-cluster-class.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ metadata:
8787
spec:
8888
template:
8989
spec:
90+
instanceMetadataOptions:
91+
httpPutResponseHopLimit: 2
92+
httpTokens: required
9093
instanceType: PLACEHOLDER
9194
sshKeyName: ""
9295
---

0 commit comments

Comments
 (0)