Skip to content

Commit

Permalink
Added configurable flag to create test nodes with arm64 and container…
Browse files Browse the repository at this point in the history
…d runtime (#1977)
  • Loading branch information
cgchinmay authored May 11, 2022
1 parent 902dcb2 commit 5b34d7d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
6 changes: 6 additions & 0 deletions test/e2e/custom-networking/custom_networking_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ var _ = BeforeSuite(func() {
Subnet: clusterVPCConfig.PublicSubnetList,
InstanceType: "c5.xlarge",
KeyPairName: keyPairName,
ContainerRuntime: f.Options.ContainerRuntime,
}

if f.Options.InstanceType == "arm64" {
nodeGroupProperties.InstanceType = "m6g.large"
nodeGroupProperties.NodeImageId = "ami-087fca294139386b6"
}

By("creating a new self managed node group")
Expand Down
22 changes: 15 additions & 7 deletions test/e2e/pod-eni/securiy_group_per_pod_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,21 @@ var _ = BeforeSuite(func() {
Expect(err).ToNot(HaveOccurred())

nodeGroupProperties = awsUtils.NodeGroupProperties{
NgLabelKey: "node-type",
NgLabelVal: "pod-eni-node",
AsgSize: asgSize,
NodeGroupName: "pod-eni-node",
Subnet: clusterVPCConfig.PublicSubnetList,
InstanceType: instanceType,
KeyPairName: keyPairName,
NgLabelKey: "node-type",
NgLabelVal: "pod-eni-node",
AsgSize: asgSize,
NodeGroupName: "pod-eni-node",
Subnet: clusterVPCConfig.PublicSubnetList,
InstanceType: instanceType,
KeyPairName: keyPairName,
ContainerRuntime: f.Options.ContainerRuntime,
}

if f.Options.InstanceType == "arm64" {
// override instanceType for arm64
instanceType = "m6g.large"
nodeGroupProperties.InstanceType = instanceType
nodeGroupProperties.NodeImageId = "ami-087fca294139386b6"
}

totalBranchInterface = vpc.Limits[instanceType].BranchInterface * asgSize
Expand Down
20 changes: 12 additions & 8 deletions test/framework/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ func init() {
}

type Options struct {
KubeConfig string
ClusterName string
AWSRegion string
AWSVPCID string
NgNameLabelKey string
NgNameLabelVal string
EKSEndpoint string
CalicoVersion string
KubeConfig string
ClusterName string
AWSRegion string
AWSVPCID string
NgNameLabelKey string
NgNameLabelVal string
EKSEndpoint string
CalicoVersion string
ContainerRuntime string
InstanceType string
}

func (options *Options) BindFlags() {
Expand All @@ -46,6 +48,8 @@ func (options *Options) BindFlags() {
flag.StringVar(&options.NgNameLabelVal, "ng-name-label-val", "", "label value with the nodegroup name")
flag.StringVar(&options.EKSEndpoint, "eks-endpoint", "", "optional eks api server endpoint")
flag.StringVar(&options.CalicoVersion, "calico-version", "3.22.0", "calico version to be tested")
flag.StringVar(&options.ContainerRuntime, "container-runtime", "", "Optionally can specify it as 'containerd' for the test nodes")
flag.StringVar(&options.InstanceType, "instance-type", "amd64", "Optionally specify instance type as arm64 for the test nodes")
}

func (options *Options) Validate() error {
Expand Down
9 changes: 9 additions & 0 deletions test/framework/resources/aws/utils/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type NodeGroupProperties struct {

// optional: specify container runtime
ContainerRuntime string

NodeImageId string
}

type ClusterVPCConfig struct {
Expand Down Expand Up @@ -161,6 +163,13 @@ func CreateAndWaitTillSelfManagedNGReady(f *framework.Framework, properties Node
},
}

if properties.NodeImageId != "" {
createNgStackParams = append(createNgStackParams, &cloudformation.Parameter{
ParameterKey: aws.String("NodeImageId"),
ParameterValue: aws.String(properties.NodeImageId),
})
}

describeStackOutput, err := f.CloudServices.CloudFormation().
WaitTillStackCreated(properties.NodeGroupName, createNgStackParams, template)
if err != nil {
Expand Down

0 comments on commit 5b34d7d

Please sign in to comment.