Skip to content

Commit 9133e58

Browse files
committed
refactor: update to use new community ami account
Updates to the project to start using the new CNCF owned AWS account for publishing AMIs. The code has had the old VMWare account removed and the new account ID added. Additionally the docs have been updated including clarifying that the public AMIs should only be used for non-production usage. Signed-off-by: Richard Case <[email protected]>
1 parent cfe6dc0 commit 9133e58

File tree

14 files changed

+846
-169
lines changed

14 files changed

+846
-169
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cluster on AWS.
4646

4747
- Native Kubernetes manifests and API
4848
- Manages the bootstrapping of VPCs, gateways, security groups and instances.
49-
- Choice of Linux distribution among Amazon Linux 2, CentOS 7, Ubuntu(18.04, 20.04) and Flatcar
49+
- Choice of Linux distribution among Amazon Linux 2, CentOS 7, Ubuntu and Flatcar
5050
using [pre-baked AMIs][published_amis].
5151
- Deploys Kubernetes control planes into private subnets with a separate
5252
bastion server.

cmd/clusterawsadm/ami/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
)
3939

4040
func getSupportedOsList() []string {
41-
return []string{"centos-7", "ubuntu-22.04", "ubuntu-18.04", "ubuntu-20.04", "amazon-2", "flatcar-stable"}
41+
return []string{"centos-7", "ubuntu-24.04", "ubuntu-22.04", "amazon-2", "flatcar-stable", "rhel-8"}
4242
}
4343

4444
func getimageRegionList() []string {

cmd/clusterawsadm/cmd/ami/common/copy.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func CopyAMICmd() *cobra.Command {
4040
`),
4141
Example: cmd.Examples(`
4242
# Copy AMI from the default AWS account where AMIs are stored.
43-
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
44-
clusterawsadm ami copy --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
43+
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
44+
clusterawsadm ami copy --kubernetes-version=v1.30.1 --os=ubuntu-22.04 --region=us-west-2
4545
4646
# owner-id and dry-run flags are optional. region can be set via flag or env
4747
clusterawsadm ami copy --os centos-7 --kubernetes-version=v1.19.4 --owner-id=111111111111 --dry-run
@@ -81,7 +81,6 @@ func CopyAMICmd() *cobra.Command {
8181
SourceRegion: sourceRegion,
8282
},
8383
)
84-
8584
if err != nil {
8685
fmt.Print(err)
8786
return err

cmd/clusterawsadm/cmd/ami/common/encryptedcopy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func EncryptedCopyAMICmd() *cobra.Command {
4545
`),
4646
Example: cmd.Examples(`
4747
# Create an encrypted AMI:
48-
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
48+
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
4949
clusterawsadm ami encrypted-copy --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
5050
5151
# owner-id and dry-run flags are optional. region can be set via flag or env

cmd/clusterawsadm/cmd/ami/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func ListAMICmd() *cobra.Command {
5151
`),
5252
Example: cmd.Examples(`
5353
# List AMIs from the default AWS account where AMIs are stored.
54-
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
54+
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
5555
clusterawsadm ami list --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
5656
# To list all supported AMIs in all supported Kubernetes versions, regions, and linux distributions:
5757
clusterawsadm ami list

controllers/awsmachine_controller_test.go

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
106106
g.Expect(testEnv.Cleanup(ctx, awsMachine, ns, secret)).To(Succeed())
107107
})
108108

109-
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{Subnets: []infrav1.SubnetSpec{
110-
{
111-
ID: "subnet-1",
112-
AvailabilityZone: "us-east-1a",
113-
}},
109+
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{
110+
Subnets: []infrav1.SubnetSpec{
111+
{
112+
ID: "subnet-1",
113+
AvailabilityZone: "us-east-1a",
114+
},
115+
},
114116
}}})
115117
g.Expect(err).To(BeNil())
116118
cs.Cluster = &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{Name: "test-cluster"}}
@@ -131,7 +133,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
131133
},
132134
infrav1.SecurityGroupControlPlane: {
133135
ID: "3",
134-
}}
136+
},
137+
}
135138
ms, err := getMachineScope(cs, awsMachine)
136139
g.Expect(err).To(BeNil())
137140

@@ -162,9 +165,11 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
162165

