Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ cluster on AWS.

- Native Kubernetes manifests and API
- Manages the bootstrapping of VPCs, gateways, security groups and instances.
- Choice of Linux distribution among Amazon Linux 2, CentOS 7, Ubuntu(18.04, 20.04) and Flatcar
using [pre-baked AMIs][published_amis].
- Choice of Linux distribution using [pre-baked AMIs][published_amis].
- Deploys Kubernetes control planes into private subnets with a separate
bastion server.
- Doesn't use SSH for bootstrapping nodes.
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterawsadm/ami/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
)

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

func getimageRegionList() []string {
Expand Down
5 changes: 2 additions & 3 deletions cmd/clusterawsadm/cmd/ami/common/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func CopyAMICmd() *cobra.Command {
`),
Example: cmd.Examples(`
# Copy AMI from the default AWS account where AMIs are stored.
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
clusterawsadm ami copy --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami copy --kubernetes-version=v1.30.1 --os=ubuntu-22.04 --region=us-west-2

# owner-id and dry-run flags are optional. region can be set via flag or env
clusterawsadm ami copy --os centos-7 --kubernetes-version=v1.19.4 --owner-id=111111111111 --dry-run
Expand Down Expand Up @@ -81,7 +81,6 @@ func CopyAMICmd() *cobra.Command {
SourceRegion: sourceRegion,
},
)

if err != nil {
fmt.Print(err)
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterawsadm/cmd/ami/common/encryptedcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func EncryptedCopyAMICmd() *cobra.Command {
`),
Example: cmd.Examples(`
# Create an encrypted AMI:
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami encrypted-copy --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2

# owner-id and dry-run flags are optional. region can be set via flag or env
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterawsadm/cmd/ami/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func ListAMICmd() *cobra.Command {
`),
Example: cmd.Examples(`
# List AMIs from the default AWS account where AMIs are stored.
# Available os options: centos-7, ubuntu-18.04, ubuntu-20.04, amazon-2, flatcar-stable
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami list --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
# To list all supported AMIs in all supported Kubernetes versions, regions, and linux distributions:
clusterawsadm ami list
Expand Down
55 changes: 34 additions & 21 deletions controllers/awsmachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
g.Expect(testEnv.Cleanup(ctx, awsMachine, ns, secret)).To(Succeed())
})

cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{Subnets: []infrav1.SubnetSpec{
{
ID: "subnet-1",
AvailabilityZone: "us-east-1a",
}},
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{
Subnets: []infrav1.SubnetSpec{
{
ID: "subnet-1",
AvailabilityZone: "us-east-1a",
},
},
}}})
g.Expect(err).To(BeNil())
cs.Cluster = &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{Name: "test-cluster"}}
Expand All @@ -131,7 +133,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
},
infrav1.SecurityGroupControlPlane: {
ID: "3",
}}
},
}
ms, err := getMachineScope(cs, awsMachine)
g.Expect(err).To(BeNil())

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

_, err = reconciler.reconcileNormal(ctx, ms, cs, cs, cs, cs)
g.Expect(err).To(BeNil())
expectConditions(g, ms.AWSMachine, []conditionAssertion{{infrav1.SecurityGroupsReadyCondition, corev1.ConditionTrue, "", ""},
expectConditions(g, ms.AWSMachine, []conditionAssertion{
{infrav1.SecurityGroupsReadyCondition, corev1.ConditionTrue, "", ""},
{infrav1.InstanceReadyCondition, corev1.ConditionTrue, "", ""},
{infrav1.ELBAttachedCondition, corev1.ConditionTrue, "", ""}})
{infrav1.ELBAttachedCondition, corev1.ConditionTrue, "", ""},
})
g.Expect(ms.AWSMachine.Finalizers).Should(ContainElement(infrav1.MachineFinalizer))
})
t.Run("Should successfully reconcile control plane machine deletion", func(t *testing.T) {
Expand Down Expand Up @@ -236,7 +241,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
g.Expect(err).To(BeNil())
expectConditions(g, ms.AWSMachine, []conditionAssertion{
{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason}})
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
})
g.Expect(ms.AWSMachine.Finalizers).ShouldNot(ContainElement(infrav1.MachineFinalizer))
})
t.Run("Should fail reconciling control-plane machine creation while attaching load balancer", func(t *testing.T) {
Expand Down Expand Up @@ -280,11 +286,13 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
g.Expect(testEnv.Cleanup(ctx, awsMachine, ns, secret)).To(Succeed())
})

cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{Subnets: []infrav1.SubnetSpec{
{
ID: "subnet-1",
AvailabilityZone: "us-east-1a",
}},
cs, err := getClusterScope(infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{Name: "test"}, Spec: infrav1.AWSClusterSpec{NetworkSpec: infrav1.NetworkSpec{
Subnets: []infrav1.SubnetSpec{
{
ID: "subnet-1",
AvailabilityZone: "us-east-1a",
},
},
}}})
g.Expect(err).To(BeNil())
cs.Cluster = &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{Name: "test-cluster"}}
Expand All @@ -305,7 +313,8 @@ func TestAWSMachineReconcilerIntegrationTests(t *testing.T) {
},
infrav1.SecurityGroupControlPlane: {
ID: "3",
}}
},
}
ms, err := getMachineScope(cs, awsMachine)
g.Expect(err).To(BeNil())

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

_, err = reconciler.reconcileDelete(ms, cs, cs, cs, cs)
g.Expect(err).Should(HaveOccurred())
expectConditions(g, ms.AWSMachine, []conditionAssertion{{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, "DeletingFailed"},
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason}})
expectConditions(g, ms.AWSMachine, []conditionAssertion{
{infrav1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, "DeletingFailed"},
{infrav1.ELBAttachedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, clusterv1.DeletedReason},
})
g.Expect(ms.AWSMachine.Finalizers).ShouldNot(ContainElement(infrav1.MachineFinalizer))
})
}
Expand Down Expand Up @@ -572,11 +583,11 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
Filters: []*ec2.Filter{
{
Name: aws.String("owner-id"),
Values: aws.StringSlice([]string{"258751437250"}),
Values: aws.StringSlice([]string{"819546954734"}),
},
{
Name: aws.String("name"),
Values: aws.StringSlice([]string{"capa-ami-ubuntu-18.04-?test-*"}),
Values: aws.StringSlice([]string{"capa-ami-ubuntu-24.04-?test-*"}),
},
{
Name: aws.String("architecture"),
Expand All @@ -590,7 +601,8 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
Name: aws.String("virtualization-type"),
Values: aws.StringSlice([]string{"hvm"}),
},
}})).Return(&ec2.DescribeImagesOutput{Images: []*ec2.Image{
},
})).Return(&ec2.DescribeImagesOutput{Images: []*ec2.Image{
{
ImageId: aws.String("latest"),
CreationDate: aws.String("2019-02-08T17:02:31.000Z"),
Expand Down Expand Up @@ -639,7 +651,8 @@ func mockedCreateInstanceCalls(m *mocks.MockEC2APIMockRecorder) {
},
},
},
}}, nil).MaxTimes(3)
},
}, nil).MaxTimes(3)
m.DescribeNetworkInterfaceAttributeWithContext(context.TODO(), gomock.Eq(&ec2.DescribeNetworkInterfaceAttributeInput{
NetworkInterfaceId: aws.String("eni-1"),
Attribute: aws.String("groupSet"),
Expand Down
1 change: 1 addition & 0 deletions docs/book/src/SUMMARY_SUFFIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Developing E2E tests](./development/e2e.md)
- [Coding Conventions](./development/conventions.md)
- [Try unreleased changes with Nightly Builds](./development/nightlies.md)
- [Publishing AMIs](./development/amis.md)
- [CRD Reference](./crd/index.md)
- [Reference](./topics/reference/reference.md)
- [Glossary](./topics/reference/glossary.md)
Expand Down
Loading