Skip to content

Commit

Permalink
Added nodepool tags in test config file for acceptance testing and co…
Browse files Browse the repository at this point in the history
…rrected for acceptance EKS cluster testing

Signed-off-by: Nootan Singh <snootan@vmware.com>
  • Loading branch information
snootan committed Feb 1, 2024
1 parent d31a14c commit 229c50f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 25 deletions.
2 changes: 1 addition & 1 deletion internal/resources/ekscluster/resource_ekscluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func constructAddonsConfig(data []interface{}) *eksmodel.VmwareTanzuManageV1alph
addonsConfig := &eksmodel.VmwareTanzuManageV1alpha1EksclusterAddonsConfig{}

if len(data) == 0 || data[0] == nil {
return addonsConfig
return nil
}

addonsConfigData, _ := data[0].(map[string]interface{})
Expand Down
13 changes: 11 additions & 2 deletions internal/resources/ekscluster/resource_ekscluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
RoleArn: controlPlaneRoleARN,
Tags: map[string]string{
"tmc.cloud.vmware.com/tmc-managed": "true",
"testclustertag": "testclustertagvalue",
"testingtag": "testingtagvalue",
"testsametag": "testsametagval",
},
KubernetesNetworkConfig: &eksmodel.VmwareTanzuManageV1alpha1EksclusterKubernetesNetworkConfig{
ServiceCidr: "10.100.0.0/16",
Expand Down Expand Up @@ -467,7 +470,10 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
CapacityType: "ON_DEMAND",
RootDiskSize: 40,
Tags: map[string]string{
"testnptag": "testnptagvalue",
"testnptag": "testnptagvalue",
"testingtag": "testingnptagvalue",
"testsametag": "testsametagval",
"testclustertag": "testclustertagvalue",
},
NodeLabels: map[string]string{
"testnplabelkey": "testnplabelvalue",
Expand Down Expand Up @@ -508,7 +514,10 @@ func getMockEksClusterSpec(accountID string, templateID string) (eksmodel.Vmware
Spec: &eksmodel.VmwareTanzuManageV1alpha1EksclusterNodepoolSpec{
RoleArn: workerRoleArn,
Tags: map[string]string{
"testnptag": "testnptagvalue",
"testnptag": "testnptagvalue",
"testingtag": "testingnptagvalue",
"testsametag": "testsametagval",
"testclustertag": "testclustertagvalue",
},
NodeLabels: map[string]string{
"testnplabelkey": "testnplabelvalue",
Expand Down
54 changes: 33 additions & 21 deletions internal/resources/testing/test_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const testDefaultCreateEksClusterScript = `
config {
kubernetes_version = "{{.KubernetesVersion}}"
role_arn = "arn:aws:iam::{{.AWSAccountNumber}}:role/control-plane.{{.CloudFormationTemplateID}}.eks.tmc.cloud.vmware.com"
tags = { "testclustertag" : "testclustertagvalue", "testingtag": "testingtagvalue", "testsametag":"testsametagval"}
kubernetes_network_config {
service_cidr = "10.100.0.0/16" // Forces new
}
Expand All @@ -35,13 +36,13 @@ const testDefaultCreateEksClusterScript = `
"0.0.0.0/0",
]
security_groups = [ // Forces new
"sg-0b77767aa25e20fec",
"sg-0a6768722e9716768",
]
subnet_ids = [ // Forces new
"subnet-0c285da60b373a4cc",
"subnet-0be854d94fa197cb7",
"subnet-04975d535cf761785",
"subnet-0d50aa17c694457c9",
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
]
}
}
Expand All @@ -54,22 +55,29 @@ const testDefaultCreateEksClusterScript = `
spec {
// Refer to nodepool's schema
role_arn = "arn:aws:iam::{{.AWSAccountNumber}}:role/worker.{{.CloudFormationTemplateID}}.eks.tmc.cloud.vmware.com"
ami_type = "AL2_x86_64" // Forces New
ami_type = "CUSTOM" // Forces New
capacity_type = "ON_DEMAND"
root_disk_size = 20 // Default: 20GiB, forces New
tags = { "testnptag" : "testnptagvalue" }
ami_info {
ami_id = "ami-2qu8409oisdfj0qw"
override_bootstrap_cmd = "#!/bin/bash\n/etc/eks/bootstrap.sh tf-test-ami"
}
remote_access {
ssh_key = "anshulc"
security_groups = ["sg-0a6768722e9716768"]
}
root_disk_size = 40 // Default: 20GiB, forces New
tags = { "testnptag" : "testnptagvalue", "testingtag": "testingnptagvalue"}
node_labels = { "testnplabelkey" : "testnplabelvalue" }
subnet_ids = [ // Required, forces new
"subnet-0c285da60b373a4cc",
"subnet-0be854d94fa197cb7",
"subnet-04975d535cf761785",
"subnet-0d50aa17c694457c9",
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
]
scaling_config {
desired_size = 2
max_size = 2
min_size = 2
desired_size = 4
max_size = 8
min_size = 1
}
update_config {
max_unavailable_nodes = "2"
Expand All @@ -89,13 +97,17 @@ const testDefaultCreateEksClusterScript = `
spec {
// Refer to nodepool's schema
role_arn = "arn:aws:iam::{{.AWSAccountNumber}}:role/worker.{{.CloudFormationTemplateID}}.eks.tmc.cloud.vmware.com"
tags = { "testnptag" : "testnptagvalue" }
tags = { "testnptag" : "testnptagvalue", "testingtag": "testingnptagvalue"}
node_labels = { "testnplabelkey" : "testnplabelvalue" }
launch_template {
name = "PLACE_HOLDER"
version = "PLACE_HOLDER"
}
subnet_ids = [ // Required, forces new
"subnet-0c285da60b373a4cc",
"subnet-0be854d94fa197cb7",
"subnet-04975d535cf761785",
"subnet-0d50aa17c694457c9",
"subnet-0a184f6302af32a86",
"subnet-0ed95d5c212ac62a1",
"subnet-0526ecaecde5b1bf7",
"subnet-06897e1063cc0cf4e",
]
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.26",
KubernetesVersion: "1.23",
CredentialName: "PLACE_HOLDER",
CloudFormationTemplateID: "PLACE_HOLDER",
}
Expand Down

0 comments on commit 229c50f

Please sign in to comment.