Created
July 28, 2021 14:02
-
-
Save Skarlso/2b43e3dd009007d1864f72e6cc3bef50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context("can add a nodegroup into a new subnet", func() { | |
FIt("creates a new nodegroup", func() { | |
cfg := &api.ClusterConfig{ | |
Metadata: &api.ClusterMeta{ | |
Name: params.ClusterName, | |
Region: params.Region, | |
}, | |
} | |
ctl, err := eks.New(&api.ProviderConfig{Region: params.Region}, cfg) | |
Expect(err).NotTo(HaveOccurred()) | |
cl, err := ctl.GetCluster(params.ClusterName) | |
Expect(err).NotTo(HaveOccurred()) | |
awsSession := NewSession(params.Region) | |
ec2 := awsec2.New(awsSession) | |
existingSubnets, err := ec2.DescribeSubnets(&awsec2.DescribeSubnetsInput{ | |
SubnetIds: cl.ResourcesVpcConfig.SubnetIds, | |
}) | |
Expect(err).NotTo(HaveOccurred()) | |
Expect(len(existingSubnets.Subnets) > 0).To(BeTrue()) | |
s := existingSubnets.Subnets[0] | |
subnet, err := ec2.CreateSubnet(&awsec2.CreateSubnetInput{ | |
AvailabilityZoneId: aws.String("us-west-2b"), | |
CidrBlock: s.CidrBlock, | |
TagSpecifications: []*awsec2.TagSpecification{ | |
{ | |
Tags: s.Tags, | |
}, | |
}, | |
VpcId: s.VpcId, | |
}) | |
Expect(err).NotTo(HaveOccurred()) | |
// create a new subnet in that given vpc and zone. | |
cmd := params.EksctlCreateCmd.WithArgs( | |
"nodegroup", | |
"--timeout=45m", | |
"--cluster", params.ClusterName, | |
"--nodes", "1", | |
"--node-type", "p2.xlarge", | |
"--node-private-networking", | |
"--subnet-ids", *subnet.Subnet.SubnetId, | |
testNG, | |
) | |
Expect(cmd).To(RunSuccessfully()) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment