-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored code and Added cni addon upgrade/downgrade regression test (…
…#1861) * Refactored code Addon upgrade/downgrade test similar to #1795 Added tests for addon upgrade/downgrade Changed DEFAULT version Added addon status checks Fetch latest addon version for given K8s Cluster Update kops cluster config used in weekly tests (#1862) * Change to kops cluster creation scripts * Add logging for retry attempt * Switch kops cluster to use docker container runtime Co-authored-by: Jayanth Varavani <1111446+jayanthvn@users.noreply.github.com> Renamed package name for adddon tests removed unnecessary changes Fixed replica count for MTU and Veth test in host networking Updated ENI/IP limits file for newly added instances (#1864) * Added new instances * Updated test readme * needed rebase * formatting * remove all references to integration-new migrate to ginkgo v2 in addon test files * fix maxIPPerInterface count on pod_networking_suite * Increase default deployment ready timeout Co-authored-by: Vikas Basavaraj <5373156+vikasmb@users.noreply.github.com>
- Loading branch information
Showing
14 changed files
with
537 additions
and
201 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package utils | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/aws/services" | ||
"github.com/aws/amazon-vpc-cni-k8s/test/framework/utils" | ||
"github.com/pkg/errors" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
) | ||
|
||
func WaitTillAddonIsDeleted(eks services.EKS, addonName string, clusterName string) error { | ||
ctx := context.Background() | ||
return wait.PollImmediateUntil(utils.PollIntervalShort, func() (bool, error) { | ||
_, err := eks.DescribeAddon(&services.AddonInput{ | ||
AddonName: addonName, | ||
ClusterName: clusterName, | ||
}) | ||
if err != nil { | ||
return false, err | ||
} | ||
return false, nil | ||
}, ctx.Done()) | ||
} | ||
|
||
func WaitTillAddonIsActive(eks services.EKS, addonName string, clusterName string) error { | ||
ctx := context.Background() | ||
return wait.PollImmediateUntil(utils.PollIntervalShort, func() (bool, error) { | ||
describeAddonOutput, err := eks.DescribeAddon(&services.AddonInput{ | ||
AddonName: addonName, | ||
ClusterName: clusterName, | ||
}) | ||
if err != nil { | ||
return false, err | ||
} | ||
|
||
status := *describeAddonOutput.Addon.Status | ||
if status == "CREATE_FAILED" || status == "DEGRADED" { | ||
return false, errors.Errorf("Create Addon Failed, addon status: %s", status) | ||
} | ||
if status == "ACTIVE" { | ||
return true, nil | ||
} | ||
return false, nil | ||
}, ctx.Done()) | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package addon_tests | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/aws/amazon-vpc-cni-k8s/test/framework" | ||
"github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/aws/services" | ||
"github.com/aws/amazon-vpc-cni-k8s/test/framework/utils" | ||
v1 "k8s.io/api/core/v1" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
const InstanceTypeNodeLabelKey = "beta.kubernetes.io/instance-type" | ||
|
||
var f *framework.Framework | ||
var maxIPPerInterface int | ||
var primaryNode v1.Node | ||
var secondaryNode v1.Node | ||
var vpcCIDRs []string | ||
var clusterVersion string | ||
var latestAddonVersion string | ||
|
||
func TestCNIPodNetworking(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "CNI Pod Networking Suite") | ||
} | ||
|
||
var _ = BeforeSuite(func() { | ||
f = framework.New(framework.GlobalOptions) | ||
|
||
By("creating test namespace") | ||
f.K8sResourceManagers.NamespaceManager(). | ||
CreateNamespace(utils.DefaultTestNamespace) | ||
|
||
By(fmt.Sprintf("getting the node with the node label key %s and value %s", | ||
f.Options.NgNameLabelKey, f.Options.NgNameLabelVal)) | ||
nodes, err := f.K8sResourceManagers.NodeManager().GetNodes(f.Options.NgNameLabelKey, f.Options.NgNameLabelVal) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("verifying that atleast 1 nodes is present for the test") | ||
Expect(len(nodes.Items)).Should(BeNumerically(">", 0)) | ||
|
||
// Set the primary and secondary node for testing | ||
primaryNode = nodes.Items[0] | ||
secondaryNode = nodes.Items[1] | ||
|
||
By("getting the instance type from node label " + InstanceTypeNodeLabelKey) | ||
instanceType := primaryNode.Labels[InstanceTypeNodeLabelKey] | ||
|
||
By("getting the network interface details from ec2") | ||
instanceOutput, err := f.CloudServices.EC2().DescribeInstanceType(instanceType) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
maxIPPerInterface = int(*instanceOutput[0].NetworkInfo.Ipv4AddressesPerInterface) | ||
|
||
By("describing the VPC to get the VPC CIDRs") | ||
describeVPCOutput, err := f.CloudServices.EC2().DescribeVPC(f.Options.AWSVPCID) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
for _, cidrBlockAssociationSet := range describeVPCOutput.Vpcs[0].CidrBlockAssociationSet { | ||
vpcCIDRs = append(vpcCIDRs, *cidrBlockAssociationSet.CidrBlock) | ||
} | ||
|
||
By("getting current cluster version") | ||
clusterOutput, err := f.CloudServices.EKS().DescribeCluster(f.Options.ClusterName) | ||
Expect(err).NotTo(HaveOccurred()) | ||
clusterVersion = *clusterOutput.Cluster.Version | ||
|
||
By("getting latest vpc-cni addon version") | ||
latestAddonVersion, err = f.CloudServices.EKS().GetLatestVersion(&services.AddonInput{ | ||
AddonName: "vpc-cni", | ||
K8sVersion: clusterVersion, | ||
}) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
var _ = AfterSuite(func() { | ||
By("deleting test namespace") | ||
f.K8sResourceManagers.NamespaceManager(). | ||
DeleteAndWaitTillNamespaceDeleted(utils.DefaultTestNamespace) | ||
}) |
Oops, something went wrong.