Skip to content

Commit 53dabf5

Browse files
committed
Revert to vm-op api version v1alpha4 for vks
1 parent 494c6c5 commit 53dabf5

File tree

21 files changed

+208
-865
lines changed

21 files changed

+208
-865
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/pkg/sftp v1.13.6
2424
github.com/prometheus/client_golang v1.22.0
2525
github.com/stretchr/testify v1.10.0
26-
github.com/vmware-tanzu/vm-operator/api v1.9.1-0.20250923172217-bf5a74e51c65
26+
github.com/vmware-tanzu/vm-operator/api v1.8.7-0.20250509154507-b93e51fc90fa
2727
github.com/vmware-tanzu/vm-operator/external/byok v0.0.0-20250509154507-b93e51fc90fa
2828
github.com/vmware/govmomi v0.52.0
2929
go.uber.org/zap v1.27.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ github.com/thecodeteam/gofsutil v0.1.2 h1:FL87mBzZeeuDMZm8hpYLFcYylQdq6bbm8UQ1oc
287287
github.com/thecodeteam/gofsutil v0.1.2/go.mod h1:7bDOpr2aMnmdm9RTdxBEeqdOr+8RpnQhsB/VUEI3DgM=
288288
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE=
289289
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk=
290-
github.com/vmware-tanzu/vm-operator/api v1.9.1-0.20250923172217-bf5a74e51c65 h1:oby5iJHxU5KgtajXxT8B8VxUUPH20Zh0KTYlI+18AYs=
291-
github.com/vmware-tanzu/vm-operator/api v1.9.1-0.20250923172217-bf5a74e51c65/go.mod h1:nWTPpxfe4gHuuYuFcrs86+NMxfkqPk3a3IlvI8TCWak=
290+
github.com/vmware-tanzu/vm-operator/api v1.8.7-0.20250509154507-b93e51fc90fa h1:LRfm1EMc+L96FzMOwujwbifo6pd/dkBJ4QhofuYNzBw=
291+
github.com/vmware-tanzu/vm-operator/api v1.8.7-0.20250509154507-b93e51fc90fa/go.mod h1:V0JbH4beGCU+q7yqnWUYYOuDij0ut5i1iBO4cyzg+tM=
292292
github.com/vmware-tanzu/vm-operator/external/byok v0.0.0-20250509154507-b93e51fc90fa h1:4MKu14YJ7J54O6QKmT4ds5EUpysWLLtQRMff73cVkmU=
293293
github.com/vmware-tanzu/vm-operator/external/byok v0.0.0-20250509154507-b93e51fc90fa/go.mod h1:8tiuyYslzjLIUmOlXZuGKQdQP2ZgWGCVhVeyptmZYnk=
294294
github.com/vmware/govmomi v0.52.0 h1:JyxQ1IQdllrY7PJbv2am9mRsv3p9xWlIQ66bv+XnyLw=

pkg/common/utils/utils.go

Lines changed: 111 additions & 188 deletions
Large diffs are not rendered by default.

