Skip to content

Commit

Permalink
vsan stretch automation for TKG, WCP and VMService VMs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aishwarya-Hebbar committed Sep 5, 2024
1 parent a8dff5d commit 1c4b622
Show file tree
Hide file tree
Showing 14 changed files with 2,508 additions and 410 deletions.
1 change: 1 addition & 0 deletions tests/e2e/e2e_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
nginxImage = "registry.k8s.io/nginx-slim:0.26"
nginxImage4upg = "registry.k8s.io/nginx-slim:0.27"
retainClaimPolicy = "Retain"
cloudInitLabel = "CloudInit"
configSecret = "vsphere-config-secret"
contollerClusterKubeConfig = "CONTROLLER_CLUSTER_KUBECONFIG"
controlPlaneLabel = "node-role.kubernetes.io/control-plane"
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/file_volume_statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ var _ = ginkgo.Describe("[csi-file-vanilla] File Volume statefulset", func() {
}()
ginkgo.By("Creating statefulset with replica 3")
statefulset, _, volumesBeforeScaleUp := createStsDeployment(ctx, client, namespace, sc, false,
false, 0, "", v1.ReadWriteMany)
false, 3, "", 0, v1.ReadWriteMany)
replicas := *(statefulset.Spec.Replicas)

//List volume responses will show up in the interval of every 1 minute.
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/hci.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ var _ bool = ginkgo.Describe("hci", func() {

ginkgo.By("create a sts with 3 replicas")
var replicas int32 = 3
statefulset, _, _ := createStsDeployment(ctx, client, namespace, sc, false, false, replicas, "", "")
statefulset, _, _ := createStsDeployment(ctx, client, namespace, sc, false, false, replicas, "", 0, "")
defer func() {
ginkgo.By(fmt.Sprintf("Deleting all statefulsets in namespace: %v", namespace))
fss.DeleteAllStatefulSets(ctx, client, namespace)
Expand Down Expand Up @@ -304,7 +304,7 @@ var _ bool = ginkgo.Describe("hci", func() {

ginkgo.By("Create a sts with 3 replicas")
var replicas int32 = 3
statefulset, _, _ := createStsDeployment(ctx, client, namespace, sc, false, false, replicas, "", "")
statefulset, _, _ := createStsDeployment(ctx, client, namespace, sc, false, false, replicas, "", 0, "")

defer func() {
ginkgo.By(fmt.Sprintf("Deleting all statefulsets in namespace: %v", namespace))
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/hci_mesh_rwx_disruptive.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ var _ = ginkgo.Describe("[rwx-hci-singlevc-disruptive] RWX-Topology-HciMesh-Sing

ginkgo.By("PSOD all host in remote cluster4 and when psod is triggered, create new set of rwx pvc")
for i := 0; i < len(hostListCluster4); i++ {
err = psodHost(hostListCluster4[i])
err = psodHost(hostListCluster4[i], "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if i == 0 {
Expand Down Expand Up @@ -729,7 +729,7 @@ var _ = ginkgo.Describe("[rwx-hci-singlevc-disruptive] RWX-Topology-HciMesh-Sing
ginkgo.By("PSOD again all host in remote cluster4 and perform scaleup " +
"operation on deployment and statefulset")
for i := 0; i < len(hostListCluster4); i++ {
err = psodHost(hostListCluster4[i])
err = psodHost(hostListCluster4[i], "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if i == 0 {
Expand Down Expand Up @@ -1873,7 +1873,7 @@ var _ = ginkgo.Describe("[rwx-hci-singlevc-disruptive] RWX-Topology-HciMesh-Sing

ginkgo.By("PSOD all host in local cluster2 and when psod is triggered, create new set of rwx pvc")
for i := 0; i < len(hostListCluster2); i++ {
err = psodHost(hostListCluster2[i])
err = psodHost(hostListCluster2[i], "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if i == 0 {
Expand Down Expand Up @@ -1929,7 +1929,7 @@ var _ = ginkgo.Describe("[rwx-hci-singlevc-disruptive] RWX-Topology-HciMesh-Sing
ginkgo.By("PSOD all host in local cluster3 and perform scaleup " +
"operation on deployment and statefulset")
for i := 0; i < len(hostListCluster3); i++ {
err = psodHost(hostListCluster3[i])
err = psodHost(hostListCluster3[i], "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if i == 0 {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/multi_vc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ var _ = ginkgo.Describe("[multivc-positive] MultiVc-Topology-Positive", func() {
}()
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, volumesBeforeScaleUp := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", "")
false, 3, "", 1, "")

ginkgo.By("Verify PV node affinity and that the PODS are running on appropriate node")
err = verifyPVnodeAffinityAndPODnodedetailsForStatefulsetsLevel5(ctx, client, statefulset,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/no_hci_mesh_rwx_singlevc_topology_disruptive.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ var _ = ginkgo.Describe("[rwx-nohci-singlevc-disruptive] RWX-Topology-NoHciMesh-

ginkgo.By("PSOD all host")
for i := 0; i < len(hostList); i++ {
err = psodHost(hostList[i])
err = psodHost(hostList[i], "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if i == 2 {
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/prevent_duplicate_cluster_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ var _ = ginkgo.Describe("Prevent duplicate cluster ID", func() {
}
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", accessMode)
false, 3, "", 1, accessMode)
replicas := *(statefulset.Spec.Replicas)

defer func() {
Expand Down Expand Up @@ -345,7 +345,7 @@ var _ = ginkgo.Describe("Prevent duplicate cluster ID", func() {
}
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", accessMode)
false, 3, "", 1, accessMode)
replicas := *(statefulset.Spec.Replicas)

defer func() {
Expand Down Expand Up @@ -503,7 +503,7 @@ var _ = ginkgo.Describe("Prevent duplicate cluster ID", func() {
}
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", accessMode)
false, 0, "", 1, accessMode)
replicas := *(statefulset.Spec.Replicas)

defer func() {
Expand Down Expand Up @@ -757,7 +757,7 @@ var _ = ginkgo.Describe("Prevent duplicate cluster ID", func() {
}
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", accessMode)
false, 3, "", 1, accessMode)
replicas := *(statefulset.Spec.Replicas)

defer func() {
Expand Down Expand Up @@ -864,7 +864,7 @@ var _ = ginkgo.Describe("Prevent duplicate cluster ID", func() {
}
ginkgo.By("Creating statefulset with replica 3 and a deployment")
statefulset, deployment, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", accessMode)
false, 3, "", 1, accessMode)
replicas := *(statefulset.Spec.Replicas)

defer func() {
Expand Down
10 changes: 8 additions & 2 deletions tests/e2e/rwx_topology_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,15 @@ func verifyK8sNodeStatusAfterSiteRecovery(client clientset.Interface, ctx contex
}

/* This util will perform psod operation on a host */
func psodHost(hostIP string) error {
func psodHost(hostIP string, psodTimeOut string) error {
ginkgo.By("PSOD")
sshCmd := fmt.Sprintf("vsish -e set /config/Misc/intOpts/BlueScreenTimeout %s", psodTime)
var timeout string
if psodTimeOut != "" {
timeout = psodTimeOut
} else {
timeout = psodTime
}
sshCmd := fmt.Sprintf("vsish -e set /config/Misc/intOpts/BlueScreenTimeout %s", timeout)
op, err := runCommandOnESX("root", hostIP, sshCmd)
framework.Logf(op)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ var _ = ginkgo.Describe("statefulset", func() {

ginkgo.By("Creating statfulset and deployment from storageclass")
statefulset, _, _ := createStsDeployment(ctx, client, namespace, sc, true,
false, 0, "", "")
false, 3, "", 1, "")
replicas := *(statefulset.Spec.Replicas)
csiNs := GetAndExpectStringEnvVar(envCSINamespace)
csipods, err := client.CoreV1().Pods(csiNs).List(ctx, metav1.ListOptions{})
Expand Down
12 changes: 1 addition & 11 deletions tests/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3618,18 +3618,8 @@ func psodHostWithPv(ctx context.Context, vs *vSphere, pvName string) string {
framework.Logf("hostIP %v", hostIP)
gomega.Expect(hostIP).NotTo(gomega.BeEmpty())

ginkgo.By("PSOD")
sshCmd := fmt.Sprintf("vsish -e set /config/Misc/intOpts/BlueScreenTimeout %s", psodTime)
op, err := runCommandOnESX("root", hostIP, sshCmd)
framework.Logf(op)
err := psodHost(hostIP, "")
gomega.Expect(err).NotTo(gomega.HaveOccurred())

ginkgo.By("Injecting PSOD ")
psodCmd := "vsish -e set /reliability/crashMe/Panic 1"
op, err = runCommandOnESX("root", hostIP, psodCmd)
framework.Logf(op)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())

return hostIP
}

Expand Down
Loading

0 comments on commit 1c4b622

Please sign in to comment.