Skip to content

Commit 030ff25

Browse files
NicholasBlaskeyNikolay Kvetsinski
andauthored
support Al2023 on outposts (#8599)
--------- Co-authored-by: Nikolay Kvetsinski <[email protected]>
1 parent fe690c7 commit 030ff25

File tree

5 files changed

+57
-10
lines changed

5 files changed

+57
-10
lines changed

pkg/apis/eksctl.io/v1alpha5/outposts_validation_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,13 @@ var _ = Describe("Outposts validation", func() {
199199
},
200200
}, clusterConfig)
201201
if shouldFail {
202-
Expect(err).To(MatchError("only AmazonLinux2 is supported on local clusters"))
202+
Expect(err).To(MatchError("only AmazonLinux2 and AmazonLinux2023 is supported on local clusters"))
203203
} else {
204204
Expect(err).NotTo(HaveOccurred())
205205
}
206206
},
207207
Entry("AmazonLinux2", api.NodeImageFamilyAmazonLinux2, false),
208+
Entry("AmazonLinux2023", api.NodeImageFamilyAmazonLinux2, false),
208209
Entry("Bottlerocket", api.NodeImageFamilyBottlerocket, true),
209210
Entry("Ubuntu2004", api.NodeImageFamilyUbuntu2004, true),
210211
Entry("UbuntuPro2004", api.NodeImageFamilyUbuntuPro2004, true),

pkg/apis/eksctl.io/v1alpha5/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ func validateNodeGroupBase(np NodePool, path string, controlPlaneOnOutposts bool
757757
}
758758
return fmt.Errorf("AMI Family %s is not supported - use one of: %s", ng.AMIFamily, strings.Join(SupportedAMIFamilies(), ", "))
759759
}
760-
if controlPlaneOnOutposts && ng.AMIFamily != NodeImageFamilyAmazonLinux2 {
761-
return fmt.Errorf("only %s is supported on local clusters", NodeImageFamilyAmazonLinux2)
760+
if controlPlaneOnOutposts && (ng.AMIFamily != NodeImageFamilyAmazonLinux2 && ng.AMIFamily != NodeImageFamilyAmazonLinux2023) {
761+
return fmt.Errorf("only %s and %s is supported on local clusters", NodeImageFamilyAmazonLinux2, NodeImageFamilyAmazonLinux2023)
762762
}
763763
}
764764

pkg/nodebootstrap/al2023.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,24 @@ func (m *AL2023) createMinimalNodeConfig() (*nodeadm.NodeConfig, error) {
133133
serviceCIDR = clusterStatus.KubernetesNetworkConfig.ServiceIPv4CIDR
134134
}
135135

136+
clusterDetails := nodeadm.ClusterDetails{
137+
Name: m.cfg.Metadata.Name,
138+
APIServerEndpoint: clusterStatus.Endpoint,
139+
CertificateAuthority: clusterStatus.CertificateAuthorityData,
140+
CIDR: serviceCIDR,
141+
}
142+
if m.cfg.IsControlPlaneOnOutposts() {
143+
clusterDetails.ID = m.cfg.ID()
144+
clusterDetails.EnableOutpost = ptr(true)
145+
}
146+
136147
return &nodeadm.NodeConfig{
137148
TypeMeta: metav1.TypeMeta{
138149
Kind: nodeadmapi.KindNodeConfig,
139150
APIVersion: nodeadm.GroupVersion.String(),
140151
},
141152
Spec: nodeadm.NodeConfigSpec{
142-
Cluster: nodeadm.ClusterDetails{
143-
Name: m.cfg.Metadata.Name,
144-
APIServerEndpoint: clusterStatus.Endpoint,
145-
CertificateAuthority: clusterStatus.CertificateAuthorityData,
146-
CIDR: serviceCIDR,
147-
},
153+
Cluster: clusterDetails,
148154
Kubelet: kubeletOptions,
149155
},
150156
}, nil
@@ -171,3 +177,5 @@ func stringToNodeConfig(overrideBootstrapCommand string) (*nodeadm.NodeConfig, e
171177
}
172178
return &config, nil
173179
}
180+
181+
func ptr[T any](v T) *T { return &v }

pkg/nodebootstrap/al2023_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ type al2023Entry struct {
3030

3131
var _ = DescribeTable("Unmanaged AL2023", func(e al2023Entry) {
3232
cfg, dns := makeDefaultClusterSettings()
33+
if e.overrideClusterSettings != nil {
34+
e.overrideClusterSettings(cfg)
35+
}
3336
ng := api.NewNodeGroup()
3437
makeDefaultNPSettings(ng)
3538

@@ -56,6 +59,14 @@ var _ = DescribeTable("Unmanaged AL2023", func(e al2023Entry) {
5659
},
5760
expectedUserData: wrapMIMEParts(nodeConfig),
5861
}),
62+
Entry("control plane on Outposts", al2023Entry{
63+
overrideClusterSettings: func(cc *api.ClusterConfig) {
64+
cc.Outpost = &api.Outpost{
65+
ControlPlaneOutpostARN: "arn:aws:outposts:us-west-2:1234:outpost/op-1234",
66+
}
67+
cc.Status.ID = "51eaebb5-7e52-4e71-baba-e98a6314b10e"
68+
}, expectedUserData: wrapMIMEParts(nodeConfigOutpost),
69+
}),
5970
)
6071

6172
var _ = DescribeTable("Managed AL2023", func(e al2023Entry) {
@@ -404,6 +415,33 @@ spec:
404415
- --node-labels=alpha.eksctl.io/nodegroup-name=al2023-mng-test
405416
406417
`
418+
419+
nodeConfigOutpost = `--//
420+
Content-Type: application/node.eks.aws
421+
422+
apiVersion: node.eks.aws/v1alpha1
423+
kind: NodeConfig
424+
metadata: {}
425+
spec:
426+
cluster:
427+
apiServerEndpoint: https://test.xxx.us-west-2.eks.amazonaws.com
428+
certificateAuthority: dGVzdCBDQQ==
429+
cidr: 10.100.0.0/16
430+
enableOutpost: true
431+
id: 51eaebb5-7e52-4e71-baba-e98a6314b10e
432+
name: al2023-test
433+
containerd: {}
434+
instance:
435+
localStorage: {}
436+
kubelet:
437+
config:
438+
clusterDNS:
439+
- 10.100.0.10
440+
flags:
441+
- --node-labels=alpha.eksctl.io/nodegroup-name=al2023-mng-test
442+
443+
`
444+
407445
managedNodeConfigIPv6 = `--//
408446
Content-Type: application/node.eks.aws
409447

userdocs/src/usage/outposts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ nodeGroups:
204204
```
205205

206206
???+ note
207-
- Only Amazon Linux 2 is supported for nodegroups when the control plane is on Outposts.
207+
- Only Amazon Linux 2023 is supported for nodegroups when the control plane is on Outposts.
208208
- Only EBS gp2 volume types are supported for nodegroups on Outposts.
209209

210210

0 commit comments

Comments
 (0)