From 846d9423abf4b1cc81f8a6d9ce6424e0b24fa78e Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 4 Jun 2024 18:45:06 +0200 Subject: [PATCH] test: migrate vm-operator to v1alpha2 --- test/e2e/e2e_suite_test.go | 2 +- test/framework/vmoperator/vmoperator.go | 251 ++---------------- test/go.sum | 2 - .../vcsim/config/rbac/role.yaml | 36 --- .../vcsim/controllers/vcsim_controller.go | 4 - .../controllers/virtualmachine_controller.go | 6 +- .../virtualmachine_controller_test.go | 10 +- .../controllers/vspherevm_controller_test.go | 2 +- test/infrastructure/vcsim/main.go | 2 +- 9 files changed, 35 insertions(+), 280 deletions(-) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 37b078f2ba..9d700431f2 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1" corev1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" diff --git a/test/framework/vmoperator/vmoperator.go b/test/framework/vmoperator/vmoperator.go index fcae2d3de7..08472d64ae 100644 --- a/test/framework/vmoperator/vmoperator.go +++ b/test/framework/vmoperator/vmoperator.go @@ -22,12 +22,12 @@ import ( "fmt" "net" "net/url" - "sort" "strings" "time" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" + vmoprv1common "github.com/vmware-tanzu/vm-operator/api/v1alpha2/common" topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1" "github.com/vmware/govmomi/pbm" "github.com/vmware/govmomi/vapi/library" @@ -36,13 +36,13 @@ import ( corev1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/cluster-api-provider-vsphere/pkg/session" vcsimv1 "sigs.k8s.io/cluster-api-provider-vsphere/test/infrastructure/vcsim/api/v1alpha1" @@ -360,7 +360,7 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon return retryError } - // Create VirtualMachineClass in K8s and bind it to the user namespace + // Create VirtualMachineClass in K8s for _, vmc := range config.Spec.VirtualMachineClasses { vmClass := &vmoprv1.VirtualMachineClass{ ObjectMeta: metav1.ObjectMeta{ @@ -392,42 +392,12 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon if retryError != nil { return retryError } - - vmClassBinding := &vmoprv1.VirtualMachineClassBinding{ - ObjectMeta: metav1.ObjectMeta{ - Name: vmClass.Name, - Namespace: config.Namespace, - }, - ClassRef: vmoprv1.ClassReference{ - APIVersion: vmoprv1.SchemeGroupVersion.String(), - Kind: "VirtualMachineClass", - Name: vmClass.Name, - }, - } - _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { - retryError = nil - if err := c.Get(ctx, client.ObjectKeyFromObject(vmClassBinding), vmClassBinding); err != nil { - if !apierrors.IsNotFound(err) { - retryError = errors.Wrapf(err, "failed to get vm-operator VirtualMachineClassBinding %s", vmClassBinding.Name) - return false, nil - } - if err := c.Create(ctx, vmClassBinding); err != nil { - retryError = errors.Wrapf(err, "failed to create vm-operator VirtualMachineClassBinding %s", vmClassBinding.Name) - return false, nil - } - log.Info("Created vm-operator VirtualMachineClassBinding", "VirtualMachineClassBinding", klog.KObj(vmClassBinding)) - } - return true, nil - }) - if retryError != nil { - return retryError - } } - // Create a ContentLibrary in K8s and in vCenter, bind it to the K8s namespace + // Create a ContentLibrary in K8s and in vCenter, // This requires a set of objects in vCenter(or vcsim) as well as their mapping in K8s // - vCenter: a Library containing an Item - // - k8s: ContentLibraryProvider, ContentSource (both representing the library), a VirtualMachineImage (representing the Item) + // - k8s: a VirtualMachineImage (representing the Item) restClient := rest.NewClient(s.Client.Client) if err := restClient.Login(ctx, url.UserPassword(config.Spec.VCenter.Username, config.Spec.VCenter.Password)); err != nil { @@ -470,97 +440,6 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon contentLibraryID = id } - contentSource := &vmoprv1.ContentSource{ - ObjectMeta: metav1.ObjectMeta{ - Name: contentLibraryID, - }, - Spec: vmoprv1.ContentSourceSpec{ - ProviderRef: vmoprv1.ContentProviderReference{ - Name: contentLibraryID, // NOTE: this should match the ContentLibraryProvider name below - Kind: "ContentLibraryProvider", - }, - }, - } - _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { - retryError = nil - if err := c.Get(ctx, client.ObjectKeyFromObject(contentSource), contentSource); err != nil { - if !apierrors.IsNotFound(err) { - retryError = errors.Wrapf(err, "failed to get vm-operator ContentSource %s", contentSource.Name) - return false, nil - } - if err := c.Create(ctx, contentSource); err != nil { - retryError = errors.Wrapf(err, "failed to create vm-operator ContentSource %s", contentSource.Name) - return false, nil - } - log.Info("Created vm-operator ContentSource", "ContentSource", klog.KObj(contentSource)) - } - return true, nil - }) - if retryError != nil { - return retryError - } - - contentSourceBinding := &vmoprv1.ContentSourceBinding{ - ObjectMeta: metav1.ObjectMeta{ - Name: contentLibraryID, - Namespace: config.Namespace, - }, - ContentSourceRef: vmoprv1.ContentSourceReference{ - APIVersion: vmoprv1.SchemeGroupVersion.String(), - Kind: "ContentSource", - Name: contentSource.Name, - }, - } - _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { - retryError = nil - if err := c.Get(ctx, client.ObjectKeyFromObject(contentSourceBinding), contentSourceBinding); err != nil { - if !apierrors.IsNotFound(err) { - retryError = errors.Wrapf(err, "failed to get vm-operator ContentSourceBinding %s", contentSourceBinding.Name) - return false, nil - } - if err := c.Create(ctx, contentSourceBinding); err != nil { - retryError = errors.Wrapf(err, "failed to create vm-operator ContentSourceBinding %s", contentSourceBinding.Name) - return false, nil - } - log.Info("Created vm-operator ContentSourceBinding", "ContentSourceBinding", klog.KObj(contentSourceBinding)) - } - return true, nil - }) - if retryError != nil { - return retryError - } - - contentLibraryProvider := &vmoprv1.ContentLibraryProvider{ - ObjectMeta: metav1.ObjectMeta{ - Name: contentLibraryID, - }, - Spec: vmoprv1.ContentLibraryProviderSpec{ - UUID: contentLibraryID, - }, - } - - if err := controllerutil.SetOwnerReference(contentSource, contentLibraryProvider, c.Scheme()); err != nil { - return errors.Wrap(err, "failed to set ContentLibraryProvider owner") - } - _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { - retryError = nil - if err := c.Get(ctx, client.ObjectKeyFromObject(contentSource), contentLibraryProvider); err != nil { - if !apierrors.IsNotFound(err) { - retryError = errors.Wrapf(err, "failed to get vm-operator ContentLibraryProvider %s", contentLibraryProvider.Name) - return false, nil - } - if err := c.Create(ctx, contentLibraryProvider); err != nil { - retryError = errors.Wrapf(err, "failed to create vm-operator ContentLibraryProvider %s", contentLibraryProvider.Name) - return false, nil - } - log.Info("Created vm-operator ContentLibraryProvider", "ContentSource", klog.KObj(contentSource), "ContentLibraryProvider", klog.KObj(contentLibraryProvider)) - } - return true, nil - }) - if retryError != nil { - return retryError - } - for _, item := range config.Spec.VCenter.ContentLibrary.Items { libraryItem := library.Item{ Name: item.Name, @@ -596,28 +475,12 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon Namespace: config.Namespace, }, Spec: vmoprv1.VirtualMachineImageSpec{ - ImageID: libraryItemID, - ImageSourceType: "Content Library", - Type: "ovf", - ProviderRef: vmoprv1.ContentProviderReference{ - APIVersion: vmoprv1.SchemeGroupVersion.String(), - Kind: "ContentLibraryItem", - // Not 100% sure about following values now that Kind is required to be ContentLibraryItem, but this doesn't seem to be an issue - Name: contentLibraryProvider.Name, - Namespace: contentLibraryProvider.Namespace, - }, - ProductInfo: vmoprv1.VirtualMachineImageProductInfo{ - FullVersion: item.ProductInfo, - }, - OSInfo: vmoprv1.VirtualMachineImageOSInfo{ - Type: item.OSInfo, + ProviderRef: vmoprv1common.LocalObjectRef{ + Kind: "ContentLibraryItem", }, }, } - if err := controllerutil.SetOwnerReference(contentLibraryProvider, virtualMachineImage, c.Scheme()); err != nil { - return errors.Wrap(err, "failed to set VirtualMachineImage owner") - } _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { retryError = nil if err := c.Get(ctx, client.ObjectKeyFromObject(virtualMachineImage), virtualMachineImage); err != nil { @@ -629,7 +492,7 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon retryError = errors.Wrapf(err, "failed to create vm-operator VirtualMachineImage %s", virtualMachineImage.Name) return false, nil } - log.Info("Created vm-operator VirtualMachineImage", "ContentSource", klog.KObj(contentSource), "ContentLibraryProvider", klog.KObj(contentLibraryProvider), "VirtualMachineImage", klog.KObj(virtualMachineImage)) + log.Info("Created vm-operator VirtualMachineImage", "VirtualMachineImage", klog.KObj(virtualMachineImage)) } return true, nil }) @@ -639,14 +502,25 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon // Fakes reconciliation of virtualMachineImage by setting required status field for the image to be considered ready. virtualMachineImageReconciled := virtualMachineImage.DeepCopy() - virtualMachineImageReconciled.Status.ImageName = virtualMachineImage.Name - Set(virtualMachineImageReconciled, TrueCondition(ReadyConditionType)) + virtualMachineImageReconciled.Status.Name = virtualMachineImage.Name + virtualMachineImageReconciled.Status.ProviderItemID = libraryItemID + virtualMachineImageReconciled.Status.ProductInfo = vmoprv1.VirtualMachineImageProductInfo{ + FullVersion: item.ProductInfo, + } + virtualMachineImageReconciled.Status.OSInfo = vmoprv1.VirtualMachineImageOSInfo{ + Type: item.OSInfo, + } + meta.SetStatusCondition(&virtualMachineImageReconciled.Status.Conditions, metav1.Condition{ + Type: "Ready", + Status: metav1.ConditionTrue, + Reason: string(metav1.ConditionTrue), + }) _ = wait.PollUntilContextTimeout(ctx, 250*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { retryError = nil if err := c.Status().Patch(ctx, virtualMachineImageReconciled, client.MergeFrom(virtualMachineImage)); err != nil { retryError = errors.Wrapf(err, "failed to patch vm-operator VirtualMachineImage %s", virtualMachineImage.Name) } - log.Info("Patched vm-operator VirtualMachineImage", "ContentSource", klog.KObj(contentSource), "ContentLibraryProvider", klog.KObj(contentLibraryProvider), "VirtualMachineImage", klog.KObj(virtualMachineImage)) + log.Info("Patched vm-operator VirtualMachineImage", "VirtualMachineImage", klog.KObj(virtualMachineImage)) return true, nil }) if retryError != nil { @@ -784,82 +658,3 @@ func GetDistributedPortGroup(ctx context.Context, c client.Client) (string, erro return distributedPortGroup, nil } - -// NOTE: code below is a fork of vm-operator's pkg/conditions (so we can avoid to import the entire project). - -const ( - ReadyConditionType = "Ready" -) - -type Getter interface { - client.Object - - // GetConditions returns the list of conditions for a cluster API object. - GetConditions() vmoprv1.Conditions -} - -type Setter interface { - Getter - SetConditions(vmoprv1.Conditions) -} - -func Set(to Setter, condition *vmoprv1.Condition) { - if to == nil || condition == nil { - return - } - - // Check if the new conditions already exists, and change it only if there is a status - // transition (otherwise we should preserve the current last transition time)- - conditions := to.GetConditions() - exists := false - for i := range conditions { - existingCondition := conditions[i] - if existingCondition.Type == condition.Type { - exists = true - if !hasSameState(&existingCondition, condition) { - condition.LastTransitionTime = metav1.NewTime(time.Now().UTC().Truncate(time.Second)) - conditions[i] = *condition - break - } - condition.LastTransitionTime = existingCondition.LastTransitionTime - break - } - } - - // If the condition does not exist, add it, setting the transition time only if not already set - if !exists { - if condition.LastTransitionTime.IsZero() { - condition.LastTransitionTime = metav1.NewTime(time.Now().UTC().Truncate(time.Second)) - } - conditions = append(conditions, *condition) - } - - // Sorts conditions for convenience of the consumer, i.e. kubectl. - sort.Slice(conditions, func(i, j int) bool { - return lexicographicLess(&conditions[i], &conditions[j]) - }) - - to.SetConditions(conditions) -} - -func lexicographicLess(i, j *vmoprv1.Condition) bool { - return (i.Type == ReadyConditionType || i.Type < j.Type) && j.Type != ReadyConditionType -} - -func hasSameState(i, j *vmoprv1.Condition) bool { - return i.Type == j.Type && - i.Status == j.Status && - i.Reason == j.Reason && - i.Message == j.Message -} - -func TrueCondition(t vmoprv1.ConditionType) *vmoprv1.Condition { - return &vmoprv1.Condition{ - Type: t, - Status: corev1.ConditionTrue, - // This is a non-empty field in metav1.Conditions, when it was not in our v1a1 Conditions. This - // really doesn't work with how we've defined our conditions so do something to make things - // work for now. - Reason: string(corev1.ConditionTrue), - } -} diff --git a/test/go.sum b/test/go.sum index 6654511370..0037ba88dd 100644 --- a/test/go.sum +++ b/test/go.sum @@ -625,8 +625,6 @@ github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9 github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9505/go.mod h1:5rqRJ9zGR+KnKbkGx373WgN8xJpvAj99kHnfoDYRO5I= github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 h1:/6vFL20UMHOeTf/mb+dKf5sFG0FBbyrCBY/71QKAIE0= github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505/go.mod h1:dfYrWS8DMRN+XZfhu8M4LVHmeGvYB29Ipd7j4uIq+mU= -github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 h1:LRMZ+zzb944d6r+uYsE+CuJ3zVBE6Hc8vjH7IJX2QY4= -github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505/go.mod h1:M+6bZCS8vSjCN9OOppnAyYxeBxY1U0wG6+j3CvIrOHY= github.com/vmware/govmomi v0.38.0 h1:UvQpLAOjDpO0JUxoPCXnEzOlEa/9kejO6K58qOFr6cM= github.com/vmware/govmomi v0.38.0/go.mod h1:mtGWtM+YhTADHlCgJBiskSRPOZRsN9MSjPzaZLte/oQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= diff --git a/test/infrastructure/vcsim/config/rbac/role.yaml b/test/infrastructure/vcsim/config/rbac/role.yaml index 5f9f73c2cc..568e138551 100644 --- a/test/infrastructure/vcsim/config/rbac/role.yaml +++ b/test/infrastructure/vcsim/config/rbac/role.yaml @@ -189,42 +189,6 @@ rules: - get - patch - update -- apiGroups: - - vmoperator.vmware.com - resources: - - contentlibraryproviders - verbs: - - create - - get - - list - - watch -- apiGroups: - - vmoperator.vmware.com - resources: - - contentsourcebindings - verbs: - - create - - get - - list - - watch -- apiGroups: - - vmoperator.vmware.com - resources: - - contentsources - verbs: - - create - - get - - list - - watch -- apiGroups: - - vmoperator.vmware.com - resources: - - virtualmachineclassbindings - verbs: - - create - - get - - list - - watch - apiGroups: - vmoperator.vmware.com resources: diff --git a/test/infrastructure/vcsim/controllers/vcsim_controller.go b/test/infrastructure/vcsim/controllers/vcsim_controller.go index fcf83e93a1..34d80b95c6 100644 --- a/test/infrastructure/vcsim/controllers/vcsim_controller.go +++ b/test/infrastructure/vcsim/controllers/vcsim_controller.go @@ -71,10 +71,6 @@ type VCenterSimulatorReconciler struct { // +kubebuilder:rbac:groups=vcsim.infrastructure.cluster.x-k8s.io,resources=vcentersimulators/status,verbs=get;update;patch // +kubebuilder:rbac:groups=topology.tanzu.vmware.com,resources=availabilityzones,verbs=get;list;watch;create;update // +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=virtualmachineclasses,verbs=get;list;watch;create -// +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=virtualmachineclassbindings,verbs=get;list;watch;create -// +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=contentlibraryproviders,verbs=get;list;watch;create -// +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=contentsources,verbs=get;list;watch;create -// +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=contentsourcebindings,verbs=get;list;watch;create // +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=virtualmachineimages,verbs=get;list;watch;create // +kubebuilder:rbac:groups=vmoperator.vmware.com,resources=virtualmachineimages/status,verbs=get;update;patch // +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list;watch;create diff --git a/test/infrastructure/vcsim/controllers/virtualmachine_controller.go b/test/infrastructure/vcsim/controllers/virtualmachine_controller.go index 3c805a1fda..f7703d2a43 100644 --- a/test/infrastructure/vcsim/controllers/virtualmachine_controller.go +++ b/test/infrastructure/vcsim/controllers/virtualmachine_controller.go @@ -22,7 +22,7 @@ import ( "path" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kerrors "k8s.io/apimachinery/pkg/util/errors" @@ -259,7 +259,7 @@ func (r *VirtualMachineReconciler) getVMIpReconciler(cluster *clusterv1.Cluster, }, IsVMWaitingforIP: func() bool { // A virtualMachine is waiting for an IP when PoweredOn but without an Ip. - return virtualMachine.Status.PowerState == vmoprv1.VirtualMachinePoweredOn && virtualMachine.Status.VmIp == "" + return virtualMachine.Status.PowerState == vmoprv1.VirtualMachinePowerStateOn && (virtualMachine.Status.Network == nil || (virtualMachine.Status.Network.PrimaryIP4 == "" && virtualMachine.Status.Network.PrimaryIP6 == "")) }, GetVMPath: func() string { // The vm operator always create VMs under a sub-folder with named like the cluster. @@ -279,7 +279,7 @@ func (r *VirtualMachineReconciler) getVMBootstrapReconciler(virtualMachine *vmop // thus allowing to use the same vmBootstrapReconciler in both scenarios. IsVMReady: func() bool { // A virtualMachine is ready to provision fake objects hosted on it when PoweredOn, with a primary Ip assigned and BiosUUID is set (bios id is required when provisioning the node to compute the Provider ID). - return virtualMachine.Status.PowerState == vmoprv1.VirtualMachinePoweredOn && virtualMachine.Status.VmIp != "" && virtualMachine.Status.BiosUUID != "" + return virtualMachine.Status.PowerState == vmoprv1.VirtualMachinePowerStateOn && virtualMachine.Status.Network != nil && (virtualMachine.Status.Network.PrimaryIP4 != "" || virtualMachine.Status.Network.PrimaryIP6 != "") && virtualMachine.Status.BiosUUID != "" }, GetProviderID: func() string { // Computes the ProviderID for the node hosted on the virtualMachine diff --git a/test/infrastructure/vcsim/controllers/virtualmachine_controller_test.go b/test/infrastructure/vcsim/controllers/virtualmachine_controller_test.go index f2e3c43803..f5af6a4d21 100644 --- a/test/infrastructure/vcsim/controllers/virtualmachine_controller_test.go +++ b/test/infrastructure/vcsim/controllers/virtualmachine_controller_test.go @@ -21,7 +21,7 @@ import ( "time" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -240,9 +240,11 @@ func Test_Reconcile_VirtualMachine(t *testing.T) { }, Status: vmoprv1.VirtualMachineStatus{ // Those values are required to unblock provisioning of node - BiosUUID: "foo", - VmIp: "1.2.3.4", - PowerState: vmoprv1.VirtualMachinePoweredOn, + BiosUUID: "foo", + Network: &vmoprv1.VirtualMachineNetworkStatus{ + PrimaryIP4: "1.2.3.4", + }, + PowerState: vmoprv1.VirtualMachinePowerStateOn, }, } diff --git a/test/infrastructure/vcsim/controllers/vspherevm_controller_test.go b/test/infrastructure/vcsim/controllers/vspherevm_controller_test.go index 8365f64b75..e5039fe5e5 100644 --- a/test/infrastructure/vcsim/controllers/vspherevm_controller_test.go +++ b/test/infrastructure/vcsim/controllers/vspherevm_controller_test.go @@ -22,7 +22,7 @@ import ( "time" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" diff --git a/test/infrastructure/vcsim/main.go b/test/infrastructure/vcsim/main.go index 86423c38eb..2eded290ca 100644 --- a/test/infrastructure/vcsim/main.go +++ b/test/infrastructure/vcsim/main.go @@ -28,7 +28,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/pflag" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1"