Skip to content

Commit

Permalink
Merge pull request #383 from vmware/issue/eks-acceptance-testing-vpc
Browse files Browse the repository at this point in the history
Fixed eks acceptance testing related issue
  • Loading branch information
snootan authored Mar 2, 2024
2 parents 5a878f5 + 22506a4 commit 102b2ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 40 deletions.
49 changes: 14 additions & 35 deletions internal/resources/ekscluster/resource_ekscluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ func TestAcceptanceForMkpClusterResource(t *testing.T) {
),
},
{
ResourceName: testhelper.EksClusterResourceName,
ImportState: true,
ImportStateVerify: true,
ResourceName: testhelper.EksClusterResourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{waitForKubeconfig},
},
},
})
Expand Down Expand Up @@ -418,7 +419,7 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
return eksmodel.VmwareTanzuManageV1alpha1EksclusterSpec{
ClusterGroupName: "default",
Config: &eksmodel.VmwareTanzuManageV1alpha1EksclusterControlPlaneConfig{
Version: "1.23",
Version: "1.26",
RoleArn: controlPlaneRoleARN,
Tags: map[string]string{
"tmc.cloud.vmware.com/tmc-managed": "true",
Expand All @@ -441,14 +442,9 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
PublicAccessCidrs: []string{
"0.0.0.0/0",
},
SecurityGroups: []string{
"sg-0a6768722e9716768",
},
SecurityGroups: []string{"sg-0b77767aa25e20fec"},
SubnetIds: []string{
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9",
},
},
},
Expand All @@ -460,12 +456,9 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
Description: "tf nodepool description",
},
Spec: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolSpec{
RoleArn: workerRoleArn,
AmiType: "CUSTOM",
AmiInfo: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolAmiInfo{
AmiID: "ami-2qu8409oisdfj0qw",
OverrideBootstrapCmd: "#!/bin/bash\n/etc/eks/bootstrap.sh tf-test-ami",
},
RoleArn: workerRoleArn,
AmiType: "AL2_x86_64",
AmiInfo: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolAmiInfo{},
CapacityType: "ON_DEMAND",
RootDiskSize: 40,
Tags: map[string]string{
Expand All @@ -477,16 +470,7 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
"testnplabelkey": "testnplabelvalue",
},
SubnetIds: []string{
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
},
RemoteAccess: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolRemoteAccess{
SSHKey: "anshulc",
SecurityGroups: []string{
"sg-0a6768722e9716768",
},
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9",
},
ScalingConfig: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolScalingConfig{
DesiredSize: 4,
Expand All @@ -501,6 +485,7 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
"m3.large",
},
Taints: make([]*eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolTaint, 0),
RemoteAccess: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolRemoteAccess{},
LaunchTemplate: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolLaunchTemplate{},
},
},
Expand All @@ -520,15 +505,9 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
"testnplabelkey": "testnplabelvalue",
},
SubnetIds: []string{
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
},
LaunchTemplate: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolLaunchTemplate{
Name: "PLACE_HOLDER",
Version: "PLACE_HOLDER",
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9",
},
LaunchTemplate: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolLaunchTemplate{},
ScalingConfig: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolScalingConfig{
DesiredSize: 4,
MaxSize: 8,
Expand Down
8 changes: 4 additions & 4 deletions internal/resources/testing/test_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ const testDefaultCreateEksClusterScript = `
"0.0.0.0/0",
]
security_groups = [ // Forces new
"sg-09247a89b01962bd9",
"sg-0b77767aa25e20fec",
]
subnet_ids = [ // Forces new
"subnet-0e3bcd8e3c06a4bf0", "subnet-06427cefa730aeae7", "subnet-07c17b758e92356f6", "subnet-0a081ddc6ff1070d0"
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9"
]
}
}
Expand All @@ -58,7 +58,7 @@ const testDefaultCreateEksClusterScript = `
tags = { "testnptag" : "testnptagvalue", "newtesttag": "testingtagvalue"}
node_labels = { "testnplabelkey" : "testnplabelvalue" }
subnet_ids = [ // Required, forces new
"subnet-0e3bcd8e3c06a4bf0", "subnet-06427cefa730aeae7", "subnet-07c17b758e92356f6", "subnet-0a081ddc6ff1070d0"
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9"
]
scaling_config {
desired_size = 4
Expand Down Expand Up @@ -86,7 +86,7 @@ const testDefaultCreateEksClusterScript = `
tags = { "testnptag" : "testnptagvalue", "newtesttag": "testingtagvalue"}
node_labels = { "testnplabelkey" : "testnplabelvalue" }
subnet_ids = [ // Required, forces new
"subnet-0e3bcd8e3c06a4bf0", "subnet-06427cefa730aeae7", "subnet-07c17b758e92356f6", "subnet-0a081ddc6ff1070d0"
"subnet-0c285da60b373a4cc", "subnet-0be854d94fa197cb7", "subnet-04975d535cf761785", "subnet-0d50aa17c694457c9"
]
scaling_config {
desired_size = 4
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/testing/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestGetDefaultEksAcceptanceConfig() *TestAcceptanceConfig {
AWSAccountNumber: "919197287370",
Region: "us-west-2",
ClusterGroupName: "default",
KubernetesVersion: "1.23",
KubernetesVersion: "1.26",
CredentialName: "PLACE_HOLDER",
CloudFormationTemplateID: "PLACE_HOLDER",
}
Expand Down

0 comments on commit 102b2ad

Please sign in to comment.