163166
_, err = reconciler.reconcileNormal(ctx, ms, cs, cs, cs, cs)
164167
g.Expect(err).To(BeNil())
165-
expectConditions(g, ms.AWSMachine, []conditionAssertion{{infrav1.SecurityGroupsReadyCondition, corev1.ConditionTrue, "", ""},
168+
expectConditions(g, ms.AWSMachine, []conditionAssertion{
169+
{infrav1.SecurityGroupsReadyCondition, corev1.ConditionTrue, "", ""},
166170
{infrav1.InstanceReadyCondition, corev1.ConditionTrue, "", ""},
167-
{infrav1.ELBAttachedCondition, corev1.ConditionTrue, "", ""}})
171+
{infrav1.ELBAttachedCondition, corev1.ConditionTrue, "", ""},
172+
})
168173
g.Expect(ms.AWSMachine.Finalizers).Should(ContainElement(infrav1.MachineFinalizer))
169174
})
170175
t.Run("Should successfully reconcile control plane machine deletion", func(t *testing.T) {
@@ -236,7 +241,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
236241
g.Expect(err).To(BeNil())
237242
expectConditions(g, ms.AWSMachine, []conditionAssertion{
238243
{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
239-
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason}})
244+
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
245+
})
240246
g.Expect(ms.AWSMachine.Finalizers).ShouldNot(ContainElement(infrav1.MachineFinalizer))
241247
})
242248
t.Run("Should fail reconciling control-plane machine creation while attaching load balancer", func(t *testing.T) {
@@ -280,11 +286,13 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
280286
g.Expect(testEnv.Cleanup(ctx, awsMachine, ns, secret)).To(Succeed())
281287
})
282288

283-
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{Subnets: []infrav1.SubnetSpec{
284-
{
285-
ID: "subnet-1",
286-
AvailabilityZone: "us-east-1a",
287-
}},
289+
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{
290+
Subnets: []infrav1.SubnetSpec{
291+
{
292+
ID: "subnet-1",
293+
AvailabilityZone: "us-east-1a",
294+
},
295+
},
288296
}}})
289297
g.Expect(err).To(BeNil())
290298
cs.Cluster = &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{Name: "test-cluster"}}
@@ -305,7 +313,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
305313
},
306314
infrav1.SecurityGroupControlPlane: {
307315
ID: "3",
308-
}}
316+
},
317+
}
309318
ms, err := getMachineScope(cs, awsMachine)
310319
g.Expect(err).To(BeNil())
311320

@@ -411,8 +420,10 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
411420

412421
_, err = reconciler.reconcileDelete(ms, cs, cs, cs, cs)
413422
g.Expect(err).Should(HaveOccurred())
414-
expectConditions(g, ms.AWSMachine, []conditionAssertion{{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, "DeletingFailed"},
415-
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason}})
423+
expectConditions(g, ms.AWSMachine, []conditionAssertion{
424+
{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, "DeletingFailed"},
425+
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
426+
})
416427
g.Expect(ms.AWSMachine.Finalizers).ShouldNot(ContainElement(infrav1.MachineFinalizer))
417428
})
418429
}
@@ -572,11 +583,11 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
572583
Filters: []*ec2.Filter{
573584
{
574585
Name: aws.String("owner-id"),
575-
Values: aws.StringSlice([]string{"258751437250"}),
586+
Values: aws.StringSlice([]string{"819546954734"}),
576587
},
577588
{
578589
Name: aws.String("name"),
579-
Values: aws.StringSlice([]string{"capa-ami-ubuntu-18.04-?test-*"}),
590+
Values: aws.StringSlice([]string{"capa-ami-ubuntu-24.04-?test-*"}),
580591
},
581592
{
582593
Name: aws.String("architecture"),
@@ -590,7 +601,8 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
590601
Name: aws.String("virtualization-type"),
591602
Values: aws.StringSlice([]string{"hvm"}),
592603
},
593-
}})).Return(&ec2.DescribeImagesOutput{Images: []*ec2.Image{
604+
},
605+
})).Return(&ec2.DescribeImagesOutput{Images: []*ec2.Image{
594606
{
595607
ImageId: aws.String("latest"),
596608
CreationDate: aws.String("2019-02-08T17:02:31.000Z"),
@@ -639,7 +651,8 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
639651
},
640652
},
641653
},
642-
}}, nil).MaxTimes(3)
654+
},
655+
}, nil).MaxTimes(3)
643656
m.DescribeNetworkInterfaceAttributeWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNetworkInterfaceAttributeInput{
644657
NetworkInterfaceId: aws.String("eni-1"),
645658
Attribute: aws.String("groupSet"),

docs/book/src/SUMMARY_SUFFIX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [Developing E2E tests](./development/e2e.md)
44
- [Coding Conventions](./development/conventions.md)
55
- [Try unreleased changes with Nightly Builds](./development/nightlies.md)
6+
- [Publishing AMIs](./development/amis.md)
67
- [CRD Reference](./crd/index.md)
78
- [Reference](./topics/reference/reference.md)
89
- [Glossary](./topics/reference/glossary.md)

0 commit comments

Comments
 (0)