pkg/common/utils/utils_test.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
vmoperatorv1alpha2 "github.com/vmware-tanzu/vm-operator/api/v1alpha2"
1616
vmoperatorv1alpha3 "github.com/vmware-tanzu/vm-operator/api/v1alpha3"
1717
vmoperatorv1alpha4 "github.com/vmware-tanzu/vm-operator/api/v1alpha4"
18-
vmoperatorv1alpha5 "github.com/vmware-tanzu/vm-operator/api/v1alpha5"
1918
cnssim "github.com/vmware/govmomi/cns/simulator"
2019
"github.com/vmware/govmomi/cns/types"
2120
"github.com/vmware/govmomi/simulator"
@@ -299,22 +298,22 @@ func TestListVirtualMachines(t *testing.T) {
299298
vmoperatorv1alpha1.AddToScheme,
300299
})
301300
clientBuilder.WithRuntimeObjects(namespace, otherNamespace, vm1, vm2, vm3)
302-
v1Alpha4VM1 := vmoperatorv1alpha5.VirtualMachine{
301+
v1Alpha4VM1 := vmoperatorv1alpha4.VirtualMachine{
303302
ObjectMeta: metav1.ObjectMeta{
304303
Name: "vm1",
305304
Namespace: namespace.Name,
306305
},
307306
}
308-
v1Alpha4VM2 := vmoperatorv1alpha5.VirtualMachine{
307+
v1Alpha4VM2 := vmoperatorv1alpha4.VirtualMachine{
309308
ObjectMeta: metav1.ObjectMeta{
310309
Name: "vm2",
311310
Namespace: namespace.Name,
312311
},
313312
}
314-
exp := vmoperatorv1alpha5.VirtualMachineList{
313+
exp := vmoperatorv1alpha4.VirtualMachineList{
315314
TypeMeta: metav1.TypeMeta{},
316315
ListMeta: metav1.ListMeta{},
317-
Items: []vmoperatorv1alpha5.VirtualMachine{
316+
Items: []vmoperatorv1alpha4.VirtualMachine{
318317
v1Alpha4VM1,
319318
v1Alpha4VM2,
320319
},
@@ -395,22 +394,22 @@ func TestListVirtualMachines(t *testing.T) {
395394
vmoperatorv1alpha2.AddToScheme,
396395
})
397396
clientBuilder.WithRuntimeObjects(namespace, vm1, vm2)
398-
v1Alpha4VM1 := vmoperatorv1alpha5.VirtualMachine{
397+
v1Alpha4VM1 := vmoperatorv1alpha4.VirtualMachine{
399398
ObjectMeta: metav1.ObjectMeta{
400399
Name: "vm1",
401400
Namespace: namespace.Name,
402401
},
403402
}
404-
v1Alpha4VM2 := vmoperatorv1alpha5.VirtualMachine{
403+
v1Alpha4VM2 := vmoperatorv1alpha4.VirtualMachine{
405404
ObjectMeta: metav1.ObjectMeta{
406405
Name: "vm2",
407406
Namespace: namespace.Name,
408407
},
409408
}
410-
exp := vmoperatorv1alpha5.VirtualMachineList{
409+
exp := vmoperatorv1alpha4.VirtualMachineList{
411410
TypeMeta: metav1.TypeMeta{},
412411
ListMeta: metav1.ListMeta{},
413-
Items: []vmoperatorv1alpha5.VirtualMachine{
412+
Items: []vmoperatorv1alpha4.VirtualMachine{
414413
v1Alpha4VM1,
415414
v1Alpha4VM2,
416415
},
@@ -491,22 +490,22 @@ func TestListVirtualMachines(t *testing.T) {
491490
vmoperatorv1alpha3.AddToScheme,
492491
})
493492
clientBuilder.WithRuntimeObjects(namespace, vm1, vm2)
494-
v1Alpha4VM1 := vmoperatorv1alpha5.VirtualMachine{
493+
v1Alpha4VM1 := vmoperatorv1alpha4.VirtualMachine{
495494
ObjectMeta: metav1.ObjectMeta{
496495
Name: "vm1",
497496
Namespace: namespace.Name,
498497
},
499498
}
500-
v1Alpha4VM2 := vmoperatorv1alpha5.VirtualMachine{
499+
v1Alpha4VM2 := vmoperatorv1alpha4.VirtualMachine{
501500
ObjectMeta: metav1.ObjectMeta{
502501
Name: "vm2",
503502
Namespace: namespace.Name,
504503
},
505504
}
506-
exp := vmoperatorv1alpha5.VirtualMachineList{
505+
exp := vmoperatorv1alpha4.VirtualMachineList{
507506
TypeMeta: metav1.TypeMeta{},
508507
ListMeta: metav1.ListMeta{},
509-
Items: []vmoperatorv1alpha5.VirtualMachine{
508+
Items: []vmoperatorv1alpha4.VirtualMachine{
510509
v1Alpha4VM1,
511510
v1Alpha4VM2,
512511
},
@@ -586,22 +585,22 @@ func TestListVirtualMachines(t *testing.T) {
586585
vmoperatorv1alpha4.AddToScheme,
587586
})
588587
clientBuilder.WithRuntimeObjects(namespace, vm1, vm2)
589-
v1Alpha4VM1 := vmoperatorv1alpha5.VirtualMachine{
588+
v1Alpha4VM1 := vmoperatorv1alpha4.VirtualMachine{
590589
ObjectMeta: metav1.ObjectMeta{
591590
Name: "vm1",
592591
Namespace: namespace.Name,
593592
},
594593
}
595-
v1Alpha4VM2 := vmoperatorv1alpha5.VirtualMachine{
594+
v1Alpha4VM2 := vmoperatorv1alpha4.VirtualMachine{
596595
ObjectMeta: metav1.ObjectMeta{
597596
Name: "vm2",
598597
Namespace: namespace.Name,
599598
},
600599
}
601-
exp := vmoperatorv1alpha5.VirtualMachineList{
600+
exp := vmoperatorv1alpha4.VirtualMachineList{
602601
TypeMeta: metav1.TypeMeta{},
603602
ListMeta: metav1.ListMeta{},
604-
Items: []vmoperatorv1alpha5.VirtualMachine{
603+
Items: []vmoperatorv1alpha4.VirtualMachine{
605604
v1Alpha4VM1,
606605
v1Alpha4VM2,
607606
},
@@ -616,9 +615,9 @@ func TestListVirtualMachines(t *testing.T) {
616615
assert.True(tt, compareVirtualMachineLists(exp, *actual))
617616
})
618617
})
619-
t.Run("WhenLatestCRDVersionIsV1Alpha5OrAbove", func(tt *testing.T) {
618+
t.Run("WhenLatestCRDVersionIsV1Alpha4OrAbove", func(tt *testing.T) {
620619
getLatestCRDVersion = func(ctx context.Context, crdName string) (string, error) {
621-
return "v1alpha5", nil
620+
return "v1alpha4", nil
622621
}
623622
tt.Run("WhenListFails", func(ttt *testing.T) {
624623
// Setup
@@ -654,20 +653,20 @@ func TestListVirtualMachines(t *testing.T) {
654653
Phase: v1.NamespaceActive,
655654
},
656655
}
657-
vm1 := &vmoperatorv1alpha5.VirtualMachine{
656+
vm1 := &vmoperatorv1alpha4.VirtualMachine{
658657
TypeMeta: metav1.TypeMeta{
659658
Kind: "VirtualMachine",
660-
APIVersion: "vmoperator.vmware.com/v1alpha5",
659+
APIVersion: "vmoperator.vmware.com/v1alpha4",
661660
},
662661
ObjectMeta: metav1.ObjectMeta{
663662
Name: "vm1",
664663
Namespace: namespace.Name,
665664
},
666665
}
667-
vm2 := &vmoperatorv1alpha5.VirtualMachine{
666+
vm2 := &vmoperatorv1alpha4.VirtualMachine{
668667
TypeMeta: metav1.TypeMeta{
669668
Kind: "VirtualMachine",
670-
APIVersion: "vmoperator.vmware.com/v1alpha5",
669+
APIVersion: "vmoperator.vmware.com/v1alpha4",
671670
},
672671
ObjectMeta: metav1.ObjectMeta{
673672
Name: "vm2",
@@ -678,13 +677,13 @@ func TestListVirtualMachines(t *testing.T) {
678677
scheme := runtime.NewScheme()
679678
clientBuilder = registerSchemes(context.Background(), clientBuilder, scheme, runtime.SchemeBuilder{
680679
v1.AddToScheme,
681-
vmoperatorv1alpha5.AddToScheme,
680+
vmoperatorv1alpha4.AddToScheme,
682681
})
683682
clientBuilder.WithRuntimeObjects(namespace, vm1, vm2)
684-
exp := vmoperatorv1alpha5.VirtualMachineList{
683+
exp := vmoperatorv1alpha4.VirtualMachineList{
685684
TypeMeta: metav1.TypeMeta{},
686685
ListMeta: metav1.ListMeta{},
687-
Items: []vmoperatorv1alpha5.VirtualMachine{
686+
Items: []vmoperatorv1alpha4.VirtualMachine{
688687
*vm1,
689688
*vm2,
690689
},
@@ -712,7 +711,7 @@ func registerSchemes(ctx context.Context, clientBuilder *fake.ClientBuilder, sch
712711
return clientBuilder
713712
}
714713

715-
func compareVirtualMachineLists(exp, actual vmoperatorv1alpha5.VirtualMachineList) bool {
714+
func compareVirtualMachineLists(exp, actual vmoperatorv1alpha4.VirtualMachineList) bool {
716715
// since the list output may not be in the same order, we will compare the items
717716
// using brute force.
718717
if len(exp.Items) != len(actual.Items) {

pkg/csi/service/wcp/controller_helper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525

2626
"github.com/container-storage-interface/spec/lib/go/csi"
27-
vmoperatorv1alpha5 "github.com/vmware-tanzu/vm-operator/api/v1alpha5"
27+
vmoperatorv1alpha4 "github.com/vmware-tanzu/vm-operator/api/v1alpha4"
2828
"github.com/vmware/govmomi/object"
2929
"github.com/vmware/govmomi/property"
3030
"github.com/vmware/govmomi/vim25/mo"
@@ -165,10 +165,10 @@ func validateWCPControllerExpandVolumeRequest(ctx context.Context, req *csi.Cont
165165
return logger.LogNewErrorCodef(log, codes.Internal,
166166
"failed to get config with error: %+v", err)
167167
}
168-
vmOperatorClient, err := k8s.NewClientForGroup(ctx, cfg, vmoperatorv1alpha5.GroupName)
168+
vmOperatorClient, err := k8s.NewClientForGroup(ctx, cfg, vmoperatorv1alpha4.GroupName)
169169
if err != nil {
170170
return logger.LogNewErrorCodef(log, codes.Internal,
171-
"failed to get client for group %s with error: %+v", vmoperatorv1alpha5.GroupName, err)
171+
"failed to get client for group %s with error: %+v", vmoperatorv1alpha4.GroupName, err)
172172
}
173173
vmList, err := utils.ListVirtualMachines(ctx, vmOperatorClient, "")
174174
if err != nil {

0 commit comments

Comments
 (0)