Skip to content

Commit

Permalink
[CAFV-267] Clutser upgrade test automation (#475)
Browse files Browse the repository at this point in the history
* add files

Signed-off-by: ymo24 <[email protected]>

* add updates for cluster upgrade

Signed-off-by: ymo24 <[email protected]>

* add doc update

Signed-off-by: ymo24 <[email protected]>

* address comments

Signed-off-by: ymo24 <[email protected]>

* minor fix

Signed-off-by: ymo24 <[email protected]>

* add refrator jira task reminder

Signed-off-by: ymo24 <[email protected]>
  • Loading branch information
ymo24 authored Jul 13, 2023
1 parent d9e7f33 commit fd66032
Show file tree
Hide file tree
Showing 7 changed files with 841 additions and 14 deletions.
92 changes: 92 additions & 0 deletions tests/assets/tkg_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"v1.25.7+vmware.2-tkg.1-8a74b9f12e488c54605b3537acb683bc": {
"tkg": ["v2.2.0"],
"tkr": "v1.25.7---vmware.2-tkg.1",
"etcd": "v3.5.6_vmware.9",
"coreDns": "v1.9.3_vmware.8"
},
"v1.24.11+vmware.1-tkg.1-2ccb2a001f8bd8f15f1bfbc811071830": {
"tkg": ["v2.2.0"],
"tkr": "v1.24.11---vmware.1-tkg.1",
"etcd": "v3.5.6_vmware.10",
"coreDns": "v1.8.6_vmware.18"
},
"v1.24.10+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e": {
"tkg": ["v2.1.1"],
"tkr": "v1.24.10---vmware.1-tkg.2",
"etcd": "v3.5.6_vmware.6",
"coreDns": "v1.8.6_vmware.17"
},
"v1.23.17+vmware.1-tkg.1-ee4d95d5d08cd7f31da47d1480571754": {
"tkg": ["v2.2.0"],
"tkr": "v1.23.17---vmware.1-tkg.1",
"etcd": "v3.5.6_vmware.11",
"coreDns": "v1.8.6_vmware.19"
},
"v1.23.16+vmware.1-tkg.1-eb0de9755338b944ea9652e6f758b3ce": {
"tkg": ["v2.1.1"],
"tkr": "v1.23.16---vmware.1-tkg.1",
"etcd": "v3.5.6_vmware.5",
"coreDns": "v1.8.6_vmware.16"
},
"v1.22.17+vmware.1-tkg.1-df08b304658a6cf17f5e74dc0ab7543c": {
"tkg": ["v2.1.1"],
"tkr": "v1.22.17---vmware.1-tkg.1",
"etcd": "v3.5.6_vmware.1",
"coreDns": "v1.8.4_vmware.10"
},
"v1.23.10+vmware.1-tkg.2-b53d41690f8742e7388f2c553fd9a181": {
"tkg": ["v1.6.1"],
"tkr": "v1.23.10---vmware.1-tkg.1",
"etcd": "v3.5.4_vmware.7",
"coreDns": "v1.8.6_vmware.11"
},
"v1.22.13+vmware.1-tkg.2-ea08b304658a6cf17f5e74dc0ab7544f": {
"tkg": ["v1.6.1"],
"tkr": "v1.22.13---vmware.1-tkg.1",
"etcd": "v3.5.4_vmware.2",
"coreDns": "v1.8.4_vmware.10"
},
"v1.22.9+vmware.1-tkg.1-2182cbabee08edf480ee9bc5866d6933": {
"tkg": ["v1.5.4"],
"tkr": "v1.22.9---vmware.1-tkg.1",
"etcd": "v3.5.4_vmware.2",
"coreDns": "v1.8.4_vmware.9"
},
"v1.21.14+vmware.2-tkg.5-d793afae5aa18e50bd9175e339904496": {
"tkg": ["v1.6.1"],
"tkr": "v1.21.14---vmware.2-tkg.5",
"etcd": "v3.4.18_vmware.1",
"coreDns": "v1.8.0_vmware.14"
},
"v1.21.11+vmware.1-tkg.2-d788dbbb335710c0a0d1a28670057896": {
"tkg": ["v1.5.4"],
"tkr": "v1.21.11---vmware.1-tkg.2",
"etcd": "v3.4.13_vmware.27",
"coreDns": "v1.8.0_vmware.13"
},
"v1.21.8+vmware.1-tkg.2-ed3c93616a02968be452fe1934a1d37c": {
"tkg": ["v1.4.3"],
"tkr": "v1.21.8---vmware.1-tkg.2",
"etcd": "v3.4.13_vmware.25",
"coreDns": "v1.8.0_vmware.11"
},
"v1.20.15+vmware.1-tkg.2-839faf7d1fa7fa356be22b72170ce1a8": {
"tkg": ["v1.5.4"],
"tkr": "v1.20.15---vmware.1-tkg.2",
"etcd": "v3.4.13_vmware.23",
"coreDns": "v1.7.0_vmware.15"
},
"v1.20.14+vmware.1-tkg.2-5a5027ce2528a6229acb35b38ff8084e": {
"tkg": ["v1.4.3"],
"tkr": "v1.20.14---vmware.1-tkg.2",
"etcd": "v3.4.13_vmware.23",
"coreDns": "v1.7.0_vmware.15"
},
"v1.19.16+vmware.1-tkg.2-fba68db15591c15fcd5f26b512663a42": {
"tkg": ["v1.4.3"],
"tkr": "v1.19.16---vmware.1-tkg.2",
"etcd": "v3.4.13_vmware.19",
"coreDns": "v1.7.0_vmware.15"
}
}
25 changes: 22 additions & 3 deletions tests/e2e/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ Note: **You can also use [setup script](setup_kind_cluster.sh) to set up the kin
- Test input
- PathToKubeconfigOfManagementCluster (absolute path to find the file)
- PathToCapiYamlOfWorkloadCluster (absolute path to find the file)
- [optional] TargetTKGVersion
- [optional] TargetK8SVersion



- Test Workflow
### Cluster Resize Test
- use kubeConfigPath and capiYamlPath to get kubeConfig and capiYaml.
- Create the workload cluster
- Get the clusterName and clusterNameSpace from capiYaml
Expand All @@ -37,7 +38,25 @@ Note: **You can also use [setup script](setup_kind_cluster.sh) to set up the kin
- Ensure the workload cluster is deleted
- Delete the cluster name space (Secret - capi-user-credentials is deleted at the same time)

### Cluster Upgrade Test
- use kubeConfigPath and capiYamlPath to get kubeConfig and capiYaml.
- Create the workload cluster
- Get the clusterName and clusterNameSpace from capiYaml
- Create the namespace when necessary
- Apply the objects from capiYaml
- Wait for the cluster becomes `provisioned` and all the machine states become `provisioned`
- Validate the kubeConfig of the workload cluster
- Apply the CRS of CNI/CPI/CSI
- Wait for all the machine states become `running`
- Upgrade the workload cluster
- upgrade the cluster to the targetK8sVersion and targetTKGVersion
- monitor the new machine show up and then become running
- delete the workload cluster
- delete all the objects from capiYaml except `secret`
- Ensure the workload cluster is deleted
- Delete the cluster name space (Secret - capi-user-credentials is deleted at the same time)


## Tests to be added
* test the upgrade on an existing workload cluster
* automate the management cluster creation. Test the management cluster creation and workload cluster creation together.
* test the VCD resource name change and validate CAPVCD to fallback and use the correct VCD name change.
8 changes: 6 additions & 2 deletions tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import (
)

var (
PathToMngmntClusterKubecfg string
PathToWorkloadClusterCapiYaml string
PathToMngmntClusterKubecfg string
PathToWorkloadClusterCapiYaml string
TargetTKGVersionForUpgradeTest string
TargetK8SVersionForUpgradeTest string
)

func init() {
flag.StringVar(&PathToMngmntClusterKubecfg, "PathToMngmntClusterKubecfg", "", "path to find the Kubeconfig. It is used to retrieve the cluster")
flag.StringVar(&PathToWorkloadClusterCapiYaml, "PathToWorkloadClusterCapiYaml", "", "path to find the capi Yaml. It is used to generate the vcd cluster")
flag.StringVar(&TargetTKGVersionForUpgradeTest, "TargetTKGVersionForUpgradeTest", "", "target TKG version for upgrade test")
flag.StringVar(&TargetK8SVersionForUpgradeTest, "TargetK8SVersionForUpgradeTest", "", "target Kubernetes version for upgrade test")
}

var _ = BeforeSuite(func() {
Expand Down
Loading

0 comments on commit fd66032

Please sign in to comment.