From 58f38be36c270442361b37b8c11eb0c1028518d5 Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Fri, 26 Jan 2024 16:59:06 +0800 Subject: [PATCH 1/8] generate vmop clientset code Signed-off-by: Xudong Liu --- .../applyconfiguration/internal/internal.go | 62 +++++ .../vmop/applyconfiguration/utils.go | 113 ++++++++ .../vmop/v1alpha1/clustermodulespec.go | 39 +++ .../vmop/v1alpha1/clustermodulestatus.go | 48 ++++ .../vmop/v1alpha1/folderspec.go | 39 +++ .../vmop/v1alpha1/loadbalanceringress.go | 48 ++++ .../vmop/v1alpha1/loadbalancerstatus.go | 44 +++ .../networkinterfaceproviderreference.go | 66 +++++ .../applyconfiguration/vmop/v1alpha1/probe.go | 57 ++++ .../vmop/v1alpha1/resourcepoolspec.go | 57 ++++ .../vmop/v1alpha1/tcpsocketaction.go | 52 ++++ .../vmop/v1alpha1/virtualmachine.go | 219 +++++++++++++++ .../v1alpha1/virtualmachineadvancedoptions.go | 48 ++++ .../vmop/v1alpha1/virtualmachineclass.go | 219 +++++++++++++++ .../v1alpha1/virtualmachineclasshardware.go | 52 ++++ .../v1alpha1/virtualmachineclasspolicies.go | 39 +++ .../v1alpha1/virtualmachineclassresources.go | 48 ++++ .../vmop/v1alpha1/virtualmachineclassspec.go | 48 ++++ .../vmop/v1alpha1/virtualmachinecondition.go | 80 ++++++ .../vmop/v1alpha1/virtualmachineimage.go | 218 +++++++++++++++ .../v1alpha1/virtualmachineimageosinfo.go | 48 ++++ .../virtualmachineimageproductinfo.go | 66 +++++ .../vmop/v1alpha1/virtualmachineimagespec.go | 66 +++++ .../v1alpha1/virtualmachineimagestatus.go | 66 +++++ .../vmop/v1alpha1/virtualmachinemetadata.go | 52 ++++ .../virtualmachinenetworkinterface.go | 66 +++++ .../vmop/v1alpha1/virtualmachineport.go | 70 +++++ .../v1alpha1/virtualmachineresourcespec.go | 52 ++++ .../vmop/v1alpha1/virtualmachineservice.go | 219 +++++++++++++++ .../v1alpha1/virtualmachineserviceport.go | 66 +++++ .../v1alpha1/virtualmachineservicespec.go | 110 ++++++++ .../v1alpha1/virtualmachineservicestatus.go | 39 +++ .../virtualmachinesetresourcepolicy.go | 219 +++++++++++++++ .../virtualmachinesetresourcepolicyspec.go | 62 +++++ .../virtualmachinesetresourcepolicystatus.go | 44 +++ .../vmop/v1alpha1/virtualmachinespec.go | 148 ++++++++++ .../vmop/v1alpha1/virtualmachinestatus.go | 134 +++++++++ .../vmop/v1alpha1/virtualmachinevolume.go | 79 ++++++ ...virtualmachinevolumeprovisioningoptions.go | 48 ++++ .../v1alpha1/virtualmachinevolumestatus.go | 66 +++++ .../vmop/v1alpha1/vspherevolumesource.go | 52 ++++ .../vmop/clientset/versioned/clientset.go | 120 ++++++++ .../versioned/fake/clientset_generated.go | 85 ++++++ .../vmop/clientset/versioned/fake/doc.go | 20 ++ .../vmop/clientset/versioned/fake/register.go | 56 ++++ .../vmop/clientset/versioned/scheme/doc.go | 20 ++ .../clientset/versioned/scheme/register.go | 56 ++++ .../versioned/typed/vmop/v1alpha1/doc.go | 20 ++ .../versioned/typed/vmop/v1alpha1/fake/doc.go | 20 ++ .../vmop/v1alpha1/fake/fake_virtualmachine.go | 189 +++++++++++++ .../v1alpha1/fake/fake_virtualmachineclass.go | 178 ++++++++++++ .../v1alpha1/fake/fake_virtualmachineimage.go | 178 ++++++++++++ .../fake/fake_virtualmachineservice.go | 189 +++++++++++++ .../fake_virtualmachinesetresourcepolicy.go | 189 +++++++++++++ .../vmop/v1alpha1/fake/fake_vmop_client.go | 56 ++++ .../vmop/v1alpha1/generated_expansion.go | 29 ++ .../typed/vmop/v1alpha1/virtualmachine.go | 256 +++++++++++++++++ .../vmop/v1alpha1/virtualmachineclass.go | 243 ++++++++++++++++ .../vmop/v1alpha1/virtualmachineimage.go | 243 ++++++++++++++++ .../vmop/v1alpha1/virtualmachineservice.go | 256 +++++++++++++++++ .../virtualmachinesetresourcepolicy.go | 256 +++++++++++++++++ .../typed/vmop/v1alpha1/vmop_client.go | 127 +++++++++ .../informers/externalversions/factory.go | 261 ++++++++++++++++++ .../informers/externalversions/generic.go | 70 +++++ .../internalinterfaces/factory_interfaces.go | 40 +++ .../externalversions/vmop/interface.go | 46 +++ .../vmop/v1alpha1/interface.go | 73 +++++ .../vmop/v1alpha1/virtualmachine.go | 90 ++++++ .../vmop/v1alpha1/virtualmachineclass.go | 89 ++++++ .../vmop/v1alpha1/virtualmachineimage.go | 89 ++++++ .../vmop/v1alpha1/virtualmachineservice.go | 90 ++++++ .../virtualmachinesetresourcepolicy.go | 90 ++++++ .../vmop/v1alpha1/expansion_generated.go | 51 ++++ .../listers/vmop/v1alpha1/virtualmachine.go | 99 +++++++ .../vmop/v1alpha1/virtualmachineclass.go | 68 +++++ .../vmop/v1alpha1/virtualmachineimage.go | 68 +++++ .../vmop/v1alpha1/virtualmachineservice.go | 99 +++++++ .../virtualmachinesetresourcepolicy.go | 99 +++++++ 78 files changed, 7576 insertions(+) create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go new file mode 100644 index 000000000..eb6431c35 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go @@ -0,0 +1,62 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go new file mode 100644 index 000000000..611944add --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go @@ -0,0 +1,113 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package applyconfiguration + +import ( + schema "k8s.io/apimachinery/pkg/runtime/schema" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=vmoperator.vmware.com, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("ClusterModuleSpec"): + return &vmopv1alpha1.ClusterModuleSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ClusterModuleStatus"): + return &vmopv1alpha1.ClusterModuleStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("FolderSpec"): + return &vmopv1alpha1.FolderSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("LoadBalancerIngress"): + return &vmopv1alpha1.LoadBalancerIngressApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("LoadBalancerStatus"): + return &vmopv1alpha1.LoadBalancerStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceProviderReference"): + return &vmopv1alpha1.NetworkInterfaceProviderReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Probe"): + return &vmopv1alpha1.ProbeApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourcePoolSpec"): + return &vmopv1alpha1.ResourcePoolSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TCPSocketAction"): + return &vmopv1alpha1.TCPSocketActionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachine"): + return &vmopv1alpha1.VirtualMachineApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineAdvancedOptions"): + return &vmopv1alpha1.VirtualMachineAdvancedOptionsApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClass"): + return &vmopv1alpha1.VirtualMachineClassApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassHardware"): + return &vmopv1alpha1.VirtualMachineClassHardwareApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassPolicies"): + return &vmopv1alpha1.VirtualMachineClassPoliciesApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassResources"): + return &vmopv1alpha1.VirtualMachineClassResourcesApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassSpec"): + return &vmopv1alpha1.VirtualMachineClassSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineCondition"): + return &vmopv1alpha1.VirtualMachineConditionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImage"): + return &vmopv1alpha1.VirtualMachineImageApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageOSInfo"): + return &vmopv1alpha1.VirtualMachineImageOSInfoApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageProductInfo"): + return &vmopv1alpha1.VirtualMachineImageProductInfoApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageSpec"): + return &vmopv1alpha1.VirtualMachineImageSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageStatus"): + return &vmopv1alpha1.VirtualMachineImageStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineMetadata"): + return &vmopv1alpha1.VirtualMachineMetadataApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineNetworkInterface"): + return &vmopv1alpha1.VirtualMachineNetworkInterfaceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachinePort"): + return &vmopv1alpha1.VirtualMachinePortApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineResourceSpec"): + return &vmopv1alpha1.VirtualMachineResourceSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineService"): + return &vmopv1alpha1.VirtualMachineServiceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServicePort"): + return &vmopv1alpha1.VirtualMachineServicePortApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServiceSpec"): + return &vmopv1alpha1.VirtualMachineServiceSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServiceStatus"): + return &vmopv1alpha1.VirtualMachineServiceStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicy"): + return &vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicySpec"): + return &vmopv1alpha1.VirtualMachineSetResourcePolicySpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicyStatus"): + return &vmopv1alpha1.VirtualMachineSetResourcePolicyStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSpec"): + return &vmopv1alpha1.VirtualMachineSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineStatus"): + return &vmopv1alpha1.VirtualMachineStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolume"): + return &vmopv1alpha1.VirtualMachineVolumeApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolumeProvisioningOptions"): + return &vmopv1alpha1.VirtualMachineVolumeProvisioningOptionsApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolumeStatus"): + return &vmopv1alpha1.VirtualMachineVolumeStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("VsphereVolumeSource"): + return &vmopv1alpha1.VsphereVolumeSourceApplyConfiguration{} + + } + return nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go new file mode 100644 index 000000000..05f64e7fd --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterModuleSpecApplyConfiguration represents an declarative configuration of the ClusterModuleSpec type for use +// with apply. +type ClusterModuleSpecApplyConfiguration struct { + GroupName *string `json:"groupname,omitempty"` +} + +// ClusterModuleSpecApplyConfiguration constructs an declarative configuration of the ClusterModuleSpec type for use with +// apply. +func ClusterModuleSpec() *ClusterModuleSpecApplyConfiguration { + return &ClusterModuleSpecApplyConfiguration{} +} + +// WithGroupName sets the GroupName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GroupName field is set to the value of the last call. +func (b *ClusterModuleSpecApplyConfiguration) WithGroupName(value string) *ClusterModuleSpecApplyConfiguration { + b.GroupName = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go new file mode 100644 index 000000000..50b933943 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterModuleStatusApplyConfiguration represents an declarative configuration of the ClusterModuleStatus type for use +// with apply. +type ClusterModuleStatusApplyConfiguration struct { + GroupName *string `json:"groupname,omitempty"` + ModuleUuid *string `json:"moduleUUID,omitempty"` +} + +// ClusterModuleStatusApplyConfiguration constructs an declarative configuration of the ClusterModuleStatus type for use with +// apply. +func ClusterModuleStatus() *ClusterModuleStatusApplyConfiguration { + return &ClusterModuleStatusApplyConfiguration{} +} + +// WithGroupName sets the GroupName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GroupName field is set to the value of the last call. +func (b *ClusterModuleStatusApplyConfiguration) WithGroupName(value string) *ClusterModuleStatusApplyConfiguration { + b.GroupName = &value + return b +} + +// WithModuleUuid sets the ModuleUuid field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ModuleUuid field is set to the value of the last call. +func (b *ClusterModuleStatusApplyConfiguration) WithModuleUuid(value string) *ClusterModuleStatusApplyConfiguration { + b.ModuleUuid = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go new file mode 100644 index 000000000..89a5f83df --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// FolderSpecApplyConfiguration represents an declarative configuration of the FolderSpec type for use +// with apply. +type FolderSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// FolderSpecApplyConfiguration constructs an declarative configuration of the FolderSpec type for use with +// apply. +func FolderSpec() *FolderSpecApplyConfiguration { + return &FolderSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *FolderSpecApplyConfiguration) WithName(value string) *FolderSpecApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go new file mode 100644 index 000000000..5f33a9469 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// LoadBalancerIngressApplyConfiguration represents an declarative configuration of the LoadBalancerIngress type for use +// with apply. +type LoadBalancerIngressApplyConfiguration struct { + IP *string `json:"ip,omitempty"` + Hostname *string `json:"hostname,omitempty"` +} + +// LoadBalancerIngressApplyConfiguration constructs an declarative configuration of the LoadBalancerIngress type for use with +// apply. +func LoadBalancerIngress() *LoadBalancerIngressApplyConfiguration { + return &LoadBalancerIngressApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *LoadBalancerIngressApplyConfiguration) WithIP(value string) *LoadBalancerIngressApplyConfiguration { + b.IP = &value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *LoadBalancerIngressApplyConfiguration) WithHostname(value string) *LoadBalancerIngressApplyConfiguration { + b.Hostname = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go new file mode 100644 index 000000000..d2d6ae4c6 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go @@ -0,0 +1,44 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// LoadBalancerStatusApplyConfiguration represents an declarative configuration of the LoadBalancerStatus type for use +// with apply. +type LoadBalancerStatusApplyConfiguration struct { + Ingress []LoadBalancerIngressApplyConfiguration `json:"ingress,omitempty"` +} + +// LoadBalancerStatusApplyConfiguration constructs an declarative configuration of the LoadBalancerStatus type for use with +// apply. +func LoadBalancerStatus() *LoadBalancerStatusApplyConfiguration { + return &LoadBalancerStatusApplyConfiguration{} +} + +// WithIngress adds the given value to the Ingress field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ingress field. +func (b *LoadBalancerStatusApplyConfiguration) WithIngress(values ...*LoadBalancerIngressApplyConfiguration) *LoadBalancerStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIngress") + } + b.Ingress = append(b.Ingress, *values[i]) + } + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go new file mode 100644 index 000000000..18187b26c --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// NetworkInterfaceProviderReferenceApplyConfiguration represents an declarative configuration of the NetworkInterfaceProviderReference type for use +// with apply. +type NetworkInterfaceProviderReferenceApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` +} + +// NetworkInterfaceProviderReferenceApplyConfiguration constructs an declarative configuration of the NetworkInterfaceProviderReference type for use with +// apply. +func NetworkInterfaceProviderReference() *NetworkInterfaceProviderReferenceApplyConfiguration { + return &NetworkInterfaceProviderReferenceApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithAPIGroup(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithKind(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithName(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithAPIVersion(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go new file mode 100644 index 000000000..e27555a53 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go @@ -0,0 +1,57 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ProbeApplyConfiguration represents an declarative configuration of the Probe type for use +// with apply. +type ProbeApplyConfiguration struct { + TCPSocket *TCPSocketActionApplyConfiguration `json:"tcpSocket,omitempty"` + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` +} + +// ProbeApplyConfiguration constructs an declarative configuration of the Probe type for use with +// apply. +func Probe() *ProbeApplyConfiguration { + return &ProbeApplyConfiguration{} +} + +// WithTCPSocket sets the TCPSocket field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TCPSocket field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithTCPSocket(value *TCPSocketActionApplyConfiguration) *ProbeApplyConfiguration { + b.TCPSocket = value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithTimeoutSeconds(value int32) *ProbeApplyConfiguration { + b.TimeoutSeconds = &value + return b +} + +// WithPeriodSeconds sets the PeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PeriodSeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithPeriodSeconds(value int32) *ProbeApplyConfiguration { + b.PeriodSeconds = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go new file mode 100644 index 000000000..2aad5744d --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go @@ -0,0 +1,57 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResourcePoolSpecApplyConfiguration represents an declarative configuration of the ResourcePoolSpec type for use +// with apply. +type ResourcePoolSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Reservations *VirtualMachineResourceSpecApplyConfiguration `json:"reservations,omitempty"` + Limits *VirtualMachineResourceSpecApplyConfiguration `json:"limits,omitempty"` +} + +// ResourcePoolSpecApplyConfiguration constructs an declarative configuration of the ResourcePoolSpec type for use with +// apply. +func ResourcePoolSpec() *ResourcePoolSpecApplyConfiguration { + return &ResourcePoolSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourcePoolSpecApplyConfiguration) WithName(value string) *ResourcePoolSpecApplyConfiguration { + b.Name = &value + return b +} + +// WithReservations sets the Reservations field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reservations field is set to the value of the last call. +func (b *ResourcePoolSpecApplyConfiguration) WithReservations(value *VirtualMachineResourceSpecApplyConfiguration) *ResourcePoolSpecApplyConfiguration { + b.Reservations = value + return b +} + +// WithLimits sets the Limits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Limits field is set to the value of the last call. +func (b *ResourcePoolSpecApplyConfiguration) WithLimits(value *VirtualMachineResourceSpecApplyConfiguration) *ResourcePoolSpecApplyConfiguration { + b.Limits = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go new file mode 100644 index 000000000..f755c5846 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// TCPSocketActionApplyConfiguration represents an declarative configuration of the TCPSocketAction type for use +// with apply. +type TCPSocketActionApplyConfiguration struct { + Port *intstr.IntOrString `json:"port,omitempty"` + Host *string `json:"host,omitempty"` +} + +// TCPSocketActionApplyConfiguration constructs an declarative configuration of the TCPSocketAction type for use with +// apply. +func TCPSocketAction() *TCPSocketActionApplyConfiguration { + return &TCPSocketActionApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *TCPSocketActionApplyConfiguration) WithPort(value intstr.IntOrString) *TCPSocketActionApplyConfiguration { + b.Port = &value + return b +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *TCPSocketActionApplyConfiguration) WithHost(value string) *TCPSocketActionApplyConfiguration { + b.Host = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go new file mode 100644 index 000000000..96358cbd5 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go @@ -0,0 +1,219 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VirtualMachineApplyConfiguration represents an declarative configuration of the VirtualMachine type for use +// with apply. +type VirtualMachineApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualMachineSpecApplyConfiguration `json:"spec,omitempty"` + Status *VirtualMachineStatusApplyConfiguration `json:"status,omitempty"` +} + +// VirtualMachine constructs an declarative configuration of the VirtualMachine type for use with +// apply. +func VirtualMachine(name, namespace string) *VirtualMachineApplyConfiguration { + b := &VirtualMachineApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("VirtualMachine") + b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithKind(value string) *VirtualMachineApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithAPIVersion(value string) *VirtualMachineApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithName(value string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithGenerateName(value string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithNamespace(value string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithUID(value types.UID) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithResourceVersion(value string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithGeneration(value int64) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualMachineApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualMachineApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualMachineApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualMachineApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualMachineApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithSpec(value *VirtualMachineSpecApplyConfiguration) *VirtualMachineApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineApplyConfiguration) WithStatus(value *VirtualMachineStatusApplyConfiguration) *VirtualMachineApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go new file mode 100644 index 000000000..32e435a95 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineAdvancedOptionsApplyConfiguration represents an declarative configuration of the VirtualMachineAdvancedOptions type for use +// with apply. +type VirtualMachineAdvancedOptionsApplyConfiguration struct { + DefaultVolumeProvisioningOptions *VirtualMachineVolumeProvisioningOptionsApplyConfiguration `json:"defaultVolumeProvisioningOptions,omitempty"` + ChangeBlockTracking *bool `json:"changeBlockTracking,omitempty"` +} + +// VirtualMachineAdvancedOptionsApplyConfiguration constructs an declarative configuration of the VirtualMachineAdvancedOptions type for use with +// apply. +func VirtualMachineAdvancedOptions() *VirtualMachineAdvancedOptionsApplyConfiguration { + return &VirtualMachineAdvancedOptionsApplyConfiguration{} +} + +// WithDefaultVolumeProvisioningOptions sets the DefaultVolumeProvisioningOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultVolumeProvisioningOptions field is set to the value of the last call. +func (b *VirtualMachineAdvancedOptionsApplyConfiguration) WithDefaultVolumeProvisioningOptions(value *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) *VirtualMachineAdvancedOptionsApplyConfiguration { + b.DefaultVolumeProvisioningOptions = value + return b +} + +// WithChangeBlockTracking sets the ChangeBlockTracking field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ChangeBlockTracking field is set to the value of the last call. +func (b *VirtualMachineAdvancedOptionsApplyConfiguration) WithChangeBlockTracking(value bool) *VirtualMachineAdvancedOptionsApplyConfiguration { + b.ChangeBlockTracking = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go new file mode 100644 index 000000000..2ee76a746 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go @@ -0,0 +1,219 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineClassApplyConfiguration represents an declarative configuration of the VirtualMachineClass type for use +// with apply. +type VirtualMachineClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualMachineClassSpecApplyConfiguration `json:"spec,omitempty"` + Status *vmopv1alpha1.VirtualMachineClassStatus `json:"status,omitempty"` +} + +// VirtualMachineClass constructs an declarative configuration of the VirtualMachineClass type for use with +// apply. +func VirtualMachineClass(name string) *VirtualMachineClassApplyConfiguration { + b := &VirtualMachineClassApplyConfiguration{} + b.WithName(name) + b.WithKind("VirtualMachineClass") + b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithKind(value string) *VirtualMachineClassApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithAPIVersion(value string) *VirtualMachineClassApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithName(value string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithGenerateName(value string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithNamespace(value string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithUID(value types.UID) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithResourceVersion(value string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithGeneration(value int64) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualMachineClassApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualMachineClassApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualMachineClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualMachineClassApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualMachineClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithSpec(value *VirtualMachineClassSpecApplyConfiguration) *VirtualMachineClassApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineClassApplyConfiguration) WithStatus(value vmopv1alpha1.VirtualMachineClassStatus) *VirtualMachineClassApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go new file mode 100644 index 000000000..dd6a6191f --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// VirtualMachineClassHardwareApplyConfiguration represents an declarative configuration of the VirtualMachineClassHardware type for use +// with apply. +type VirtualMachineClassHardwareApplyConfiguration struct { + Cpus *int64 `json:"cpus,omitempty"` + Memory *resource.Quantity `json:"memory,omitempty"` +} + +// VirtualMachineClassHardwareApplyConfiguration constructs an declarative configuration of the VirtualMachineClassHardware type for use with +// apply. +func VirtualMachineClassHardware() *VirtualMachineClassHardwareApplyConfiguration { + return &VirtualMachineClassHardwareApplyConfiguration{} +} + +// WithCpus sets the Cpus field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cpus field is set to the value of the last call. +func (b *VirtualMachineClassHardwareApplyConfiguration) WithCpus(value int64) *VirtualMachineClassHardwareApplyConfiguration { + b.Cpus = &value + return b +} + +// WithMemory sets the Memory field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Memory field is set to the value of the last call. +func (b *VirtualMachineClassHardwareApplyConfiguration) WithMemory(value resource.Quantity) *VirtualMachineClassHardwareApplyConfiguration { + b.Memory = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go new file mode 100644 index 000000000..afaf29102 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineClassPoliciesApplyConfiguration represents an declarative configuration of the VirtualMachineClassPolicies type for use +// with apply. +type VirtualMachineClassPoliciesApplyConfiguration struct { + Resources *VirtualMachineClassResourcesApplyConfiguration `json:"resources,omitempty"` +} + +// VirtualMachineClassPoliciesApplyConfiguration constructs an declarative configuration of the VirtualMachineClassPolicies type for use with +// apply. +func VirtualMachineClassPolicies() *VirtualMachineClassPoliciesApplyConfiguration { + return &VirtualMachineClassPoliciesApplyConfiguration{} +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *VirtualMachineClassPoliciesApplyConfiguration) WithResources(value *VirtualMachineClassResourcesApplyConfiguration) *VirtualMachineClassPoliciesApplyConfiguration { + b.Resources = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go new file mode 100644 index 000000000..0dcfb39e4 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineClassResourcesApplyConfiguration represents an declarative configuration of the VirtualMachineClassResources type for use +// with apply. +type VirtualMachineClassResourcesApplyConfiguration struct { + Requests *VirtualMachineResourceSpecApplyConfiguration `json:"requests,omitempty"` + Limits *VirtualMachineResourceSpecApplyConfiguration `json:"limits,omitempty"` +} + +// VirtualMachineClassResourcesApplyConfiguration constructs an declarative configuration of the VirtualMachineClassResources type for use with +// apply. +func VirtualMachineClassResources() *VirtualMachineClassResourcesApplyConfiguration { + return &VirtualMachineClassResourcesApplyConfiguration{} +} + +// WithRequests sets the Requests field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Requests field is set to the value of the last call. +func (b *VirtualMachineClassResourcesApplyConfiguration) WithRequests(value *VirtualMachineResourceSpecApplyConfiguration) *VirtualMachineClassResourcesApplyConfiguration { + b.Requests = value + return b +} + +// WithLimits sets the Limits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Limits field is set to the value of the last call. +func (b *VirtualMachineClassResourcesApplyConfiguration) WithLimits(value *VirtualMachineResourceSpecApplyConfiguration) *VirtualMachineClassResourcesApplyConfiguration { + b.Limits = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go new file mode 100644 index 000000000..c66b0b9f7 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineClassSpecApplyConfiguration represents an declarative configuration of the VirtualMachineClassSpec type for use +// with apply. +type VirtualMachineClassSpecApplyConfiguration struct { + Hardware *VirtualMachineClassHardwareApplyConfiguration `json:"hardware,omitempty"` + Policies *VirtualMachineClassPoliciesApplyConfiguration `json:"policies,omitempty"` +} + +// VirtualMachineClassSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineClassSpec type for use with +// apply. +func VirtualMachineClassSpec() *VirtualMachineClassSpecApplyConfiguration { + return &VirtualMachineClassSpecApplyConfiguration{} +} + +// WithHardware sets the Hardware field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hardware field is set to the value of the last call. +func (b *VirtualMachineClassSpecApplyConfiguration) WithHardware(value *VirtualMachineClassHardwareApplyConfiguration) *VirtualMachineClassSpecApplyConfiguration { + b.Hardware = value + return b +} + +// WithPolicies sets the Policies field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Policies field is set to the value of the last call. +func (b *VirtualMachineClassSpecApplyConfiguration) WithPolicies(value *VirtualMachineClassPoliciesApplyConfiguration) *VirtualMachineClassSpecApplyConfiguration { + b.Policies = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go new file mode 100644 index 000000000..24b9d3208 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go @@ -0,0 +1,80 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineConditionApplyConfiguration represents an declarative configuration of the VirtualMachineCondition type for use +// with apply. +type VirtualMachineConditionApplyConfiguration struct { + Type *v1alpha1.VirtualMachineConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// VirtualMachineConditionApplyConfiguration constructs an declarative configuration of the VirtualMachineCondition type for use with +// apply. +func VirtualMachineCondition() *VirtualMachineConditionApplyConfiguration { + return &VirtualMachineConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VirtualMachineConditionApplyConfiguration) WithType(value v1alpha1.VirtualMachineConditionType) *VirtualMachineConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *VirtualMachineConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *VirtualMachineConditionApplyConfiguration) WithLastTransitionTime(value v1.Time) *VirtualMachineConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *VirtualMachineConditionApplyConfiguration) WithReason(value string) *VirtualMachineConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *VirtualMachineConditionApplyConfiguration) WithMessage(value string) *VirtualMachineConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go new file mode 100644 index 000000000..fc15d9bb8 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go @@ -0,0 +1,218 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VirtualMachineImageApplyConfiguration represents an declarative configuration of the VirtualMachineImage type for use +// with apply. +type VirtualMachineImageApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualMachineImageSpecApplyConfiguration `json:"spec,omitempty"` + Status *VirtualMachineImageStatusApplyConfiguration `json:"status,omitempty"` +} + +// VirtualMachineImage constructs an declarative configuration of the VirtualMachineImage type for use with +// apply. +func VirtualMachineImage(name string) *VirtualMachineImageApplyConfiguration { + b := &VirtualMachineImageApplyConfiguration{} + b.WithName(name) + b.WithKind("VirtualMachineImage") + b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithKind(value string) *VirtualMachineImageApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithAPIVersion(value string) *VirtualMachineImageApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithName(value string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithGenerateName(value string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithNamespace(value string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithUID(value types.UID) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithResourceVersion(value string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithGeneration(value int64) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualMachineImageApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualMachineImageApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualMachineImageApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualMachineImageApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineImageApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualMachineImageApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithSpec(value *VirtualMachineImageSpecApplyConfiguration) *VirtualMachineImageApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineImageApplyConfiguration) WithStatus(value *VirtualMachineImageStatusApplyConfiguration) *VirtualMachineImageApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go new file mode 100644 index 000000000..ee3214ee0 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineImageOSInfoApplyConfiguration represents an declarative configuration of the VirtualMachineImageOSInfo type for use +// with apply. +type VirtualMachineImageOSInfoApplyConfiguration struct { + Version *string `json:"version,omitempty"` + Type *string `json:"type,omitempty"` +} + +// VirtualMachineImageOSInfoApplyConfiguration constructs an declarative configuration of the VirtualMachineImageOSInfo type for use with +// apply. +func VirtualMachineImageOSInfo() *VirtualMachineImageOSInfoApplyConfiguration { + return &VirtualMachineImageOSInfoApplyConfiguration{} +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *VirtualMachineImageOSInfoApplyConfiguration) WithVersion(value string) *VirtualMachineImageOSInfoApplyConfiguration { + b.Version = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VirtualMachineImageOSInfoApplyConfiguration) WithType(value string) *VirtualMachineImageOSInfoApplyConfiguration { + b.Type = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go new file mode 100644 index 000000000..23097beb3 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineImageProductInfoApplyConfiguration represents an declarative configuration of the VirtualMachineImageProductInfo type for use +// with apply. +type VirtualMachineImageProductInfoApplyConfiguration struct { + Product *string `json:"product,omitempty"` + Vendor *string `json:"vendor,omitempty"` + Version *string `json:"version,omitempty"` + FullVersion *string `json:"fullVersion,omitempty"` +} + +// VirtualMachineImageProductInfoApplyConfiguration constructs an declarative configuration of the VirtualMachineImageProductInfo type for use with +// apply. +func VirtualMachineImageProductInfo() *VirtualMachineImageProductInfoApplyConfiguration { + return &VirtualMachineImageProductInfoApplyConfiguration{} +} + +// WithProduct sets the Product field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Product field is set to the value of the last call. +func (b *VirtualMachineImageProductInfoApplyConfiguration) WithProduct(value string) *VirtualMachineImageProductInfoApplyConfiguration { + b.Product = &value + return b +} + +// WithVendor sets the Vendor field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Vendor field is set to the value of the last call. +func (b *VirtualMachineImageProductInfoApplyConfiguration) WithVendor(value string) *VirtualMachineImageProductInfoApplyConfiguration { + b.Vendor = &value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *VirtualMachineImageProductInfoApplyConfiguration) WithVersion(value string) *VirtualMachineImageProductInfoApplyConfiguration { + b.Version = &value + return b +} + +// WithFullVersion sets the FullVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FullVersion field is set to the value of the last call. +func (b *VirtualMachineImageProductInfoApplyConfiguration) WithFullVersion(value string) *VirtualMachineImageProductInfoApplyConfiguration { + b.FullVersion = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go new file mode 100644 index 000000000..cc3ec6a11 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineImageSpecApplyConfiguration represents an declarative configuration of the VirtualMachineImageSpec type for use +// with apply. +type VirtualMachineImageSpecApplyConfiguration struct { + Type *string `json:"type,omitempty"` + ImageSourceType *string `json:"imageSourceType,omitempty"` + ProductInfo *VirtualMachineImageProductInfoApplyConfiguration `json:"productInfo,omitempty"` + OSInfo *VirtualMachineImageOSInfoApplyConfiguration `json:"osInfo,omitempty"` +} + +// VirtualMachineImageSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineImageSpec type for use with +// apply. +func VirtualMachineImageSpec() *VirtualMachineImageSpecApplyConfiguration { + return &VirtualMachineImageSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VirtualMachineImageSpecApplyConfiguration) WithType(value string) *VirtualMachineImageSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithImageSourceType sets the ImageSourceType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageSourceType field is set to the value of the last call. +func (b *VirtualMachineImageSpecApplyConfiguration) WithImageSourceType(value string) *VirtualMachineImageSpecApplyConfiguration { + b.ImageSourceType = &value + return b +} + +// WithProductInfo sets the ProductInfo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProductInfo field is set to the value of the last call. +func (b *VirtualMachineImageSpecApplyConfiguration) WithProductInfo(value *VirtualMachineImageProductInfoApplyConfiguration) *VirtualMachineImageSpecApplyConfiguration { + b.ProductInfo = value + return b +} + +// WithOSInfo sets the OSInfo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OSInfo field is set to the value of the last call. +func (b *VirtualMachineImageSpecApplyConfiguration) WithOSInfo(value *VirtualMachineImageOSInfoApplyConfiguration) *VirtualMachineImageSpecApplyConfiguration { + b.OSInfo = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go new file mode 100644 index 000000000..a0c16cb76 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineImageStatusApplyConfiguration represents an declarative configuration of the VirtualMachineImageStatus type for use +// with apply. +type VirtualMachineImageStatusApplyConfiguration struct { + Uuid *string `json:"uuid,omitempty"` + InternalId *string `json:"internalId,omitempty"` + PowerState *string `json:"powerState,omitempty"` + GuestOSCustomizable *bool `json:"guestOsCustomizable,omitempty"` +} + +// VirtualMachineImageStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineImageStatus type for use with +// apply. +func VirtualMachineImageStatus() *VirtualMachineImageStatusApplyConfiguration { + return &VirtualMachineImageStatusApplyConfiguration{} +} + +// WithUuid sets the Uuid field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Uuid field is set to the value of the last call. +func (b *VirtualMachineImageStatusApplyConfiguration) WithUuid(value string) *VirtualMachineImageStatusApplyConfiguration { + b.Uuid = &value + return b +} + +// WithInternalId sets the InternalId field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalId field is set to the value of the last call. +func (b *VirtualMachineImageStatusApplyConfiguration) WithInternalId(value string) *VirtualMachineImageStatusApplyConfiguration { + b.InternalId = &value + return b +} + +// WithPowerState sets the PowerState field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PowerState field is set to the value of the last call. +func (b *VirtualMachineImageStatusApplyConfiguration) WithPowerState(value string) *VirtualMachineImageStatusApplyConfiguration { + b.PowerState = &value + return b +} + +// WithGuestOSCustomizable sets the GuestOSCustomizable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GuestOSCustomizable field is set to the value of the last call. +func (b *VirtualMachineImageStatusApplyConfiguration) WithGuestOSCustomizable(value bool) *VirtualMachineImageStatusApplyConfiguration { + b.GuestOSCustomizable = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go new file mode 100644 index 000000000..a61a0daca --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineMetadataApplyConfiguration represents an declarative configuration of the VirtualMachineMetadata type for use +// with apply. +type VirtualMachineMetadataApplyConfiguration struct { + ConfigMapName *string `json:"configMapName,omitempty"` + Transport *v1alpha1.VirtualMachineMetadataTransport `json:"transport,omitempty"` +} + +// VirtualMachineMetadataApplyConfiguration constructs an declarative configuration of the VirtualMachineMetadata type for use with +// apply. +func VirtualMachineMetadata() *VirtualMachineMetadataApplyConfiguration { + return &VirtualMachineMetadataApplyConfiguration{} +} + +// WithConfigMapName sets the ConfigMapName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMapName field is set to the value of the last call. +func (b *VirtualMachineMetadataApplyConfiguration) WithConfigMapName(value string) *VirtualMachineMetadataApplyConfiguration { + b.ConfigMapName = &value + return b +} + +// WithTransport sets the Transport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Transport field is set to the value of the last call. +func (b *VirtualMachineMetadataApplyConfiguration) WithTransport(value v1alpha1.VirtualMachineMetadataTransport) *VirtualMachineMetadataApplyConfiguration { + b.Transport = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go new file mode 100644 index 000000000..98325e478 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineNetworkInterfaceApplyConfiguration represents an declarative configuration of the VirtualMachineNetworkInterface type for use +// with apply. +type VirtualMachineNetworkInterfaceApplyConfiguration struct { + NetworkType *string `json:"networkType,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + ProviderRef *NetworkInterfaceProviderReferenceApplyConfiguration `json:"providerRef,omitempty"` + EthernetCardType *string `json:"ethernetCardType,omitempty"` +} + +// VirtualMachineNetworkInterfaceApplyConfiguration constructs an declarative configuration of the VirtualMachineNetworkInterface type for use with +// apply. +func VirtualMachineNetworkInterface() *VirtualMachineNetworkInterfaceApplyConfiguration { + return &VirtualMachineNetworkInterfaceApplyConfiguration{} +} + +// WithNetworkType sets the NetworkType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkType field is set to the value of the last call. +func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithNetworkType(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { + b.NetworkType = &value + return b +} + +// WithNetworkName sets the NetworkName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkName field is set to the value of the last call. +func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithNetworkName(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { + b.NetworkName = &value + return b +} + +// WithProviderRef sets the ProviderRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderRef field is set to the value of the last call. +func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithProviderRef(value *NetworkInterfaceProviderReferenceApplyConfiguration) *VirtualMachineNetworkInterfaceApplyConfiguration { + b.ProviderRef = value + return b +} + +// WithEthernetCardType sets the EthernetCardType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EthernetCardType field is set to the value of the last call. +func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithEthernetCardType(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { + b.EthernetCardType = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go new file mode 100644 index 000000000..ea1e78089 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go @@ -0,0 +1,70 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VirtualMachinePortApplyConfiguration represents an declarative configuration of the VirtualMachinePort type for use +// with apply. +type VirtualMachinePortApplyConfiguration struct { + Port *int `json:"port,omitempty"` + Ip *string `json:"ip,omitempty"` + Name *string `json:"name,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` +} + +// VirtualMachinePortApplyConfiguration constructs an declarative configuration of the VirtualMachinePort type for use with +// apply. +func VirtualMachinePort() *VirtualMachinePortApplyConfiguration { + return &VirtualMachinePortApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *VirtualMachinePortApplyConfiguration) WithPort(value int) *VirtualMachinePortApplyConfiguration { + b.Port = &value + return b +} + +// WithIp sets the Ip field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ip field is set to the value of the last call. +func (b *VirtualMachinePortApplyConfiguration) WithIp(value string) *VirtualMachinePortApplyConfiguration { + b.Ip = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachinePortApplyConfiguration) WithName(value string) *VirtualMachinePortApplyConfiguration { + b.Name = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *VirtualMachinePortApplyConfiguration) WithProtocol(value v1.Protocol) *VirtualMachinePortApplyConfiguration { + b.Protocol = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go new file mode 100644 index 000000000..cb9e19ba3 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// VirtualMachineResourceSpecApplyConfiguration represents an declarative configuration of the VirtualMachineResourceSpec type for use +// with apply. +type VirtualMachineResourceSpecApplyConfiguration struct { + Cpu *resource.Quantity `json:"cpu,omitempty"` + Memory *resource.Quantity `json:"memory,omitempty"` +} + +// VirtualMachineResourceSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineResourceSpec type for use with +// apply. +func VirtualMachineResourceSpec() *VirtualMachineResourceSpecApplyConfiguration { + return &VirtualMachineResourceSpecApplyConfiguration{} +} + +// WithCpu sets the Cpu field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cpu field is set to the value of the last call. +func (b *VirtualMachineResourceSpecApplyConfiguration) WithCpu(value resource.Quantity) *VirtualMachineResourceSpecApplyConfiguration { + b.Cpu = &value + return b +} + +// WithMemory sets the Memory field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Memory field is set to the value of the last call. +func (b *VirtualMachineResourceSpecApplyConfiguration) WithMemory(value resource.Quantity) *VirtualMachineResourceSpecApplyConfiguration { + b.Memory = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go new file mode 100644 index 000000000..f1a5cb52e --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go @@ -0,0 +1,219 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VirtualMachineServiceApplyConfiguration represents an declarative configuration of the VirtualMachineService type for use +// with apply. +type VirtualMachineServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualMachineServiceSpecApplyConfiguration `json:"spec,omitempty"` + Status *VirtualMachineServiceStatusApplyConfiguration `json:"status,omitempty"` +} + +// VirtualMachineService constructs an declarative configuration of the VirtualMachineService type for use with +// apply. +func VirtualMachineService(name, namespace string) *VirtualMachineServiceApplyConfiguration { + b := &VirtualMachineServiceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("VirtualMachineService") + b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithKind(value string) *VirtualMachineServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithAPIVersion(value string) *VirtualMachineServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithName(value string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithGenerateName(value string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithNamespace(value string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithUID(value types.UID) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithResourceVersion(value string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithGeneration(value int64) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualMachineServiceApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualMachineServiceApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualMachineServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualMachineServiceApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualMachineServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithSpec(value *VirtualMachineServiceSpecApplyConfiguration) *VirtualMachineServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineServiceApplyConfiguration) WithStatus(value *VirtualMachineServiceStatusApplyConfiguration) *VirtualMachineServiceApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go new file mode 100644 index 000000000..6bb05ecd1 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineServicePortApplyConfiguration represents an declarative configuration of the VirtualMachineServicePort type for use +// with apply. +type VirtualMachineServicePortApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Protocol *string `json:"protocol,omitempty"` + Port *int32 `json:"port,omitempty"` + TargetPort *int32 `json:"targetPort,omitempty"` +} + +// VirtualMachineServicePortApplyConfiguration constructs an declarative configuration of the VirtualMachineServicePort type for use with +// apply. +func VirtualMachineServicePort() *VirtualMachineServicePortApplyConfiguration { + return &VirtualMachineServicePortApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineServicePortApplyConfiguration) WithName(value string) *VirtualMachineServicePortApplyConfiguration { + b.Name = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *VirtualMachineServicePortApplyConfiguration) WithProtocol(value string) *VirtualMachineServicePortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *VirtualMachineServicePortApplyConfiguration) WithPort(value int32) *VirtualMachineServicePortApplyConfiguration { + b.Port = &value + return b +} + +// WithTargetPort sets the TargetPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetPort field is set to the value of the last call. +func (b *VirtualMachineServicePortApplyConfiguration) WithTargetPort(value int32) *VirtualMachineServicePortApplyConfiguration { + b.TargetPort = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go new file mode 100644 index 000000000..f6e690e95 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go @@ -0,0 +1,110 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineServiceSpecApplyConfiguration represents an declarative configuration of the VirtualMachineServiceSpec type for use +// with apply. +type VirtualMachineServiceSpecApplyConfiguration struct { + Type *v1alpha1.VirtualMachineServiceType `json:"type,omitempty"` + Ports []VirtualMachineServicePortApplyConfiguration `json:"ports,omitempty"` + Selector map[string]string `json:"selector,omitempty"` + LoadBalancerIP *string `json:"loadBalancerIP,omitempty"` + LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"` + ClusterIP *string `json:"clusterIp,omitempty"` + ExternalName *string `json:"externalName,omitempty"` +} + +// VirtualMachineServiceSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineServiceSpec type for use with +// apply. +func VirtualMachineServiceSpec() *VirtualMachineServiceSpecApplyConfiguration { + return &VirtualMachineServiceSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithType(value v1alpha1.VirtualMachineServiceType) *VirtualMachineServiceSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithPorts(values ...*VirtualMachineServicePortApplyConfiguration) *VirtualMachineServiceSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithSelector puts the entries into the Selector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Selector field, +// overwriting an existing map entries in Selector field with the same key. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithSelector(entries map[string]string) *VirtualMachineServiceSpecApplyConfiguration { + if b.Selector == nil && len(entries) > 0 { + b.Selector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Selector[k] = v + } + return b +} + +// WithLoadBalancerIP sets the LoadBalancerIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LoadBalancerIP field is set to the value of the last call. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithLoadBalancerIP(value string) *VirtualMachineServiceSpecApplyConfiguration { + b.LoadBalancerIP = &value + return b +} + +// WithLoadBalancerSourceRanges adds the given value to the LoadBalancerSourceRanges field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the LoadBalancerSourceRanges field. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithLoadBalancerSourceRanges(values ...string) *VirtualMachineServiceSpecApplyConfiguration { + for i := range values { + b.LoadBalancerSourceRanges = append(b.LoadBalancerSourceRanges, values[i]) + } + return b +} + +// WithClusterIP sets the ClusterIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterIP field is set to the value of the last call. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithClusterIP(value string) *VirtualMachineServiceSpecApplyConfiguration { + b.ClusterIP = &value + return b +} + +// WithExternalName sets the ExternalName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalName field is set to the value of the last call. +func (b *VirtualMachineServiceSpecApplyConfiguration) WithExternalName(value string) *VirtualMachineServiceSpecApplyConfiguration { + b.ExternalName = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go new file mode 100644 index 000000000..fd56ca568 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineServiceStatusApplyConfiguration represents an declarative configuration of the VirtualMachineServiceStatus type for use +// with apply. +type VirtualMachineServiceStatusApplyConfiguration struct { + LoadBalancer *LoadBalancerStatusApplyConfiguration `json:"loadBalancer,omitempty"` +} + +// VirtualMachineServiceStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineServiceStatus type for use with +// apply. +func VirtualMachineServiceStatus() *VirtualMachineServiceStatusApplyConfiguration { + return &VirtualMachineServiceStatusApplyConfiguration{} +} + +// WithLoadBalancer sets the LoadBalancer field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LoadBalancer field is set to the value of the last call. +func (b *VirtualMachineServiceStatusApplyConfiguration) WithLoadBalancer(value *LoadBalancerStatusApplyConfiguration) *VirtualMachineServiceStatusApplyConfiguration { + b.LoadBalancer = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go new file mode 100644 index 000000000..70a341a46 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -0,0 +1,219 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VirtualMachineSetResourcePolicyApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicy type for use +// with apply. +type VirtualMachineSetResourcePolicyApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualMachineSetResourcePolicySpecApplyConfiguration `json:"spec,omitempty"` + Status *VirtualMachineSetResourcePolicyStatusApplyConfiguration `json:"status,omitempty"` +} + +// VirtualMachineSetResourcePolicy constructs an declarative configuration of the VirtualMachineSetResourcePolicy type for use with +// apply. +func VirtualMachineSetResourcePolicy(name, namespace string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b := &VirtualMachineSetResourcePolicyApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("VirtualMachineSetResourcePolicy") + b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithKind(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithAPIVersion(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithName(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithGenerateName(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithNamespace(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithUID(value types.UID) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithResourceVersion(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithGeneration(value int64) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithSpec(value *VirtualMachineSetResourcePolicySpecApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithStatus(value *VirtualMachineSetResourcePolicyStatusApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go new file mode 100644 index 000000000..b526ddcf1 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go @@ -0,0 +1,62 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineSetResourcePolicySpecApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicySpec type for use +// with apply. +type VirtualMachineSetResourcePolicySpecApplyConfiguration struct { + ResourcePool *ResourcePoolSpecApplyConfiguration `json:"resourcepool,omitempty"` + Folder *FolderSpecApplyConfiguration `json:"folder,omitempty"` + ClusterModules []ClusterModuleSpecApplyConfiguration `json:"clustermodules,omitempty"` +} + +// VirtualMachineSetResourcePolicySpecApplyConfiguration constructs an declarative configuration of the VirtualMachineSetResourcePolicySpec type for use with +// apply. +func VirtualMachineSetResourcePolicySpec() *VirtualMachineSetResourcePolicySpecApplyConfiguration { + return &VirtualMachineSetResourcePolicySpecApplyConfiguration{} +} + +// WithResourcePool sets the ResourcePool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourcePool field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithResourcePool(value *ResourcePoolSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { + b.ResourcePool = value + return b +} + +// WithFolder sets the Folder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Folder field is set to the value of the last call. +func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithFolder(value *FolderSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { + b.Folder = value + return b +} + +// WithClusterModules adds the given value to the ClusterModules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ClusterModules field. +func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithClusterModules(values ...*ClusterModuleSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusterModules") + } + b.ClusterModules = append(b.ClusterModules, *values[i]) + } + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go new file mode 100644 index 000000000..82f17e84a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go @@ -0,0 +1,44 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineSetResourcePolicyStatusApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicyStatus type for use +// with apply. +type VirtualMachineSetResourcePolicyStatusApplyConfiguration struct { + ClusterModules []ClusterModuleStatusApplyConfiguration `json:"clustermodules,omitempty"` +} + +// VirtualMachineSetResourcePolicyStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineSetResourcePolicyStatus type for use with +// apply. +func VirtualMachineSetResourcePolicyStatus() *VirtualMachineSetResourcePolicyStatusApplyConfiguration { + return &VirtualMachineSetResourcePolicyStatusApplyConfiguration{} +} + +// WithClusterModules adds the given value to the ClusterModules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ClusterModules field. +func (b *VirtualMachineSetResourcePolicyStatusApplyConfiguration) WithClusterModules(values ...*ClusterModuleStatusApplyConfiguration) *VirtualMachineSetResourcePolicyStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusterModules") + } + b.ClusterModules = append(b.ClusterModules, *values[i]) + } + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go new file mode 100644 index 000000000..130c472cc --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go @@ -0,0 +1,148 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineSpecApplyConfiguration represents an declarative configuration of the VirtualMachineSpec type for use +// with apply. +type VirtualMachineSpecApplyConfiguration struct { + ImageName *string `json:"imageName,omitempty"` + ClassName *string `json:"className,omitempty"` + PowerState *v1alpha1.VirtualMachinePowerState `json:"powerState,omitempty"` + Ports []VirtualMachinePortApplyConfiguration `json:"ports,omitempty"` + VmMetadata *VirtualMachineMetadataApplyConfiguration `json:"vmMetadata,omitempty"` + StorageClass *string `json:"storageClass,omitempty"` + NetworkInterfaces []VirtualMachineNetworkInterfaceApplyConfiguration `json:"networkInterfaces,omitempty"` + ResourcePolicyName *string `json:"resourcePolicyName,omitempty"` + Volumes []VirtualMachineVolumeApplyConfiguration `json:"volumes,omitempty"` + ReadinessProbe *ProbeApplyConfiguration `json:"readinessProbe,omitempty"` + AdvancedOptions *VirtualMachineAdvancedOptionsApplyConfiguration `json:"advancedOptions,omitempty"` +} + +// VirtualMachineSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineSpec type for use with +// apply. +func VirtualMachineSpec() *VirtualMachineSpecApplyConfiguration { + return &VirtualMachineSpecApplyConfiguration{} +} + +// WithImageName sets the ImageName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageName field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithImageName(value string) *VirtualMachineSpecApplyConfiguration { + b.ImageName = &value + return b +} + +// WithClassName sets the ClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClassName field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithClassName(value string) *VirtualMachineSpecApplyConfiguration { + b.ClassName = &value + return b +} + +// WithPowerState sets the PowerState field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PowerState field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithPowerState(value v1alpha1.VirtualMachinePowerState) *VirtualMachineSpecApplyConfiguration { + b.PowerState = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *VirtualMachineSpecApplyConfiguration) WithPorts(values ...*VirtualMachinePortApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithVmMetadata sets the VmMetadata field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VmMetadata field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithVmMetadata(value *VirtualMachineMetadataApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + b.VmMetadata = value + return b +} + +// WithStorageClass sets the StorageClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageClass field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithStorageClass(value string) *VirtualMachineSpecApplyConfiguration { + b.StorageClass = &value + return b +} + +// WithNetworkInterfaces adds the given value to the NetworkInterfaces field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NetworkInterfaces field. +func (b *VirtualMachineSpecApplyConfiguration) WithNetworkInterfaces(values ...*VirtualMachineNetworkInterfaceApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNetworkInterfaces") + } + b.NetworkInterfaces = append(b.NetworkInterfaces, *values[i]) + } + return b +} + +// WithResourcePolicyName sets the ResourcePolicyName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourcePolicyName field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithResourcePolicyName(value string) *VirtualMachineSpecApplyConfiguration { + b.ResourcePolicyName = &value + return b +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *VirtualMachineSpecApplyConfiguration) WithVolumes(values ...*VirtualMachineVolumeApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumes") + } + b.Volumes = append(b.Volumes, *values[i]) + } + return b +} + +// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadinessProbe field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + b.ReadinessProbe = value + return b +} + +// WithAdvancedOptions sets the AdvancedOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdvancedOptions field is set to the value of the last call. +func (b *VirtualMachineSpecApplyConfiguration) WithAdvancedOptions(value *VirtualMachineAdvancedOptionsApplyConfiguration) *VirtualMachineSpecApplyConfiguration { + b.AdvancedOptions = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go new file mode 100644 index 000000000..08581951f --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go @@ -0,0 +1,134 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineStatusApplyConfiguration represents an declarative configuration of the VirtualMachineStatus type for use +// with apply. +type VirtualMachineStatusApplyConfiguration struct { + Host *string `json:"host,omitempty"` + PowerState *v1alpha1.VirtualMachinePowerState `json:"powerState,omitempty"` + Phase *v1alpha1.VMStatusPhase `json:"phase,omitempty"` + Conditions []VirtualMachineConditionApplyConfiguration `json:"conditions,omitempty"` + VmIp *string `json:"vmIp,omitempty"` + UniqueID *string `json:"uniqueID,omitempty"` + BiosUUID *string `json:"biosUUID,omitempty"` + InstanceUUID *string `json:"instanceUUID,omitempty"` + Volumes []VirtualMachineVolumeStatusApplyConfiguration `json:"volumes,omitempty"` + ChangeBlockTracking *bool `json:"changeBlockTracking,omitempty"` +} + +// VirtualMachineStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineStatus type for use with +// apply. +func VirtualMachineStatus() *VirtualMachineStatusApplyConfiguration { + return &VirtualMachineStatusApplyConfiguration{} +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithHost(value string) *VirtualMachineStatusApplyConfiguration { + b.Host = &value + return b +} + +// WithPowerState sets the PowerState field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PowerState field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithPowerState(value v1alpha1.VirtualMachinePowerState) *VirtualMachineStatusApplyConfiguration { + b.PowerState = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithPhase(value v1alpha1.VMStatusPhase) *VirtualMachineStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *VirtualMachineStatusApplyConfiguration) WithConditions(values ...*VirtualMachineConditionApplyConfiguration) *VirtualMachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithVmIp sets the VmIp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VmIp field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithVmIp(value string) *VirtualMachineStatusApplyConfiguration { + b.VmIp = &value + return b +} + +// WithUniqueID sets the UniqueID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UniqueID field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithUniqueID(value string) *VirtualMachineStatusApplyConfiguration { + b.UniqueID = &value + return b +} + +// WithBiosUUID sets the BiosUUID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BiosUUID field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithBiosUUID(value string) *VirtualMachineStatusApplyConfiguration { + b.BiosUUID = &value + return b +} + +// WithInstanceUUID sets the InstanceUUID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InstanceUUID field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithInstanceUUID(value string) *VirtualMachineStatusApplyConfiguration { + b.InstanceUUID = &value + return b +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *VirtualMachineStatusApplyConfiguration) WithVolumes(values ...*VirtualMachineVolumeStatusApplyConfiguration) *VirtualMachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumes") + } + b.Volumes = append(b.Volumes, *values[i]) + } + return b +} + +// WithChangeBlockTracking sets the ChangeBlockTracking field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ChangeBlockTracking field is set to the value of the last call. +func (b *VirtualMachineStatusApplyConfiguration) WithChangeBlockTracking(value bool) *VirtualMachineStatusApplyConfiguration { + b.ChangeBlockTracking = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go new file mode 100644 index 000000000..e27d36415 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go @@ -0,0 +1,79 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VirtualMachineVolumeApplyConfiguration represents an declarative configuration of the VirtualMachineVolume type for use +// with apply. +type VirtualMachineVolumeApplyConfiguration struct { + Name *string `json:"name,omitempty"` + StoragePolicyID *string `json:"storagePolicyID,omitempty"` + StoragePolicyName *string `json:"storagePolicyName,omitempty"` + PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` + VsphereVolume *VsphereVolumeSourceApplyConfiguration `json:"vSphereVolume,omitempty"` +} + +// VirtualMachineVolumeApplyConfiguration constructs an declarative configuration of the VirtualMachineVolume type for use with +// apply. +func VirtualMachineVolume() *VirtualMachineVolumeApplyConfiguration { + return &VirtualMachineVolumeApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineVolumeApplyConfiguration) WithName(value string) *VirtualMachineVolumeApplyConfiguration { + b.Name = &value + return b +} + +// WithStoragePolicyID sets the StoragePolicyID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePolicyID field is set to the value of the last call. +func (b *VirtualMachineVolumeApplyConfiguration) WithStoragePolicyID(value string) *VirtualMachineVolumeApplyConfiguration { + b.StoragePolicyID = &value + return b +} + +// WithStoragePolicyName sets the StoragePolicyName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePolicyName field is set to the value of the last call. +func (b *VirtualMachineVolumeApplyConfiguration) WithStoragePolicyName(value string) *VirtualMachineVolumeApplyConfiguration { + b.StoragePolicyName = &value + return b +} + +// WithPersistentVolumeClaim sets the PersistentVolumeClaim field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeClaim field is set to the value of the last call. +func (b *VirtualMachineVolumeApplyConfiguration) WithPersistentVolumeClaim(value v1.PersistentVolumeClaimVolumeSource) *VirtualMachineVolumeApplyConfiguration { + b.PersistentVolumeClaim = &value + return b +} + +// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VsphereVolume field is set to the value of the last call. +func (b *VirtualMachineVolumeApplyConfiguration) WithVsphereVolume(value *VsphereVolumeSourceApplyConfiguration) *VirtualMachineVolumeApplyConfiguration { + b.VsphereVolume = value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go new file mode 100644 index 000000000..d56f9b571 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go @@ -0,0 +1,48 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineVolumeProvisioningOptionsApplyConfiguration represents an declarative configuration of the VirtualMachineVolumeProvisioningOptions type for use +// with apply. +type VirtualMachineVolumeProvisioningOptionsApplyConfiguration struct { + ThinProvisioned *bool `json:"thinProvisioned,omitempty"` + EagerZeroed *bool `json:"eagerZeroed,omitempty"` +} + +// VirtualMachineVolumeProvisioningOptionsApplyConfiguration constructs an declarative configuration of the VirtualMachineVolumeProvisioningOptions type for use with +// apply. +func VirtualMachineVolumeProvisioningOptions() *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { + return &VirtualMachineVolumeProvisioningOptionsApplyConfiguration{} +} + +// WithThinProvisioned sets the ThinProvisioned field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ThinProvisioned field is set to the value of the last call. +func (b *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) WithThinProvisioned(value bool) *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { + b.ThinProvisioned = &value + return b +} + +// WithEagerZeroed sets the EagerZeroed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EagerZeroed field is set to the value of the last call. +func (b *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) WithEagerZeroed(value bool) *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { + b.EagerZeroed = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go new file mode 100644 index 000000000..cce7ae174 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineVolumeStatusApplyConfiguration represents an declarative configuration of the VirtualMachineVolumeStatus type for use +// with apply. +type VirtualMachineVolumeStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Attached *bool `json:"attached,omitempty"` + DiskUuid *string `json:"diskUUID,omitempty"` + Error *string `json:"error,omitempty"` +} + +// VirtualMachineVolumeStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineVolumeStatus type for use with +// apply. +func VirtualMachineVolumeStatus() *VirtualMachineVolumeStatusApplyConfiguration { + return &VirtualMachineVolumeStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualMachineVolumeStatusApplyConfiguration) WithName(value string) *VirtualMachineVolumeStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithAttached sets the Attached field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Attached field is set to the value of the last call. +func (b *VirtualMachineVolumeStatusApplyConfiguration) WithAttached(value bool) *VirtualMachineVolumeStatusApplyConfiguration { + b.Attached = &value + return b +} + +// WithDiskUuid sets the DiskUuid field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DiskUuid field is set to the value of the last call. +func (b *VirtualMachineVolumeStatusApplyConfiguration) WithDiskUuid(value string) *VirtualMachineVolumeStatusApplyConfiguration { + b.DiskUuid = &value + return b +} + +// WithError sets the Error field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Error field is set to the value of the last call. +func (b *VirtualMachineVolumeStatusApplyConfiguration) WithError(value string) *VirtualMachineVolumeStatusApplyConfiguration { + b.Error = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go new file mode 100644 index 000000000..2387c8977 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go @@ -0,0 +1,52 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VsphereVolumeSourceApplyConfiguration represents an declarative configuration of the VsphereVolumeSource type for use +// with apply. +type VsphereVolumeSourceApplyConfiguration struct { + Capacity *v1.ResourceList `json:"capacity,omitempty"` + DeviceKey *int `json:"deviceKey,omitempty"` +} + +// VsphereVolumeSourceApplyConfiguration constructs an declarative configuration of the VsphereVolumeSource type for use with +// apply. +func VsphereVolumeSource() *VsphereVolumeSourceApplyConfiguration { + return &VsphereVolumeSourceApplyConfiguration{} +} + +// WithCapacity sets the Capacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capacity field is set to the value of the last call. +func (b *VsphereVolumeSourceApplyConfiguration) WithCapacity(value v1.ResourceList) *VsphereVolumeSourceApplyConfiguration { + b.Capacity = &value + return b +} + +// WithDeviceKey sets the DeviceKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeviceKey field is set to the value of the last call. +func (b *VsphereVolumeSourceApplyConfiguration) WithDeviceKey(value int) *VsphereVolumeSourceApplyConfiguration { + b.DeviceKey = &value + return b +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go new file mode 100644 index 000000000..9ed22ed76 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go @@ -0,0 +1,120 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + "fmt" + "net/http" + + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + vmoperatorV1alpha1 *vmoperatorv1alpha1.VmoperatorV1alpha1Client +} + +// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client +func (c *Clientset) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { + return c.vmoperatorV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.vmoperatorV1alpha1, err = vmoperatorv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.vmoperatorV1alpha1 = vmoperatorv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 000000000..9c2ad0903 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,85 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" + clientset "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" + fakevmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client +func (c *Clientset) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { + return &fakevmoperatorv1alpha1.FakeVmoperatorV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go new file mode 100644 index 000000000..4b91eb6a6 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go new file mode 100644 index 000000000..9f62d8214 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + vmoperatorv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go new file mode 100644 index 000000000..6dc5e6530 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go new file mode 100644 index 000000000..57cf15249 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + vmoperatorv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go new file mode 100644 index 000000000..be4e7e92b --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go new file mode 100644 index 000000000..43eec078a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go new file mode 100644 index 000000000..df46d6d00 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go @@ -0,0 +1,189 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// FakeVirtualMachines implements VirtualMachineInterface +type FakeVirtualMachines struct { + Fake *FakeVmoperatorV1alpha1 + ns string +} + +var virtualmachinesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachines") + +var virtualmachinesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachine") + +// Get takes name of the virtualMachine, and returns the corresponding virtualMachine object, and an error if there is any. +func (c *FakeVirtualMachines) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachine, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(virtualmachinesResource, c.ns, name), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// List takes label and field selectors, and returns the list of VirtualMachines that match those selectors. +func (c *FakeVirtualMachines) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(virtualmachinesResource, virtualmachinesKind, c.ns, opts), &v1alpha1.VirtualMachineList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VirtualMachineList{ListMeta: obj.(*v1alpha1.VirtualMachineList).ListMeta} + for _, item := range obj.(*v1alpha1.VirtualMachineList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualMachines. +func (c *FakeVirtualMachines) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(virtualmachinesResource, c.ns, opts)) + +} + +// Create takes the representation of a virtualMachine and creates it. Returns the server's representation of the virtualMachine, and an error, if there is any. +func (c *FakeVirtualMachines) Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (result *v1alpha1.VirtualMachine, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(virtualmachinesResource, c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// Update takes the representation of a virtualMachine and updates it. Returns the server's representation of the virtualMachine, and an error, if there is any. +func (c *FakeVirtualMachines) Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(virtualmachinesResource, c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVirtualMachines) UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(virtualmachinesResource, "status", c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// Delete takes name of the virtualMachine and deletes it. Returns an error if one occurs. +func (c *FakeVirtualMachines) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(virtualmachinesResource, c.ns, name, opts), &v1alpha1.VirtualMachine{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualMachines) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(virtualmachinesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineList{}) + return err +} + +// Patch applies the patch and returns the patched virtualMachine. +func (c *FakeVirtualMachines) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachine. +func (c *FakeVirtualMachines) Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { + if virtualMachine == nil { + return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachine) + if err != nil { + return nil, err + } + name := virtualMachine.Name + if name == nil { + return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualMachines) ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { + if virtualMachine == nil { + return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachine) + if err != nil { + return nil, err + } + name := virtualMachine.Name + if name == nil { + return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachine), err +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go new file mode 100644 index 000000000..ab6b0dd81 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go @@ -0,0 +1,178 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// FakeVirtualMachineClasses implements VirtualMachineClassInterface +type FakeVirtualMachineClasses struct { + Fake *FakeVmoperatorV1alpha1 +} + +var virtualmachineclassesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineclasses") + +var virtualmachineclassesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClass") + +// Get takes name of the virtualMachineClass, and returns the corresponding virtualMachineClass object, and an error if there is any. +func (c *FakeVirtualMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(virtualmachineclassesResource, name), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// List takes label and field selectors, and returns the list of VirtualMachineClasses that match those selectors. +func (c *FakeVirtualMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(virtualmachineclassesResource, virtualmachineclassesKind, opts), &v1alpha1.VirtualMachineClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VirtualMachineClassList{ListMeta: obj.(*v1alpha1.VirtualMachineClassList).ListMeta} + for _, item := range obj.(*v1alpha1.VirtualMachineClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualMachineClasses. +func (c *FakeVirtualMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(virtualmachineclassesResource, opts)) +} + +// Create takes the representation of a virtualMachineClass and creates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. +func (c *FakeVirtualMachineClasses) Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(virtualmachineclassesResource, virtualMachineClass), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// Update takes the representation of a virtualMachineClass and updates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. +func (c *FakeVirtualMachineClasses) Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(virtualmachineclassesResource, virtualMachineClass), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVirtualMachineClasses) UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(virtualmachineclassesResource, "status", virtualMachineClass), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// Delete takes name of the virtualMachineClass and deletes it. Returns an error if one occurs. +func (c *FakeVirtualMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(virtualmachineclassesResource, name, opts), &v1alpha1.VirtualMachineClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(virtualmachineclassesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineClassList{}) + return err +} + +// Patch applies the patch and returns the patched virtualMachineClass. +func (c *FakeVirtualMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, name, pt, data, subresources...), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineClass. +func (c *FakeVirtualMachineClasses) Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { + if virtualMachineClass == nil { + return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineClass) + if err != nil { + return nil, err + } + name := virtualMachineClass.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualMachineClasses) ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { + if virtualMachineClass == nil { + return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineClass) + if err != nil { + return nil, err + } + name := virtualMachineClass.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineClass), err +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go new file mode 100644 index 000000000..b42257eb8 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go @@ -0,0 +1,178 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// FakeVirtualMachineImages implements VirtualMachineImageInterface +type FakeVirtualMachineImages struct { + Fake *FakeVmoperatorV1alpha1 +} + +var virtualmachineimagesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineimages") + +var virtualmachineimagesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImage") + +// Get takes name of the virtualMachineImage, and returns the corresponding virtualMachineImage object, and an error if there is any. +func (c *FakeVirtualMachineImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineImage, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(virtualmachineimagesResource, name), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// List takes label and field selectors, and returns the list of VirtualMachineImages that match those selectors. +func (c *FakeVirtualMachineImages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineImageList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(virtualmachineimagesResource, virtualmachineimagesKind, opts), &v1alpha1.VirtualMachineImageList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VirtualMachineImageList{ListMeta: obj.(*v1alpha1.VirtualMachineImageList).ListMeta} + for _, item := range obj.(*v1alpha1.VirtualMachineImageList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualMachineImages. +func (c *FakeVirtualMachineImages) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(virtualmachineimagesResource, opts)) +} + +// Create takes the representation of a virtualMachineImage and creates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. +func (c *FakeVirtualMachineImages) Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineImage, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(virtualmachineimagesResource, virtualMachineImage), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// Update takes the representation of a virtualMachineImage and updates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. +func (c *FakeVirtualMachineImages) Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(virtualmachineimagesResource, virtualMachineImage), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVirtualMachineImages) UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(virtualmachineimagesResource, "status", virtualMachineImage), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// Delete takes name of the virtualMachineImage and deletes it. Returns an error if one occurs. +func (c *FakeVirtualMachineImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(virtualmachineimagesResource, name, opts), &v1alpha1.VirtualMachineImage{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualMachineImages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(virtualmachineimagesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineImageList{}) + return err +} + +// Patch applies the patch and returns the patched virtualMachineImage. +func (c *FakeVirtualMachineImages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, name, pt, data, subresources...), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineImage. +func (c *FakeVirtualMachineImages) Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { + if virtualMachineImage == nil { + return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineImage) + if err != nil { + return nil, err + } + name := virtualMachineImage.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualMachineImages) ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { + if virtualMachineImage == nil { + return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineImage) + if err != nil { + return nil, err + } + name := virtualMachineImage.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineImage{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineImage), err +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go new file mode 100644 index 000000000..fceca34d5 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go @@ -0,0 +1,189 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// FakeVirtualMachineServices implements VirtualMachineServiceInterface +type FakeVirtualMachineServices struct { + Fake *FakeVmoperatorV1alpha1 + ns string +} + +var virtualmachineservicesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineservices") + +var virtualmachineservicesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineService") + +// Get takes name of the virtualMachineService, and returns the corresponding virtualMachineService object, and an error if there is any. +func (c *FakeVirtualMachineServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineService, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(virtualmachineservicesResource, c.ns, name), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// List takes label and field selectors, and returns the list of VirtualMachineServices that match those selectors. +func (c *FakeVirtualMachineServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(virtualmachineservicesResource, virtualmachineservicesKind, c.ns, opts), &v1alpha1.VirtualMachineServiceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VirtualMachineServiceList{ListMeta: obj.(*v1alpha1.VirtualMachineServiceList).ListMeta} + for _, item := range obj.(*v1alpha1.VirtualMachineServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualMachineServices. +func (c *FakeVirtualMachineServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(virtualmachineservicesResource, c.ns, opts)) + +} + +// Create takes the representation of a virtualMachineService and creates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. +func (c *FakeVirtualMachineServices) Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineService, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(virtualmachineservicesResource, c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// Update takes the representation of a virtualMachineService and updates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. +func (c *FakeVirtualMachineServices) Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(virtualmachineservicesResource, c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVirtualMachineServices) UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(virtualmachineservicesResource, "status", c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// Delete takes name of the virtualMachineService and deletes it. Returns an error if one occurs. +func (c *FakeVirtualMachineServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(virtualmachineservicesResource, c.ns, name, opts), &v1alpha1.VirtualMachineService{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualMachineServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(virtualmachineservicesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineServiceList{}) + return err +} + +// Patch applies the patch and returns the patched virtualMachineService. +func (c *FakeVirtualMachineServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineService. +func (c *FakeVirtualMachineServices) Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { + if virtualMachineService == nil { + return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineService) + if err != nil { + return nil, err + } + name := virtualMachineService.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualMachineServices) ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { + if virtualMachineService == nil { + return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineService) + if err != nil { + return nil, err + } + name := virtualMachineService.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineService), err +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go new file mode 100644 index 000000000..bae95697d --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go @@ -0,0 +1,189 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" +) + +// FakeVirtualMachineSetResourcePolicies implements VirtualMachineSetResourcePolicyInterface +type FakeVirtualMachineSetResourcePolicies struct { + Fake *FakeVmoperatorV1alpha1 + ns string +} + +var virtualmachinesetresourcepoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachinesetresourcepolicies") + +var virtualmachinesetresourcepoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicy") + +// Get takes name of the virtualMachineSetResourcePolicy, and returns the corresponding virtualMachineSetResourcePolicy object, and an error if there is any. +func (c *FakeVirtualMachineSetResourcePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(virtualmachinesetresourcepoliciesResource, c.ns, name), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// List takes label and field selectors, and returns the list of VirtualMachineSetResourcePolicies that match those selectors. +func (c *FakeVirtualMachineSetResourcePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineSetResourcePolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(virtualmachinesetresourcepoliciesResource, virtualmachinesetresourcepoliciesKind, c.ns, opts), &v1alpha1.VirtualMachineSetResourcePolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VirtualMachineSetResourcePolicyList{ListMeta: obj.(*v1alpha1.VirtualMachineSetResourcePolicyList).ListMeta} + for _, item := range obj.(*v1alpha1.VirtualMachineSetResourcePolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualMachineSetResourcePolicies. +func (c *FakeVirtualMachineSetResourcePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(virtualmachinesetresourcepoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a virtualMachineSetResourcePolicy and creates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. +func (c *FakeVirtualMachineSetResourcePolicies) Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(virtualmachinesetresourcepoliciesResource, c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// Update takes the representation of a virtualMachineSetResourcePolicy and updates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. +func (c *FakeVirtualMachineSetResourcePolicies) Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(virtualmachinesetresourcepoliciesResource, c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVirtualMachineSetResourcePolicies) UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(virtualmachinesetresourcepoliciesResource, "status", c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// Delete takes name of the virtualMachineSetResourcePolicy and deletes it. Returns an error if one occurs. +func (c *FakeVirtualMachineSetResourcePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(virtualmachinesetresourcepoliciesResource, c.ns, name, opts), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualMachineSetResourcePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(virtualmachinesetresourcepoliciesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineSetResourcePolicyList{}) + return err +} + +// Patch applies the patch and returns the patched virtualMachineSetResourcePolicy. +func (c *FakeVirtualMachineSetResourcePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineSetResourcePolicy. +func (c *FakeVirtualMachineSetResourcePolicies) Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + if virtualMachineSetResourcePolicy == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineSetResourcePolicy) + if err != nil { + return nil, err + } + name := virtualMachineSetResourcePolicy.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualMachineSetResourcePolicies) ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + if virtualMachineSetResourcePolicy == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") + } + data, err := json.Marshal(virtualMachineSetResourcePolicy) + if err != nil { + return nil, err + } + name := virtualMachineSetResourcePolicy.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineSetResourcePolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go new file mode 100644 index 000000000..50f4bb34a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go @@ -0,0 +1,56 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" +) + +type FakeVmoperatorV1alpha1 struct { + *testing.Fake +} + +func (c *FakeVmoperatorV1alpha1) VirtualMachines(namespace string) v1alpha1.VirtualMachineInterface { + return &FakeVirtualMachines{c, namespace} +} + +func (c *FakeVmoperatorV1alpha1) VirtualMachineClasses() v1alpha1.VirtualMachineClassInterface { + return &FakeVirtualMachineClasses{c} +} + +func (c *FakeVmoperatorV1alpha1) VirtualMachineImages() v1alpha1.VirtualMachineImageInterface { + return &FakeVirtualMachineImages{c} +} + +func (c *FakeVmoperatorV1alpha1) VirtualMachineServices(namespace string) v1alpha1.VirtualMachineServiceInterface { + return &FakeVirtualMachineServices{c, namespace} +} + +func (c *FakeVmoperatorV1alpha1) VirtualMachineSetResourcePolicies(namespace string) v1alpha1.VirtualMachineSetResourcePolicyInterface { + return &FakeVirtualMachineSetResourcePolicies{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeVmoperatorV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..b0e5b1489 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type VirtualMachineExpansion interface{} + +type VirtualMachineClassExpansion interface{} + +type VirtualMachineImageExpansion interface{} + +type VirtualMachineServiceExpansion interface{} + +type VirtualMachineSetResourcePolicyExpansion interface{} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go new file mode 100644 index 000000000..75ad3fa27 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go @@ -0,0 +1,256 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" + scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +// VirtualMachinesGetter has a method to return a VirtualMachineInterface. +// A group's client should implement this interface. +type VirtualMachinesGetter interface { + VirtualMachines(namespace string) VirtualMachineInterface +} + +// VirtualMachineInterface has methods to work with VirtualMachine resources. +type VirtualMachineInterface interface { + Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (*v1alpha1.VirtualMachine, error) + Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) + UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachine, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) + Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) + ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) + VirtualMachineExpansion +} + +// virtualMachines implements VirtualMachineInterface +type virtualMachines struct { + client rest.Interface + ns string +} + +// newVirtualMachines returns a VirtualMachines +func newVirtualMachines(c *VmoperatorV1alpha1Client, namespace string) *virtualMachines { + return &virtualMachines{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the virtualMachine, and returns the corresponding virtualMachine object, and an error if there is any. +func (c *virtualMachines) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachine, err error) { + result = &v1alpha1.VirtualMachine{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachines"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VirtualMachines that match those selectors. +func (c *virtualMachines) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VirtualMachineList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachines"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested virtualMachines. +func (c *virtualMachines) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("virtualmachines"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a virtualMachine and creates it. Returns the server's representation of the virtualMachine, and an error, if there is any. +func (c *virtualMachines) Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (result *v1alpha1.VirtualMachine, err error) { + result = &v1alpha1.VirtualMachine{} + err = c.client.Post(). + Namespace(c.ns). + Resource("virtualmachines"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachine). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a virtualMachine and updates it. Returns the server's representation of the virtualMachine, and an error, if there is any. +func (c *virtualMachines) Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { + result = &v1alpha1.VirtualMachine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachines"). + Name(virtualMachine.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachine). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *virtualMachines) UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { + result = &v1alpha1.VirtualMachine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachines"). + Name(virtualMachine.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachine). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the virtualMachine and deletes it. Returns an error if one occurs. +func (c *virtualMachines) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachines"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *virtualMachines) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachines"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched virtualMachine. +func (c *virtualMachines) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) { + result = &v1alpha1.VirtualMachine{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("virtualmachines"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachine. +func (c *virtualMachines) Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { + if virtualMachine == nil { + return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachine) + if err != nil { + return nil, err + } + name := virtualMachine.Name + if name == nil { + return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") + } + result = &v1alpha1.VirtualMachine{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachines"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualMachines) ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { + if virtualMachine == nil { + return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachine) + if err != nil { + return nil, err + } + + name := virtualMachine.Name + if name == nil { + return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualMachine{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachines"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go new file mode 100644 index 000000000..bd20cdddc --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go @@ -0,0 +1,243 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" + scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +// VirtualMachineClassesGetter has a method to return a VirtualMachineClassInterface. +// A group's client should implement this interface. +type VirtualMachineClassesGetter interface { + VirtualMachineClasses() VirtualMachineClassInterface +} + +// VirtualMachineClassInterface has methods to work with VirtualMachineClass resources. +type VirtualMachineClassInterface interface { + Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (*v1alpha1.VirtualMachineClass, error) + Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) + UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineClass, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineClassList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) + Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) + ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) + VirtualMachineClassExpansion +} + +// virtualMachineClasses implements VirtualMachineClassInterface +type virtualMachineClasses struct { + client rest.Interface +} + +// newVirtualMachineClasses returns a VirtualMachineClasses +func newVirtualMachineClasses(c *VmoperatorV1alpha1Client) *virtualMachineClasses { + return &virtualMachineClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the virtualMachineClass, and returns the corresponding virtualMachineClass object, and an error if there is any. +func (c *virtualMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineClass, err error) { + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Get(). + Resource("virtualmachineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VirtualMachineClasses that match those selectors. +func (c *virtualMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineClassList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VirtualMachineClassList{} + err = c.client.Get(). + Resource("virtualmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested virtualMachineClasses. +func (c *virtualMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("virtualmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a virtualMachineClass and creates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. +func (c *virtualMachineClasses) Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineClass, err error) { + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Post(). + Resource("virtualmachineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineClass). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a virtualMachineClass and updates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. +func (c *virtualMachineClasses) Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Put(). + Resource("virtualmachineclasses"). + Name(virtualMachineClass.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineClass). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *virtualMachineClasses) UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Put(). + Resource("virtualmachineclasses"). + Name(virtualMachineClass.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineClass). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the virtualMachineClass and deletes it. Returns an error if one occurs. +func (c *virtualMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("virtualmachineclasses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *virtualMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("virtualmachineclasses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched virtualMachineClass. +func (c *virtualMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) { + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Patch(pt). + Resource("virtualmachineclasses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineClass. +func (c *virtualMachineClasses) Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { + if virtualMachineClass == nil { + return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineClass) + if err != nil { + return nil, err + } + name := virtualMachineClass.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") + } + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("virtualmachineclasses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualMachineClasses) ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { + if virtualMachineClass == nil { + return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineClass) + if err != nil { + return nil, err + } + + name := virtualMachineClass.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualMachineClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("virtualmachineclasses"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go new file mode 100644 index 000000000..9a45ab855 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go @@ -0,0 +1,243 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" + scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +// VirtualMachineImagesGetter has a method to return a VirtualMachineImageInterface. +// A group's client should implement this interface. +type VirtualMachineImagesGetter interface { + VirtualMachineImages() VirtualMachineImageInterface +} + +// VirtualMachineImageInterface has methods to work with VirtualMachineImage resources. +type VirtualMachineImageInterface interface { + Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (*v1alpha1.VirtualMachineImage, error) + Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) + UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineImage, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineImageList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) + Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) + ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) + VirtualMachineImageExpansion +} + +// virtualMachineImages implements VirtualMachineImageInterface +type virtualMachineImages struct { + client rest.Interface +} + +// newVirtualMachineImages returns a VirtualMachineImages +func newVirtualMachineImages(c *VmoperatorV1alpha1Client) *virtualMachineImages { + return &virtualMachineImages{ + client: c.RESTClient(), + } +} + +// Get takes name of the virtualMachineImage, and returns the corresponding virtualMachineImage object, and an error if there is any. +func (c *virtualMachineImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineImage, err error) { + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Get(). + Resource("virtualmachineimages"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VirtualMachineImages that match those selectors. +func (c *virtualMachineImages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineImageList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VirtualMachineImageList{} + err = c.client.Get(). + Resource("virtualmachineimages"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested virtualMachineImages. +func (c *virtualMachineImages) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("virtualmachineimages"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a virtualMachineImage and creates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. +func (c *virtualMachineImages) Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineImage, err error) { + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Post(). + Resource("virtualmachineimages"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineImage). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a virtualMachineImage and updates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. +func (c *virtualMachineImages) Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Put(). + Resource("virtualmachineimages"). + Name(virtualMachineImage.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineImage). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *virtualMachineImages) UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Put(). + Resource("virtualmachineimages"). + Name(virtualMachineImage.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineImage). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the virtualMachineImage and deletes it. Returns an error if one occurs. +func (c *virtualMachineImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("virtualmachineimages"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *virtualMachineImages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("virtualmachineimages"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched virtualMachineImage. +func (c *virtualMachineImages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) { + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Patch(pt). + Resource("virtualmachineimages"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineImage. +func (c *virtualMachineImages) Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { + if virtualMachineImage == nil { + return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineImage) + if err != nil { + return nil, err + } + name := virtualMachineImage.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") + } + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Patch(types.ApplyPatchType). + Resource("virtualmachineimages"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualMachineImages) ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { + if virtualMachineImage == nil { + return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineImage) + if err != nil { + return nil, err + } + + name := virtualMachineImage.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualMachineImage{} + err = c.client.Patch(types.ApplyPatchType). + Resource("virtualmachineimages"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go new file mode 100644 index 000000000..836ff0eed --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go @@ -0,0 +1,256 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" + scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +// VirtualMachineServicesGetter has a method to return a VirtualMachineServiceInterface. +// A group's client should implement this interface. +type VirtualMachineServicesGetter interface { + VirtualMachineServices(namespace string) VirtualMachineServiceInterface +} + +// VirtualMachineServiceInterface has methods to work with VirtualMachineService resources. +type VirtualMachineServiceInterface interface { + Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (*v1alpha1.VirtualMachineService, error) + Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) + UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineService, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineServiceList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) + Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) + ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) + VirtualMachineServiceExpansion +} + +// virtualMachineServices implements VirtualMachineServiceInterface +type virtualMachineServices struct { + client rest.Interface + ns string +} + +// newVirtualMachineServices returns a VirtualMachineServices +func newVirtualMachineServices(c *VmoperatorV1alpha1Client, namespace string) *virtualMachineServices { + return &virtualMachineServices{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the virtualMachineService, and returns the corresponding virtualMachineService object, and an error if there is any. +func (c *virtualMachineServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineService, err error) { + result = &v1alpha1.VirtualMachineService{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VirtualMachineServices that match those selectors. +func (c *virtualMachineServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VirtualMachineServiceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachineservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested virtualMachineServices. +func (c *virtualMachineServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("virtualmachineservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a virtualMachineService and creates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. +func (c *virtualMachineServices) Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineService, err error) { + result = &v1alpha1.VirtualMachineService{} + err = c.client.Post(). + Namespace(c.ns). + Resource("virtualmachineservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a virtualMachineService and updates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. +func (c *virtualMachineServices) Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { + result = &v1alpha1.VirtualMachineService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(virtualMachineService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *virtualMachineServices) UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { + result = &v1alpha1.VirtualMachineService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(virtualMachineService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the virtualMachineService and deletes it. Returns an error if one occurs. +func (c *virtualMachineServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *virtualMachineServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachineservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched virtualMachineService. +func (c *virtualMachineServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) { + result = &v1alpha1.VirtualMachineService{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineService. +func (c *virtualMachineServices) Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { + if virtualMachineService == nil { + return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineService) + if err != nil { + return nil, err + } + name := virtualMachineService.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") + } + result = &v1alpha1.VirtualMachineService{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualMachineServices) ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { + if virtualMachineService == nil { + return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineService) + if err != nil { + return nil, err + } + + name := virtualMachineService.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualMachineService{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachineservices"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go new file mode 100644 index 000000000..37253c97a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -0,0 +1,256 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" + scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +// VirtualMachineSetResourcePoliciesGetter has a method to return a VirtualMachineSetResourcePolicyInterface. +// A group's client should implement this interface. +type VirtualMachineSetResourcePoliciesGetter interface { + VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyInterface +} + +// VirtualMachineSetResourcePolicyInterface has methods to work with VirtualMachineSetResourcePolicy resources. +type VirtualMachineSetResourcePolicyInterface interface { + Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) + Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) + UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineSetResourcePolicyList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) + Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) + ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) + VirtualMachineSetResourcePolicyExpansion +} + +// virtualMachineSetResourcePolicies implements VirtualMachineSetResourcePolicyInterface +type virtualMachineSetResourcePolicies struct { + client rest.Interface + ns string +} + +// newVirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicies +func newVirtualMachineSetResourcePolicies(c *VmoperatorV1alpha1Client, namespace string) *virtualMachineSetResourcePolicies { + return &virtualMachineSetResourcePolicies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the virtualMachineSetResourcePolicy, and returns the corresponding virtualMachineSetResourcePolicy object, and an error if there is any. +func (c *virtualMachineSetResourcePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VirtualMachineSetResourcePolicies that match those selectors. +func (c *virtualMachineSetResourcePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineSetResourcePolicyList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VirtualMachineSetResourcePolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested virtualMachineSetResourcePolicies. +func (c *virtualMachineSetResourcePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a virtualMachineSetResourcePolicy and creates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. +func (c *virtualMachineSetResourcePolicies) Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineSetResourcePolicy). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a virtualMachineSetResourcePolicy and updates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. +func (c *virtualMachineSetResourcePolicies) Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(virtualMachineSetResourcePolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineSetResourcePolicy). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *virtualMachineSetResourcePolicies) UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(virtualMachineSetResourcePolicy.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(virtualMachineSetResourcePolicy). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the virtualMachineSetResourcePolicy and deletes it. Returns an error if one occurs. +func (c *virtualMachineSetResourcePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *virtualMachineSetResourcePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched virtualMachineSetResourcePolicy. +func (c *virtualMachineSetResourcePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineSetResourcePolicy. +func (c *virtualMachineSetResourcePolicies) Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + if virtualMachineSetResourcePolicy == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineSetResourcePolicy) + if err != nil { + return nil, err + } + name := virtualMachineSetResourcePolicy.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") + } + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualMachineSetResourcePolicies) ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { + if virtualMachineSetResourcePolicy == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualMachineSetResourcePolicy) + if err != nil { + return nil, err + } + + name := virtualMachineSetResourcePolicy.Name + if name == nil { + return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualMachineSetResourcePolicy{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualmachinesetresourcepolicies"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go new file mode 100644 index 000000000..c3eabbb14 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go @@ -0,0 +1,127 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" +) + +type VmoperatorV1alpha1Interface interface { + RESTClient() rest.Interface + VirtualMachinesGetter + VirtualMachineClassesGetter + VirtualMachineImagesGetter + VirtualMachineServicesGetter + VirtualMachineSetResourcePoliciesGetter +} + +// VmoperatorV1alpha1Client is used to interact with features provided by the vmoperator.vmware.com group. +type VmoperatorV1alpha1Client struct { + restClient rest.Interface +} + +func (c *VmoperatorV1alpha1Client) VirtualMachines(namespace string) VirtualMachineInterface { + return newVirtualMachines(c, namespace) +} + +func (c *VmoperatorV1alpha1Client) VirtualMachineClasses() VirtualMachineClassInterface { + return newVirtualMachineClasses(c) +} + +func (c *VmoperatorV1alpha1Client) VirtualMachineImages() VirtualMachineImageInterface { + return newVirtualMachineImages(c) +} + +func (c *VmoperatorV1alpha1Client) VirtualMachineServices(namespace string) VirtualMachineServiceInterface { + return newVirtualMachineServices(c, namespace) +} + +func (c *VmoperatorV1alpha1Client) VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyInterface { + return newVirtualMachineSetResourcePolicies(c, namespace) +} + +// NewForConfig creates a new VmoperatorV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new VmoperatorV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*VmoperatorV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &VmoperatorV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new VmoperatorV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *VmoperatorV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new VmoperatorV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *VmoperatorV1alpha1Client { + return &VmoperatorV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *VmoperatorV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go new file mode 100644 index 000000000..f89f24169 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go @@ -0,0 +1,261 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + transform cache.TransformFunc + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// WithTransform sets a transform on all informers. +func WithTransform(transform cache.TransformFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.transform = transform + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.shuttingDown { + return + } + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() + f.startedInformers[informerType] = true + } + } +} + +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + informer.SetTransform(f.transform) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + + Vmoperator() vmop.Interface +} + +func (f *sharedInformerFactory) Vmoperator() vmop.Interface { + return vmop.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go new file mode 100644 index 000000000..c7386f2fd --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go @@ -0,0 +1,70 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=vmoperator.vmware.com, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("virtualmachines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachines().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineClasses().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineimages"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineImages().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineServices().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("virtualmachinesetresourcepolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineSetResourcePolicies().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..38baf81e2 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go new file mode 100644 index 000000000..3c7c0a15b --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package vmop + +import ( + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go new file mode 100644 index 000000000..c63350753 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // VirtualMachines returns a VirtualMachineInformer. + VirtualMachines() VirtualMachineInformer + // VirtualMachineClasses returns a VirtualMachineClassInformer. + VirtualMachineClasses() VirtualMachineClassInformer + // VirtualMachineImages returns a VirtualMachineImageInformer. + VirtualMachineImages() VirtualMachineImageInformer + // VirtualMachineServices returns a VirtualMachineServiceInformer. + VirtualMachineServices() VirtualMachineServiceInformer + // VirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicyInformer. + VirtualMachineSetResourcePolicies() VirtualMachineSetResourcePolicyInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// VirtualMachines returns a VirtualMachineInformer. +func (v *version) VirtualMachines() VirtualMachineInformer { + return &virtualMachineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VirtualMachineClasses returns a VirtualMachineClassInformer. +func (v *version) VirtualMachineClasses() VirtualMachineClassInformer { + return &virtualMachineClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VirtualMachineImages returns a VirtualMachineImageInformer. +func (v *version) VirtualMachineImages() VirtualMachineImageInformer { + return &virtualMachineImageInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VirtualMachineServices returns a VirtualMachineServiceInformer. +func (v *version) VirtualMachineServices() VirtualMachineServiceInformer { + return &virtualMachineServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicyInformer. +func (v *version) VirtualMachineSetResourcePolicies() VirtualMachineSetResourcePolicyInformer { + return &virtualMachineSetResourcePolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go new file mode 100644 index 000000000..9e5836311 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go @@ -0,0 +1,90 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" +) + +// VirtualMachineInformer provides access to a shared informer and lister for +// VirtualMachines. +type VirtualMachineInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VirtualMachineLister +} + +type virtualMachineInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVirtualMachineInformer constructs a new informer for VirtualMachine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVirtualMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVirtualMachineInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVirtualMachineInformer constructs a new informer for VirtualMachine type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVirtualMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachines(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachines(namespace).Watch(context.TODO(), options) + }, + }, + &vmopv1alpha1.VirtualMachine{}, + resyncPeriod, + indexers, + ) +} + +func (f *virtualMachineInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVirtualMachineInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *virtualMachineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vmopv1alpha1.VirtualMachine{}, f.defaultInformer) +} + +func (f *virtualMachineInformer) Lister() v1alpha1.VirtualMachineLister { + return v1alpha1.NewVirtualMachineLister(f.Informer().GetIndexer()) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go new file mode 100644 index 000000000..c5771c8b0 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" +) + +// VirtualMachineClassInformer provides access to a shared informer and lister for +// VirtualMachineClasses. +type VirtualMachineClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VirtualMachineClassLister +} + +type virtualMachineClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVirtualMachineClassInformer constructs a new informer for VirtualMachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVirtualMachineClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVirtualMachineClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVirtualMachineClassInformer constructs a new informer for VirtualMachineClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVirtualMachineClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineClasses().Watch(context.TODO(), options) + }, + }, + &vmopv1alpha1.VirtualMachineClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *virtualMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVirtualMachineClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *virtualMachineClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineClass{}, f.defaultInformer) +} + +func (f *virtualMachineClassInformer) Lister() v1alpha1.VirtualMachineClassLister { + return v1alpha1.NewVirtualMachineClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go new file mode 100644 index 000000000..95c1d6e04 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" +) + +// VirtualMachineImageInformer provides access to a shared informer and lister for +// VirtualMachineImages. +type VirtualMachineImageInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VirtualMachineImageLister +} + +type virtualMachineImageInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVirtualMachineImageInformer constructs a new informer for VirtualMachineImage type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVirtualMachineImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVirtualMachineImageInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVirtualMachineImageInformer constructs a new informer for VirtualMachineImage type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVirtualMachineImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineImages().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineImages().Watch(context.TODO(), options) + }, + }, + &vmopv1alpha1.VirtualMachineImage{}, + resyncPeriod, + indexers, + ) +} + +func (f *virtualMachineImageInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVirtualMachineImageInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *virtualMachineImageInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineImage{}, f.defaultInformer) +} + +func (f *virtualMachineImageInformer) Lister() v1alpha1.VirtualMachineImageLister { + return v1alpha1.NewVirtualMachineImageLister(f.Informer().GetIndexer()) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go new file mode 100644 index 000000000..e18388338 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go @@ -0,0 +1,90 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" +) + +// VirtualMachineServiceInformer provides access to a shared informer and lister for +// VirtualMachineServices. +type VirtualMachineServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VirtualMachineServiceLister +} + +type virtualMachineServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVirtualMachineServiceInformer constructs a new informer for VirtualMachineService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVirtualMachineServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVirtualMachineServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVirtualMachineServiceInformer constructs a new informer for VirtualMachineService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVirtualMachineServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineServices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineServices(namespace).Watch(context.TODO(), options) + }, + }, + &vmopv1alpha1.VirtualMachineService{}, + resyncPeriod, + indexers, + ) +} + +func (f *virtualMachineServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVirtualMachineServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *virtualMachineServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineService{}, f.defaultInformer) +} + +func (f *virtualMachineServiceInformer) Lister() v1alpha1.VirtualMachineServiceLister { + return v1alpha1.NewVirtualMachineServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go new file mode 100644 index 000000000..8926bbcd6 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -0,0 +1,90 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" +) + +// VirtualMachineSetResourcePolicyInformer provides access to a shared informer and lister for +// VirtualMachineSetResourcePolicies. +type VirtualMachineSetResourcePolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VirtualMachineSetResourcePolicyLister +} + +type virtualMachineSetResourcePolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVirtualMachineSetResourcePolicyInformer constructs a new informer for VirtualMachineSetResourcePolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVirtualMachineSetResourcePolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVirtualMachineSetResourcePolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVirtualMachineSetResourcePolicyInformer constructs a new informer for VirtualMachineSetResourcePolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVirtualMachineSetResourcePolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineSetResourcePolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VmoperatorV1alpha1().VirtualMachineSetResourcePolicies(namespace).Watch(context.TODO(), options) + }, + }, + &vmopv1alpha1.VirtualMachineSetResourcePolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *virtualMachineSetResourcePolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVirtualMachineSetResourcePolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *virtualMachineSetResourcePolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineSetResourcePolicy{}, f.defaultInformer) +} + +func (f *virtualMachineSetResourcePolicyInformer) Lister() v1alpha1.VirtualMachineSetResourcePolicyLister { + return v1alpha1.NewVirtualMachineSetResourcePolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..b688353a7 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go @@ -0,0 +1,51 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// VirtualMachineListerExpansion allows custom methods to be added to +// VirtualMachineLister. +type VirtualMachineListerExpansion interface{} + +// VirtualMachineNamespaceListerExpansion allows custom methods to be added to +// VirtualMachineNamespaceLister. +type VirtualMachineNamespaceListerExpansion interface{} + +// VirtualMachineClassListerExpansion allows custom methods to be added to +// VirtualMachineClassLister. +type VirtualMachineClassListerExpansion interface{} + +// VirtualMachineImageListerExpansion allows custom methods to be added to +// VirtualMachineImageLister. +type VirtualMachineImageListerExpansion interface{} + +// VirtualMachineServiceListerExpansion allows custom methods to be added to +// VirtualMachineServiceLister. +type VirtualMachineServiceListerExpansion interface{} + +// VirtualMachineServiceNamespaceListerExpansion allows custom methods to be added to +// VirtualMachineServiceNamespaceLister. +type VirtualMachineServiceNamespaceListerExpansion interface{} + +// VirtualMachineSetResourcePolicyListerExpansion allows custom methods to be added to +// VirtualMachineSetResourcePolicyLister. +type VirtualMachineSetResourcePolicyListerExpansion interface{} + +// VirtualMachineSetResourcePolicyNamespaceListerExpansion allows custom methods to be added to +// VirtualMachineSetResourcePolicyNamespaceLister. +type VirtualMachineSetResourcePolicyNamespaceListerExpansion interface{} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go new file mode 100644 index 000000000..f973a0e24 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go @@ -0,0 +1,99 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineLister helps list VirtualMachines. +// All objects returned here must be treated as read-only. +type VirtualMachineLister interface { + // List lists all VirtualMachines in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) + // VirtualMachines returns an object that can list and get VirtualMachines. + VirtualMachines(namespace string) VirtualMachineNamespaceLister + VirtualMachineListerExpansion +} + +// virtualMachineLister implements the VirtualMachineLister interface. +type virtualMachineLister struct { + indexer cache.Indexer +} + +// NewVirtualMachineLister returns a new VirtualMachineLister. +func NewVirtualMachineLister(indexer cache.Indexer) VirtualMachineLister { + return &virtualMachineLister{indexer: indexer} +} + +// List lists all VirtualMachines in the indexer. +func (s *virtualMachineLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachine)) + }) + return ret, err +} + +// VirtualMachines returns an object that can list and get VirtualMachines. +func (s *virtualMachineLister) VirtualMachines(namespace string) VirtualMachineNamespaceLister { + return virtualMachineNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VirtualMachineNamespaceLister helps list and get VirtualMachines. +// All objects returned here must be treated as read-only. +type VirtualMachineNamespaceLister interface { + // List lists all VirtualMachines in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) + // Get retrieves the VirtualMachine from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VirtualMachine, error) + VirtualMachineNamespaceListerExpansion +} + +// virtualMachineNamespaceLister implements the VirtualMachineNamespaceLister +// interface. +type virtualMachineNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VirtualMachines in the indexer for a given namespace. +func (s virtualMachineNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachine)) + }) + return ret, err +} + +// Get retrieves the VirtualMachine from the indexer for a given namespace and name. +func (s virtualMachineNamespaceLister) Get(name string) (*v1alpha1.VirtualMachine, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachine"), name) + } + return obj.(*v1alpha1.VirtualMachine), nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go new file mode 100644 index 000000000..92881420a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go @@ -0,0 +1,68 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineClassLister helps list VirtualMachineClasses. +// All objects returned here must be treated as read-only. +type VirtualMachineClassLister interface { + // List lists all VirtualMachineClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineClass, err error) + // Get retrieves the VirtualMachineClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VirtualMachineClass, error) + VirtualMachineClassListerExpansion +} + +// virtualMachineClassLister implements the VirtualMachineClassLister interface. +type virtualMachineClassLister struct { + indexer cache.Indexer +} + +// NewVirtualMachineClassLister returns a new VirtualMachineClassLister. +func NewVirtualMachineClassLister(indexer cache.Indexer) VirtualMachineClassLister { + return &virtualMachineClassLister{indexer: indexer} +} + +// List lists all VirtualMachineClasses in the indexer. +func (s *virtualMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineClass)) + }) + return ret, err +} + +// Get retrieves the VirtualMachineClass from the index for a given name. +func (s *virtualMachineClassLister) Get(name string) (*v1alpha1.VirtualMachineClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineclass"), name) + } + return obj.(*v1alpha1.VirtualMachineClass), nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go new file mode 100644 index 000000000..57ce5cdec --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go @@ -0,0 +1,68 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineImageLister helps list VirtualMachineImages. +// All objects returned here must be treated as read-only. +type VirtualMachineImageLister interface { + // List lists all VirtualMachineImages in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineImage, err error) + // Get retrieves the VirtualMachineImage from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VirtualMachineImage, error) + VirtualMachineImageListerExpansion +} + +// virtualMachineImageLister implements the VirtualMachineImageLister interface. +type virtualMachineImageLister struct { + indexer cache.Indexer +} + +// NewVirtualMachineImageLister returns a new VirtualMachineImageLister. +func NewVirtualMachineImageLister(indexer cache.Indexer) VirtualMachineImageLister { + return &virtualMachineImageLister{indexer: indexer} +} + +// List lists all VirtualMachineImages in the indexer. +func (s *virtualMachineImageLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineImage, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineImage)) + }) + return ret, err +} + +// Get retrieves the VirtualMachineImage from the index for a given name. +func (s *virtualMachineImageLister) Get(name string) (*v1alpha1.VirtualMachineImage, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineimage"), name) + } + return obj.(*v1alpha1.VirtualMachineImage), nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go new file mode 100644 index 000000000..ee88ca2f4 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go @@ -0,0 +1,99 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineServiceLister helps list VirtualMachineServices. +// All objects returned here must be treated as read-only. +type VirtualMachineServiceLister interface { + // List lists all VirtualMachineServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) + // VirtualMachineServices returns an object that can list and get VirtualMachineServices. + VirtualMachineServices(namespace string) VirtualMachineServiceNamespaceLister + VirtualMachineServiceListerExpansion +} + +// virtualMachineServiceLister implements the VirtualMachineServiceLister interface. +type virtualMachineServiceLister struct { + indexer cache.Indexer +} + +// NewVirtualMachineServiceLister returns a new VirtualMachineServiceLister. +func NewVirtualMachineServiceLister(indexer cache.Indexer) VirtualMachineServiceLister { + return &virtualMachineServiceLister{indexer: indexer} +} + +// List lists all VirtualMachineServices in the indexer. +func (s *virtualMachineServiceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineService)) + }) + return ret, err +} + +// VirtualMachineServices returns an object that can list and get VirtualMachineServices. +func (s *virtualMachineServiceLister) VirtualMachineServices(namespace string) VirtualMachineServiceNamespaceLister { + return virtualMachineServiceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VirtualMachineServiceNamespaceLister helps list and get VirtualMachineServices. +// All objects returned here must be treated as read-only. +type VirtualMachineServiceNamespaceLister interface { + // List lists all VirtualMachineServices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) + // Get retrieves the VirtualMachineService from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VirtualMachineService, error) + VirtualMachineServiceNamespaceListerExpansion +} + +// virtualMachineServiceNamespaceLister implements the VirtualMachineServiceNamespaceLister +// interface. +type virtualMachineServiceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VirtualMachineServices in the indexer for a given namespace. +func (s virtualMachineServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineService)) + }) + return ret, err +} + +// Get retrieves the VirtualMachineService from the indexer for a given namespace and name. +func (s virtualMachineServiceNamespaceLister) Get(name string) (*v1alpha1.VirtualMachineService, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineservice"), name) + } + return obj.(*v1alpha1.VirtualMachineService), nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go new file mode 100644 index 000000000..6220ac1b5 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -0,0 +1,99 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VirtualMachineSetResourcePolicyLister helps list VirtualMachineSetResourcePolicies. +// All objects returned here must be treated as read-only. +type VirtualMachineSetResourcePolicyLister interface { + // List lists all VirtualMachineSetResourcePolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) + // VirtualMachineSetResourcePolicies returns an object that can list and get VirtualMachineSetResourcePolicies. + VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyNamespaceLister + VirtualMachineSetResourcePolicyListerExpansion +} + +// virtualMachineSetResourcePolicyLister implements the VirtualMachineSetResourcePolicyLister interface. +type virtualMachineSetResourcePolicyLister struct { + indexer cache.Indexer +} + +// NewVirtualMachineSetResourcePolicyLister returns a new VirtualMachineSetResourcePolicyLister. +func NewVirtualMachineSetResourcePolicyLister(indexer cache.Indexer) VirtualMachineSetResourcePolicyLister { + return &virtualMachineSetResourcePolicyLister{indexer: indexer} +} + +// List lists all VirtualMachineSetResourcePolicies in the indexer. +func (s *virtualMachineSetResourcePolicyLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineSetResourcePolicy)) + }) + return ret, err +} + +// VirtualMachineSetResourcePolicies returns an object that can list and get VirtualMachineSetResourcePolicies. +func (s *virtualMachineSetResourcePolicyLister) VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyNamespaceLister { + return virtualMachineSetResourcePolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VirtualMachineSetResourcePolicyNamespaceLister helps list and get VirtualMachineSetResourcePolicies. +// All objects returned here must be treated as read-only. +type VirtualMachineSetResourcePolicyNamespaceLister interface { + // List lists all VirtualMachineSetResourcePolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) + // Get retrieves the VirtualMachineSetResourcePolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VirtualMachineSetResourcePolicy, error) + VirtualMachineSetResourcePolicyNamespaceListerExpansion +} + +// virtualMachineSetResourcePolicyNamespaceLister implements the VirtualMachineSetResourcePolicyNamespaceLister +// interface. +type virtualMachineSetResourcePolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VirtualMachineSetResourcePolicies in the indexer for a given namespace. +func (s virtualMachineSetResourcePolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VirtualMachineSetResourcePolicy)) + }) + return ret, err +} + +// Get retrieves the VirtualMachineSetResourcePolicy from the indexer for a given namespace and name. +func (s virtualMachineSetResourcePolicyNamespaceLister) Get(name string) (*v1alpha1.VirtualMachineSetResourcePolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachinesetresourcepolicy"), name) + } + return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), nil +} From bb8c76e4263144aae5719e83a13a14fd3a3898d3 Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Fri, 26 Jan 2024 17:48:54 +0800 Subject: [PATCH 2/8] remove controller runtime dependency Signed-off-by: Xudong Liu --- .../vsphereparavirtual/instances.go | 4 +- .../vsphereparavirtual/instances_test.go | 66 ++++----- .../vsphereparavirtual/loadbalancer_test.go | 80 ++++++----- .../vsphereparavirtual/vmoperator.go | 19 ++- .../vsphereparavirtual/vmservice/types.go | 4 +- .../vsphereparavirtual/vmservice/vmservice.go | 34 ++--- .../vmservice/vmservice_test.go | 47 +++---- pkg/cloudprovider/vsphereparavirtual/zone.go | 5 +- .../vsphereparavirtual/zone_test.go | 22 ++- pkg/util/fake_client_wrapper.go | 126 ------------------ pkg/util/fake_vm_client_wrapper.go | 97 ++++++++++++++ pkg/util/fake_vm_service_client_wrapper.go | 97 ++++++++++++++ 12 files changed, 327 insertions(+), 274 deletions(-) delete mode 100644 pkg/util/fake_client_wrapper.go create mode 100644 pkg/util/fake_vm_client_wrapper.go create mode 100644 pkg/util/fake_vm_service_client_wrapper.go diff --git a/pkg/cloudprovider/vsphereparavirtual/instances.go b/pkg/cloudprovider/vsphereparavirtual/instances.go index 37bb8bcd9..e1f8b997c 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances.go @@ -27,17 +27,17 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "sigs.k8s.io/controller-runtime/pkg/client" cloudprovider "k8s.io/cloud-provider" "k8s.io/klog/v2" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" ) type instances struct { - vmClient client.Client + vmClient vmopclient.Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/instances_test.go b/pkg/cloudprovider/vsphereparavirtual/instances_test.go index 31988feed..f0333b53f 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances_test.go @@ -27,10 +27,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" - "k8s.io/cloud-provider-vsphere/pkg/util" - "sigs.k8s.io/controller-runtime/pkg/client" - fakeClient "sigs.k8s.io/controller-runtime/pkg/client/fake" + fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" ) @@ -73,7 +72,9 @@ func TestNewInstances(t *testing.T) { expectedErr error }{ { - name: "NewInstance: when everything is ok", + name: "NewInstance: when everything is ok", + // The above code is declaring a test environment variable of type `envtest.Environment` and + // initializing it with an empty instance of `envtest.Environment`. testEnv: &envtest.Environment{}, expectedErr: nil, }, @@ -94,16 +95,14 @@ func TestNewInstances(t *testing.T) { } } -func initTest(testVM *vmopv1alpha1.VirtualMachine) (*instances, *util.FakeClientWrapper) { - scheme := runtime.NewScheme() - _ = vmopv1alpha1.AddToScheme(scheme) - fc := fakeClient.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(testVM).Build() - fcw := util.NewFakeClientWrapper(fc) +func initTest(testVM *vmopv1alpha1.VirtualMachine) (*instances, *fakevmclient.Clientset, error) { + fc := fakevmclient.NewSimpleClientset() instance := &instances{ - vmClient: fcw, + vmClient: fc, namespace: testClusterNameSpace, } - return instance, fcw + _, err := fc.VmoperatorV1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + return instance, fc, err } func TestInstanceID(t *testing.T) { @@ -142,7 +141,8 @@ func TestInstanceID(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, _ := initTest(testCase.testVM) + instance, _, err := initTest(testCase.testVM) + assert.NoError(t, err) instanceID, err := instance.InstanceID(context.Background(), testVMName) assert.Equal(t, testCase.expectedErr, err) assert.Equal(t, testCase.expectedInstanceID, instanceID) @@ -165,11 +165,11 @@ func TestInstanceIDThrowsErr(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, fcw := initTest(testCase.testVM) - fcw.GetFunc = func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - return fmt.Errorf("Internal error getting VMs") - } - + instance, fc, err := initTest(testCase.testVM) + assert.NoError(t, err) + fc.PrependReactor("get", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachine{}, fmt.Errorf("Internal error getting VMs") + }) instanceID, err := instance.InstanceID(context.Background(), testVMName) assert.NotEqual(t, nil, err) assert.NotEqual(t, cloudprovider.InstanceNotFound, err) @@ -201,7 +201,8 @@ func TestInstanceExistsByProviderID(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, _ := initTest(testCase.testVM) + instance, _, err := initTest(testCase.testVM) + assert.NoError(t, err) providerID, err := instance.InstanceExistsByProviderID(context.Background(), testProviderID) assert.Equal(t, testCase.expectedErr, err) assert.Equal(t, testCase.expectedResult, providerID) @@ -255,7 +256,8 @@ func TestInstanceShutdownByProviderID(t *testing.T) { testCase.testVM.Status.PowerState = vmopv1alpha1.VirtualMachinePoweredOff } - instance, _ := initTest(testCase.testVM) + instance, _, err := initTest(testCase.testVM) + assert.NoError(t, err) ret, err := instance.InstanceShutdownByProviderID(context.Background(), testProviderID) assert.Equal(t, testCase.expectedErr, err) assert.Equal(t, testCase.expectedResult, ret) @@ -301,7 +303,8 @@ func TestNodeAddressesByProviderID(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, _ := initTest(testCase.testVM) + instance, _, err := initTest(testCase.testVM) + assert.NoError(t, err) ret, err := instance.NodeAddressesByProviderID(context.Background(), testProviderID) assert.Equal(t, testCase.expectedErr, err) assert.Equal(t, testCase.expectedNodeAddress, ret) @@ -324,11 +327,11 @@ func TestNodeAddressesByProviderIDInternalErr(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, fcw := initTest(testCase.testVM) - fcw.ListFunc = func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - return fmt.Errorf("Internal error listing VMs") - } - + instance, fc, err := initTest(testCase.testVM) + assert.NoError(t, err) + fc.PrependReactor("list", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineList{}, fmt.Errorf("Internal error listing VMs") + }) ret, err := instance.NodeAddressesByProviderID(context.Background(), testProviderID) assert.NotEqual(t, nil, err) assert.NotEqual(t, cloudprovider.InstanceNotFound, err) @@ -375,7 +378,8 @@ func TestNodeAddresses(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, _ := initTest(testCase.testVM) + instance, _, err := initTest(testCase.testVM) + assert.NoError(t, err) ret, err := instance.NodeAddresses(context.Background(), testVMName) assert.Equal(t, testCase.expectedErr, err) assert.Equal(t, testCase.expectedNodeAddress, ret) @@ -398,11 +402,11 @@ func TestNodeAddressesInternalErr(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - instance, fcw := initTest(testCase.testVM) - fcw.GetFunc = func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - return fmt.Errorf("Internal error getting VMs") - } - + instance, fc, err := initTest(testCase.testVM) + assert.NoError(t, err) + fc.PrependReactor("get", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachine{}, fmt.Errorf("Internal error getting VMs") + }) ret, err := instance.NodeAddresses(context.Background(), testVMName) assert.NotEqual(t, nil, err) assert.NotEqual(t, cloudprovider.InstanceNotFound, err) diff --git a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go index b3de904b8..4608cfb95 100644 --- a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go @@ -27,13 +27,12 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" - "sigs.k8s.io/controller-runtime/pkg/client" - fakeClient "sigs.k8s.io/controller-runtime/pkg/client/fake" + fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" - "k8s.io/cloud-provider-vsphere/pkg/util" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) @@ -51,15 +50,13 @@ var ( } ) -func newTestLoadBalancer() (cloudprovider.LoadBalancer, *util.FakeClientWrapper) { - scheme := runtime.NewScheme() - _ = vmopv1alpha1.AddToScheme(scheme) - fc := fakeClient.NewClientBuilder().WithScheme(scheme).Build() - fcw := util.NewFakeClientWrapper(fc) - vms := vmservice.NewVMService(fcw, testClusterNameSpace, &testOwnerReference) +func newTestLoadBalancer() (cloudprovider.LoadBalancer, *fakevmclient.Clientset) { + fc := fakevmclient.NewSimpleClientset() + + vms := vmservice.NewVMService(fc, testClusterNameSpace, &testOwnerReference) return &loadBalancer{ vmService: vms, - }, fcw + }, fc } func TestNewLoadBalancer(t *testing.T) { @@ -155,7 +152,7 @@ func TestUpdateLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -181,9 +178,9 @@ func TestUpdateLoadBalancer(t *testing.T) { if testCase.expectErr { // Ensure that the client Update call returns an error on update - fcw.UpdateFunc = func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - return fmt.Errorf("Some undefined update error") - } + fc.PrependReactor("update", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineService{}, fmt.Errorf("Some undefined update error") + }) err = lb.UpdateLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.Error(t, err) } else { @@ -195,7 +192,7 @@ func TestUpdateLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -205,8 +202,9 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, }, } - fcw.CreateFunc = func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - vms := &vmopv1alpha1.VirtualMachineService{ + + fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ Ingress: []vmopv1alpha1.LoadBalancerIngress{ @@ -216,10 +214,8 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { }, }, }, - } - vms.DeepCopyInto(obj.(*vmopv1alpha1.VirtualMachineService)) - return nil - } + }, nil + }) _, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.NoError(t, ensureErr) @@ -231,17 +227,20 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { func TestEnsureLoadBalancer(t *testing.T) { testCases := []struct { name string - createFunc func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error + createFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) expectErr error }{ { - name: "when VMService is created but IP not found", + name: "when VMService is created but IP not found", + createFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineService{}, fmt.Errorf(vmservice.ErrVMServiceIPNotFound.Error()) + }, expectErr: vmservice.ErrVMServiceIPNotFound, }, { name: "when VMService creation failed", - createFunc: func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - return fmt.Errorf(vmservice.ErrCreateVMService.Error()) + createFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineService{}, fmt.Errorf(vmservice.ErrCreateVMService.Error()) }, expectErr: vmservice.ErrCreateVMService, }, @@ -249,14 +248,14 @@ func TestEnsureLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, Namespace: testK8sServiceNameSpace, }, } - fcw.CreateFunc = testCase.createFunc + fc.PrependReactor("create", "virtualmachineservices", testCase.createFunc) _, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.Equal(t, ensureErr.Error(), testCase.expectErr.Error()) @@ -268,7 +267,7 @@ func TestEnsureLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -276,8 +275,8 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { }, } // Ensure that the client Create call returns a VMService with a valid IP - fcw.CreateFunc = func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - vms := &vmopv1alpha1.VirtualMachineService{ + fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ Ingress: []vmopv1alpha1.LoadBalancerIngress{ @@ -308,10 +307,8 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { vmservice.NodeSelectorKey: vmservice.NodeRole, }, }, - } - vms.DeepCopyInto(obj.(*vmopv1alpha1.VirtualMachineService)) - return nil - } + }, nil + }) status, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.NoError(t, ensureErr) @@ -324,19 +321,19 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { testCases := []struct { name string - deleteFunc func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error + deleteFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) expectErr string }{ { name: "should ignore not found error", - deleteFunc: func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - return apierrors.NewNotFound(vmopv1alpha1.Resource("virtualmachineservice"), testClustername) + deleteFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, apierrors.NewNotFound(vmopv1alpha1.Resource("virtualmachineservice"), testClustername) }, }, { name: "should return error", - deleteFunc: func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - return fmt.Errorf("an error occurred while deleting load balancer") + deleteFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, fmt.Errorf("an error occurred while deleting load balancer") }, expectErr: "an error occurred while deleting load balancer", }, @@ -344,7 +341,7 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -356,7 +353,8 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { err := lb.EnsureLoadBalancerDeleted(context.Background(), testClustername, testK8sService) assert.NoError(t, err) - fcw.DeleteFunc = testCase.deleteFunc + fc.PrependReactor("delete", "virtualmachineservices", testCase.deleteFunc) + err = lb.EnsureLoadBalancerDeleted(context.Background(), "test", testK8sService) if err != nil { assert.Equal(t, err.Error(), testCase.expectErr) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go index f4ed891bb..5bc0fcb9e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go @@ -5,14 +5,16 @@ import ( vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/cloud-provider-vsphere/pkg/util" - "sigs.k8s.io/controller-runtime/pkg/client" + + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" ) // discoverNodeByProviderID takes a ProviderID and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient client.Client) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmopclient.Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -22,10 +24,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace checkError, func() error { uuid := GetUUIDFromProviderID(providerID) - vms := vmopv1alpha1.VirtualMachineList{} - err := vmClient.List(ctx, &vms, &client.ListOptions{ - Namespace: namespace, - }) + vms, err := vmClient.VmoperatorV1alpha1().VirtualMachines(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return err } @@ -45,7 +44,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace // discoverNodeByName takes a node name and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient client.Client) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmopclient.Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -54,16 +53,14 @@ func discoverNodeByName(ctx context.Context, name types.NodeName, namespace stri DiscoverNodeBackoff, checkError, func() error { - vmKey := types.NamespacedName{Name: string(name), Namespace: namespace} - vm := vmopv1alpha1.VirtualMachine{} - err := vmClient.Get(ctx, vmKey, &vm) + vm, err := vmClient.VmoperatorV1alpha1().VirtualMachines(namespace).Get(ctx, string(name), metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { return nil } return err } - discoveredNode = &vm + discoveredNode = vm return nil }) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go index 556e9bb16..cd7726629 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go @@ -22,9 +22,9 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2/klogr" - "sigs.k8s.io/controller-runtime/pkg/client" "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" ) var log = klogr.New().WithName("vmservice") @@ -41,7 +41,7 @@ type VMService interface { // vmService takes care of mapping of LB type of service to VM service in supervisor cluster type vmService struct { - vmClient client.Client + vmClient vmopclient.Interface namespace string ownerReference *metav1.OwnerReference } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go index d5cc12120..267de3e7a 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go @@ -29,11 +29,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" rest "k8s.io/client-go/rest" - client "sigs.k8s.io/controller-runtime/pkg/client" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" ) const ( @@ -89,17 +88,14 @@ var ( // GetVmopClient gets a vm-operator-api client // This is separate from NewVMService so that a fake client can be injected for testing -func GetVmopClient(config *rest.Config) (client.Client, error) { +func GetVmopClient(config *rest.Config) (vmopclient.Interface, error) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) - client, err := client.New(config, client.Options{ - Scheme: scheme, - }) - return client, err + return vmopclient.NewForConfig(config) } // NewVMService creates a vmService object -func NewVMService(vmClient client.Client, ns string, ownerRef *metav1.OwnerReference) VMService { +func NewVMService(vmClient vmopclient.Interface, ns string, ownerRef *metav1.OwnerReference) VMService { return &vmService{ vmClient: vmClient, namespace: ns, @@ -135,10 +131,8 @@ func (s *vmService) Get(ctx context.Context, service *v1.Service, clusterName st logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to get VirtualMachineService") - vmService := vmopv1alpha1.VirtualMachineService{} - vmServiceKey := types.NamespacedName{Name: s.GetVMServiceName(service, clusterName), Namespace: s.namespace} - - if err := s.vmClient.Get(ctx, vmServiceKey, &vmService); err != nil { + vmService, err := s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Get(ctx, s.GetVMServiceName(service, clusterName), metav1.GetOptions{}) + if err != nil { if apierrors.IsNotFound(err) { return nil, nil } @@ -146,7 +140,7 @@ func (s *vmService) Get(ctx context.Context, service *v1.Service, clusterName st return nil, err } - return &vmService, nil + return vmService, nil } // Create creates a vmservice to map to the given lb type of service, it should be called if vmservice not found @@ -160,8 +154,8 @@ func (s *vmService) Create(ctx context.Context, service *v1.Service, clusterName return nil, err } - vmService.Namespace = s.namespace - if err = s.vmClient.Create(ctx, vmService); err != nil { + vmService, err = s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Create(ctx, vmService, metav1.CreateOptions{}) + if err != nil { logger.Error(ErrCreateVMService, fmt.Sprintf("%v", err)) return nil, err } @@ -258,7 +252,8 @@ func (s *vmService) Update(ctx context.Context, service *v1.Service, clusterName } if needsUpdate { - if err := s.vmClient.Update(ctx, newVMService); err != nil { + newVMService, err = s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Update(ctx, newVMService, metav1.UpdateOptions{}) + if err != nil { logger.Error(ErrUpdateVMService, fmt.Sprintf("%v", err)) return nil, err } @@ -275,11 +270,8 @@ func (s *vmService) Delete(ctx context.Context, service *v1.Service, clusterName logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to delete VirtualMachineService") - vmService := vmopv1alpha1.VirtualMachineService{} - vmService.Name = s.GetVMServiceName(service, clusterName) - vmService.Namespace = s.namespace - - if err := s.vmClient.Delete(ctx, &vmService); err != nil { + err := s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Delete(ctx, s.GetVMServiceName(service, clusterName), metav1.DeleteOptions{}) + if err != nil { logger.Error(ErrDeleteVMService, fmt.Sprintf("%v", err)) return err } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go index 0436dc825..80556f146 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go @@ -24,19 +24,17 @@ import ( "github.com/stretchr/testify/assert" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/api/core/v1" "k8s.io/api/node/v1alpha1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" + runtime "k8s.io/apimachinery/pkg/runtime" + clientgotesting "k8s.io/client-go/testing" + "k8s.io/apimachinery/pkg/util/intstr" - "sigs.k8s.io/controller-runtime/pkg/client" - fakeClient "sigs.k8s.io/controller-runtime/pkg/client/fake" + fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - - "k8s.io/cloud-provider-vsphere/pkg/util" ) var ( @@ -54,10 +52,10 @@ var ( fakeLBIP = "1.1.1.1" // FakeClientWrapper allows functions to be replaced for fault injection - fcw *util.FakeClientWrapper + fc *fakevmclient.Clientset ) -func initTest() (*v1.Service, VMService, *util.FakeClientWrapper) { +func initTest() (*v1.Service, VMService, *fakevmclient.Clientset) { testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -78,13 +76,10 @@ func initTest() (*v1.Service, VMService, *util.FakeClientWrapper) { }, }, } - scheme := runtime.NewScheme() - _ = vmopv1alpha1.AddToScheme(scheme) - fc := fakeClient.NewClientBuilder().WithScheme(scheme).Build() - fcw = util.NewFakeClientWrapper(fc) - vms = NewVMService(fcw, testClusterNameSpace, &testOwnerReference) + fc := fakevmclient.NewSimpleClientset() + vms = NewVMService(fc, testClusterNameSpace, &testOwnerReference) - return testK8sService, vms, fcw + return testK8sService, vms, fc } func TestNewVMService(t *testing.T) { @@ -408,20 +403,20 @@ func TestCreateOrUpdateVMService(t *testing.T) { func TestCreateOrUpdateVMService_RedefineGetFunc(t *testing.T) { testCases := []struct { name string - getFunc func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error + getFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) expectedErr error }{ { name: "failed to create VirtualMachineService", - getFunc: func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - return fmt.Errorf("failed to get VirtualMachineService") + getFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, fmt.Errorf("failed to get VirtualMachineService") }, expectedErr: ErrGetVMService, }, { name: "when VMService does not exist", - getFunc: func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - return apierrors.NewNotFound(v1alpha1.Resource("virtualmachineservice"), testClustername) + getFunc: func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, apierrors.NewNotFound(v1alpha1.Resource("virtualmachineservice"), testClustername) }, expectedErr: ErrVMServiceIPNotFound, }, @@ -429,9 +424,9 @@ func TestCreateOrUpdateVMService_RedefineGetFunc(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - testK8sService, vms, fcw := initTest() + testK8sService, vms, fc := initTest() // Redefine Get in the client to return an error - fcw.GetFunc = testCase.getFunc + fc.PrependReactor("get", "virtualmachineservices", testCase.getFunc) _, err := vms.CreateOrUpdate(context.Background(), testK8sService, testClustername) assert.Equal(t, testCase.expectedErr.Error(), err.Error()) }) @@ -439,11 +434,11 @@ func TestCreateOrUpdateVMService_RedefineGetFunc(t *testing.T) { } func TestCreateOrUpdateVMService_RedefineCreateFunc(t *testing.T) { - testK8sService, vms, fcw := initTest() + testK8sService, vms, fc := initTest() // Redefine Create in the client to return an error - fcw.CreateFunc = func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - return fmt.Errorf("failed to create VirtualMachineService") - } + fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, fmt.Errorf("failed to create VirtualMachineService") + }) _, err := vms.CreateOrUpdate(context.Background(), testK8sService, testClustername) assert.Equal(t, ErrCreateVMService.Error(), err.Error()) } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone.go b/pkg/cloudprovider/vsphereparavirtual/zone.go index 7f896d0b5..aff4816a0 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone.go @@ -4,16 +4,17 @@ import ( "context" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" cloudprovider "k8s.io/cloud-provider" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" "k8s.io/klog/v2" - "sigs.k8s.io/controller-runtime/pkg/client" ) type zones struct { - vmClient client.Client + vmClient vmopclient.Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone_test.go b/pkg/cloudprovider/vsphereparavirtual/zone_test.go index f898705b0..b58f0afff 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone_test.go @@ -7,11 +7,9 @@ import ( "github.com/stretchr/testify/assert" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" cloudprovider "k8s.io/cloud-provider" - "k8s.io/cloud-provider-vsphere/pkg/util" - fakeClient "sigs.k8s.io/controller-runtime/pkg/client/fake" + fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" ) @@ -78,7 +76,8 @@ func TestZonesByProviderID(t *testing.T) { t.Run(testCase.name, func(t *testing.T) { ctx := context.Background() - zone, _ := initVMopClient(testCase.testVM) + zone, _, err := initVMopClient(testCase.testVM) + assert.NoError(t, err) z, err := zone.GetZoneByProviderID(ctx, providerid) if testCase.expectedErr != nil { @@ -121,7 +120,8 @@ func TestZonesByNodeName(t *testing.T) { t.Run(testCase.name, func(t *testing.T) { ctx := context.Background() - zone, _ := initVMopClient(testCase.testVM) + zone, _, err := initVMopClient(testCase.testVM) + assert.NoError(t, err) z, err := zone.GetZoneByNodeName(ctx, testCase.vmName) if testCase.expectedErr != nil { @@ -135,16 +135,14 @@ func TestZonesByNodeName(t *testing.T) { } } -func initVMopClient(testVM *vmopv1alpha1.VirtualMachine) (zones, *util.FakeClientWrapper) { - scheme := runtime.NewScheme() - _ = vmopv1alpha1.AddToScheme(scheme) - fc := fakeClient.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(testVM).Build() - fcw := util.NewFakeClientWrapper(fc) +func initVMopClient(testVM *vmopv1alpha1.VirtualMachine) (zones, *fakevmclient.Clientset, error) { + fc := fakevmclient.NewSimpleClientset() zone := zones{ - vmClient: fcw, + vmClient: fc, namespace: testClusterNameSpace, } - return zone, fcw + _, err := fc.VmoperatorV1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + return zone, fc, err } func createTestVMWithZone(name, namespace string) *vmopv1alpha1.VirtualMachine { diff --git a/pkg/util/fake_client_wrapper.go b/pkg/util/fake_client_wrapper.go deleted file mode 100644 index f39b81fdc..000000000 --- a/pkg/util/fake_client_wrapper.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package util - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime/schema" - - "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/apimachinery/pkg/runtime" - - client "sigs.k8s.io/controller-runtime/pkg/client" -) - -// FakeClientWrapper allows functions to be replaced for fault injection -type FakeClientWrapper struct { - fakeClient client.Client - // Set these functions if you want to override the default fakeClient behavior - GetFunc func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error - CreateFunc func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error - UpdateFunc func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error - DeleteFunc func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error - ListFunc func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error -} - -// Scheme invokes the fakeClient's Scheme -func (w *FakeClientWrapper) Scheme() *runtime.Scheme { - return w.fakeClient.Scheme() -} - -// RESTMapper invokes the fakeClient's RESTMapper -func (w *FakeClientWrapper) RESTMapper() meta.RESTMapper { - return w.fakeClient.RESTMapper() -} - -// NewFakeClientWrapper creates a FakeClientWrapper -func NewFakeClientWrapper(fakeClient client.Client) *FakeClientWrapper { - fcw := FakeClientWrapper{} - fcw.fakeClient = fakeClient - return &fcw -} - -// Get retrieves an obj for the given object key from the Kubernetes Cluster. -func (w *FakeClientWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - if w.GetFunc != nil { - return w.GetFunc(ctx, key, obj, opts...) - } - return w.fakeClient.Get(ctx, key, obj, opts...) -} - -// List retrieves list of objects for a given namespace and list options. -func (w *FakeClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - if w.ListFunc != nil { - return w.ListFunc(ctx, list, opts...) - } - return w.fakeClient.List(ctx, list, opts...) -} - -// Create saves the object obj in the Kubernetes cluster. -func (w *FakeClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - if w.CreateFunc != nil { - return w.CreateFunc(ctx, obj, opts...) - } - return w.fakeClient.Create(ctx, obj, opts...) -} - -// Delete deletes the given obj from Kubernetes cluster. -func (w *FakeClientWrapper) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - if w.DeleteFunc != nil { - return w.DeleteFunc(ctx, obj, opts...) - } - return w.fakeClient.Delete(ctx, obj, opts...) -} - -// Update updates the given obj in the Kubernetes cluster. -func (w *FakeClientWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - if w.UpdateFunc != nil { - return w.UpdateFunc(ctx, obj, opts...) - } - return w.fakeClient.Update(ctx, obj, opts...) -} - -// Patch patches the given obj in the Kubernetes cluster. -func (w *FakeClientWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - return w.fakeClient.Patch(ctx, obj, patch, opts...) -} - -// DeleteAllOf deletes all objects of the given type matching the given options. -func (w *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { - return w.fakeClient.DeleteAllOf(ctx, obj, opts...) -} - -// Status returns a StatusWriter which knows how to update status subresource of a Kubernetes object. -func (w *FakeClientWrapper) Status() client.StatusWriter { - return w.fakeClient.Status() -} - -// SubResource returns a SubResourceClient for the resource. -func (w *FakeClientWrapper) SubResource(subResource string) client.SubResourceClient { - return w.fakeClient.SubResource(subResource) -} - -// GroupVersionKindFor returns the GroupVersionKind for the given object. -func (w *FakeClientWrapper) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) { - return w.fakeClient.GroupVersionKindFor(obj) -} - -// IsObjectNamespaced returns true if the GroupVersionKind of the object is namespaced. -func (w *FakeClientWrapper) IsObjectNamespaced(obj runtime.Object) (bool, error) { - return w.fakeClient.IsObjectNamespaced(obj) -} diff --git a/pkg/util/fake_vm_client_wrapper.go b/pkg/util/fake_vm_client_wrapper.go new file mode 100644 index 000000000..9140994b2 --- /dev/null +++ b/pkg/util/fake_vm_client_wrapper.go @@ -0,0 +1,97 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "context" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/discovery" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + fake "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" + vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" +) + +// FakeClientWrapper allows functions to be replaced for fault injection +type FakeVMClientWrapper struct { + fakeClient vmopclient.Interface + // Set these functions if you want to override the default fakeClient behavior + GetFunc func(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachine, err error) + ListFunc func(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineList, err error) + CreateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachine, err error) + UpdateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachine, err error) + DeleteFunc func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error +} + +// NewFakeVMClientWrapper creates a FakeClientWrapper +func NewFakeVMClientWrapper(fakeClient *fake.Clientset) *FakeVMClientWrapper { + fcw := FakeVMClientWrapper{} + fcw.fakeClient = fakeClient + return &fcw +} + +// Get retrieves an obj for the given object key from the Kubernetes Cluster. +func (w *FakeVMClientWrapper) Get(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachine, err error) { + if w.GetFunc != nil { + return w.GetFunc(ctx, namespace, name, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).Get(ctx, name, opts) +} + +// List retrieves list of objects for a given namespace and list options. +func (w *FakeVMClientWrapper) List(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineList, err error) { + if w.ListFunc != nil { + return w.ListFunc(ctx, namespace, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).List(ctx, opts) +} + +// Create saves the object obj in the Kubernetes cluster. +func (w *FakeVMClientWrapper) Create(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachine, err error) { + if w.CreateFunc != nil { + return w.CreateFunc(ctx, vm, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(vm.Namespace).Create(ctx, vm, opts) +} + +// Update updates the given obj in the Kubernetes cluster. +func (w *FakeVMClientWrapper) Update(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachine, err error) { + if w.UpdateFunc != nil { + return w.UpdateFunc(ctx, vm, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(vm.Namespace).Update(ctx, vm, opts) +} + +// Delete deletes the given obj from Kubernetes cluster. +func (w *FakeVMClientWrapper) Delete(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { + if w.DeleteFunc != nil { + return w.DeleteFunc(ctx, namespace, name, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).Delete(ctx, name, opts) +} + +// Discovery retrieves the DiscoveryClient +func (w *FakeVMClientWrapper) Discovery() discovery.DiscoveryInterface { + return w.fakeClient.Discovery() +} + +// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client +func (w *FakeVMClientWrapper) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { + return w.fakeClient.VmoperatorV1alpha1() +} diff --git a/pkg/util/fake_vm_service_client_wrapper.go b/pkg/util/fake_vm_service_client_wrapper.go new file mode 100644 index 000000000..f505904dd --- /dev/null +++ b/pkg/util/fake_vm_service_client_wrapper.go @@ -0,0 +1,97 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "context" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/discovery" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + fake "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" + vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" +) + +// FakeVMServiceClientWrapper allows functions to be replaced for fault injection +type FakeVMServiceClientWrapper struct { + fakeClient vmopclient.Interface + // Set these functions if you want to override the default fakeClient behavior + GetFunc func(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachineService, err error) + ListFunc func(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineServiceList, err error) + CreateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachineService, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) + UpdateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachineService, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) + DeleteFunc func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error +} + +// NewFakeVMClientWrapper creates a FakeClientWrapper +func NewFakeVMServiceClientWrapper(fakeClient *fake.Clientset) *FakeVMServiceClientWrapper { + fcw := FakeVMServiceClientWrapper{} + fcw.fakeClient = fakeClient + return &fcw +} + +// Get retrieves an obj for the given object key from the Kubernetes Cluster. +func (w *FakeVMServiceClientWrapper) Get(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { + if w.GetFunc != nil { + return w.GetFunc(ctx, namespace, name, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).Get(ctx, name, opts) +} + +// List retrieves list of objects for a given namespace and list options. +func (w *FakeVMServiceClientWrapper) List(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineServiceList, err error) { + if w.ListFunc != nil { + return w.ListFunc(ctx, namespace, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).List(ctx, opts) +} + +// Create saves the object obj in the Kubernetes cluster. +func (w *FakeVMServiceClientWrapper) Create(ctx context.Context, vmservice *vmopv1alpha1.VirtualMachineService, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { + if w.CreateFunc != nil { + return w.CreateFunc(ctx, vmservice, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(vmservice.Namespace).Create(ctx, vmservice, opts) +} + +// Update updates the given obj in the Kubernetes cluster. +func (w *FakeVMServiceClientWrapper) Update(ctx context.Context, vmservice *vmopv1alpha1.VirtualMachineService, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { + if w.UpdateFunc != nil { + return w.UpdateFunc(ctx, vmservice, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(vmservice.Namespace).Update(ctx, vmservice, opts) +} + +// Delete deletes the given obj from Kubernetes cluster. +func (w *FakeVMServiceClientWrapper) Delete(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { + if w.DeleteFunc != nil { + return w.DeleteFunc(ctx, namespace, name, opts) + } + return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).Delete(ctx, name, opts) +} + +// Discovery retrieves the DiscoveryClient +func (w *FakeVMServiceClientWrapper) Discovery() discovery.DiscoveryInterface { + return w.fakeClient.Discovery() +} + +// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client +func (w *FakeVMServiceClientWrapper) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { + return w.fakeClient.VmoperatorV1alpha1() +} From 74bde04b3566a5568fe11d7dadfca0ce15ae9efe Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Mon, 29 Jan 2024 11:44:35 +0800 Subject: [PATCH 3/8] lint Signed-off-by: Xudong Liu --- .../vsphereparavirtual/vmop/applyconfiguration/utils.go | 2 +- .../applyconfiguration/vmop/v1alpha1/virtualmachineclass.go | 2 +- .../applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go | 2 +- .../vmop/clientset/versioned/fake/register.go | 2 +- .../vmop/clientset/versioned/scheme/register.go | 2 +- .../versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go | 2 +- .../typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go | 2 +- .../typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go | 2 +- .../typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go | 2 +- .../vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go | 2 +- .../clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go | 2 +- .../versioned/typed/vmop/v1alpha1/virtualmachineclass.go | 2 +- .../versioned/typed/vmop/v1alpha1/virtualmachineimage.go | 2 +- .../versioned/typed/vmop/v1alpha1/virtualmachineservice.go | 2 +- .../typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go | 2 +- .../vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go | 2 +- .../vmop/informers/externalversions/generic.go | 2 +- .../informers/externalversions/vmop/v1alpha1/virtualmachine.go | 2 +- .../externalversions/vmop/v1alpha1/virtualmachineclass.go | 2 +- .../externalversions/vmop/v1alpha1/virtualmachineimage.go | 2 +- .../externalversions/vmop/v1alpha1/virtualmachineservice.go | 2 +- .../vmop/v1alpha1/virtualmachinesetresourcepolicy.go | 2 +- .../vmop/listers/vmop/v1alpha1/virtualmachine.go | 2 +- .../vmop/listers/vmop/v1alpha1/virtualmachineclass.go | 2 +- .../vmop/listers/vmop/v1alpha1/virtualmachineimage.go | 2 +- .../vmop/listers/vmop/v1alpha1/virtualmachineservice.go | 2 +- .../listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go index 611944add..a557dfba3 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go @@ -19,8 +19,8 @@ limitations under the License. package applyconfiguration import ( - schema "k8s.io/apimachinery/pkg/runtime/schema" v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go index 2ee76a746..896559c62 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineClassApplyConfiguration represents an declarative configuration of the VirtualMachineClass type for use diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go index 24b9d3208..344ae2ae1 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // VirtualMachineConditionApplyConfiguration represents an declarative configuration of the VirtualMachineCondition type for use diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go index 9f62d8214..456b37ed8 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go @@ -19,12 +19,12 @@ limitations under the License. package fake import ( + vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) var scheme = runtime.NewScheme() diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go index 57cf15249..0efd72eb4 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go @@ -19,12 +19,12 @@ limitations under the License. package scheme import ( + vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) var Scheme = runtime.NewScheme() diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go index df46d6d00..ca88f1a2b 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go @@ -23,12 +23,12 @@ import ( json "encoding/json" "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go index ab6b0dd81..23eb14817 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go @@ -23,12 +23,12 @@ import ( json "encoding/json" "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go index b42257eb8..02863b1a3 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go @@ -23,12 +23,12 @@ import ( json "encoding/json" "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go index fceca34d5..e519b4504 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go @@ -23,12 +23,12 @@ import ( json "encoding/json" "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go index bae95697d..4ec9ea282 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go @@ -23,12 +23,12 @@ import ( json "encoding/json" "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go index 75ad3fa27..d3bf04fe4 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go @@ -24,11 +24,11 @@ import ( "fmt" "time" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go index bd20cdddc..89df625a4 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go @@ -24,11 +24,11 @@ import ( "fmt" "time" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go index 9a45ab855..d5d03b8f1 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go @@ -24,11 +24,11 @@ import ( "fmt" "time" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go index 836ff0eed..c7690c2ef 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go @@ -24,11 +24,11 @@ import ( "fmt" "time" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go index 37253c97a..7e54ac1be 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -24,11 +24,11 @@ import ( "fmt" "time" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go index c3eabbb14..1fbf5a3f7 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go @@ -21,8 +21,8 @@ package v1alpha1 import ( "net/http" - rest "k8s.io/client-go/rest" v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + rest "k8s.io/client-go/rest" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" ) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go index c7386f2fd..a4b33ab37 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go @@ -21,9 +21,9 @@ package externalversions import ( "fmt" + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go index 9e5836311..d53911942 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go @@ -22,11 +22,11 @@ import ( "context" time "time" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go index c5771c8b0..4ee0066c5 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go @@ -22,11 +22,11 @@ import ( "context" time "time" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go index 95c1d6e04..beda0e4fe 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go @@ -22,11 +22,11 @@ import ( "context" time "time" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go index e18388338..4b51ff16e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go @@ -22,11 +22,11 @@ import ( "context" time "time" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go index 8926bbcd6..d564924f1 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -22,11 +22,11 @@ import ( "context" time "time" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go index f973a0e24..ebbed93fc 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineLister helps list VirtualMachines. diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go index 92881420a..a189482e5 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineClassLister helps list VirtualMachineClasses. diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go index 57ce5cdec..fd1941b99 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineImageLister helps list VirtualMachineImages. diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go index ee88ca2f4..f05e0af98 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineServiceLister helps list VirtualMachineServices. diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go index 6220ac1b5..d7288b287 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( + v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) // VirtualMachineSetResourcePolicyLister helps list VirtualMachineSetResourcePolicies. From d0ef60cd8e72f6e633e0b03036e5a294ad1a8b8b Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Mon, 29 Jan 2024 12:06:04 +0800 Subject: [PATCH 4/8] remove unused wrapper Signed-off-by: Xudong Liu --- go.mod | 6 +- go.sum | 16 +-- .../vsphereparavirtual/instances_test.go | 18 +--- .../vsphereparavirtual/loadbalancer_test.go | 22 ++--- .../vmservice/vmservice_test.go | 25 ++--- .../vsphereparavirtual/zone_test.go | 15 +-- pkg/util/fake_vm_client_wrapper.go | 97 ------------------- pkg/util/fake_vm_service_client_wrapper.go | 97 ------------------- 8 files changed, 31 insertions(+), 265 deletions(-) delete mode 100644 pkg/util/fake_vm_client_wrapper.go delete mode 100644 pkg/util/fake_vm_service_client_wrapper.go diff --git a/go.mod b/go.mod index 72eb11eaa..fbd0fec06 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( k8s.io/code-generator v0.29.0 k8s.io/component-base v0.29.0 k8s.io/klog/v2 v2.110.1 - sigs.k8s.io/controller-runtime v0.16.0 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 ) @@ -46,7 +46,6 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/gibson042/canonicaljson-go v1.0.3 // indirect github.com/go-logr/logr v1.3.0 // indirect @@ -114,7 +113,6 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.29.0 // indirect k8s.io/apiserver v0.29.0 // indirect k8s.io/component-helpers v0.29.0 // indirect k8s.io/controller-manager v0.29.0 // indirect @@ -123,6 +121,6 @@ require ( k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect + sigs.k8s.io/controller-runtime v0.14.5 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index 37708b562..25299cfff 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,6 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7 github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= -github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -71,8 +69,8 @@ github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= -github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= +github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= +github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= @@ -144,7 +142,6 @@ github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -194,7 +191,6 @@ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGV github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -363,8 +359,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= -gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= @@ -405,8 +399,6 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA= k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= -k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= -k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= @@ -441,8 +433,8 @@ k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSn k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= -sigs.k8s.io/controller-runtime v0.16.0 h1:5koYaaRVBHDr0LZAJjO5dWzUjMsh6cwa7q1Mmusrdvk= -sigs.k8s.io/controller-runtime v0.16.0/go.mod h1:77DnuwA8+J7AO0njzv3wbNlMOnGuLrwFr8JPNwx3J7g= +sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s= +sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= diff --git a/pkg/cloudprovider/vsphereparavirtual/instances_test.go b/pkg/cloudprovider/vsphereparavirtual/instances_test.go index f0333b53f..b32af288a 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances_test.go @@ -27,10 +27,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - "sigs.k8s.io/controller-runtime/pkg/envtest" ) var ( @@ -68,29 +68,21 @@ func createTestVMWithVMIPAndHost(name, namespace, biosUUID string) *vmopv1alpha1 func TestNewInstances(t *testing.T) { testCases := []struct { name string - testEnv *envtest.Environment + config *rest.Config expectedErr error }{ { - name: "NewInstance: when everything is ok", - // The above code is declaring a test environment variable of type `envtest.Environment` and - // initializing it with an empty instance of `envtest.Environment`. - testEnv: &envtest.Environment{}, + name: "NewInstance: when everything is ok", + config: &rest.Config{}, expectedErr: nil, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - cfg, err := testCase.testEnv.Start() - assert.NoError(t, err) - - _, err = NewInstances(testClusterNameSpace, cfg) + _, err := NewInstances(testClusterNameSpace, testCase.config) assert.NoError(t, err) assert.Equal(t, testCase.expectedErr, err) - - err = testCase.testEnv.Stop() - assert.NoError(t, err) }) } } diff --git a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go index 4608cfb95..32fa77c04 100644 --- a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go @@ -27,10 +27,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - "sigs.k8s.io/controller-runtime/pkg/envtest" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" @@ -61,27 +61,21 @@ func newTestLoadBalancer() (cloudprovider.LoadBalancer, *fakevmclient.Clientset) func TestNewLoadBalancer(t *testing.T) { testCases := []struct { - name string - testEnv *envtest.Environment - err error + name string + config *rest.Config + err error }{ { - name: "NewLoadBalancer: when everything is ok", - testEnv: &envtest.Environment{}, - err: nil, + name: "NewLoadBalancer: when everything is ok", + config: &rest.Config{}, + err: nil, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - cfg, err := testCase.testEnv.Start() - assert.NoError(t, err) - - _, err = NewLoadBalancer(testClusterNameSpace, cfg, &testOwnerReference) + _, err := NewLoadBalancer(testClusterNameSpace, testCase.config, &testOwnerReference) assert.Equal(t, testCase.err, err) - - err = testCase.testEnv.Stop() - assert.NoError(t, err) }) } } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go index 80556f146..335c3d4b6 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go @@ -30,11 +30,11 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + rest "k8s.io/client-go/rest" clientgotesting "k8s.io/client-go/testing" "k8s.io/apimachinery/pkg/util/intstr" fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - "sigs.k8s.io/controller-runtime/pkg/envtest" ) var ( @@ -50,9 +50,6 @@ var ( } vms VMService fakeLBIP = "1.1.1.1" - - // FakeClientWrapper allows functions to be replaced for fault injection - fc *fakevmclient.Clientset ) func initTest() (*v1.Service, VMService, *fakevmclient.Clientset) { @@ -84,31 +81,25 @@ func initTest() (*v1.Service, VMService, *fakevmclient.Clientset) { func TestNewVMService(t *testing.T) { testCases := []struct { - name string - testEnv *envtest.Environment - err error + name string + config *rest.Config + err error }{ { - name: "NewVMService: when everything is ok", - testEnv: &envtest.Environment{}, - err: nil, + name: "NewVMService: when everything is ok", + config: &rest.Config{}, + err: nil, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - cfg, err := testCase.testEnv.Start() - assert.NoError(t, err) - - client, err := GetVmopClient(cfg) + client, err := GetVmopClient(testCase.config) assert.NoError(t, err) assert.NotEqual(t, client, nil) realVms := NewVMService(client, testClusterNameSpace, &testOwnerReference) assert.NotEqual(t, realVms, nil) - - err = testCase.testEnv.Stop() - assert.NoError(t, err) }) } } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone_test.go b/pkg/cloudprovider/vsphereparavirtual/zone_test.go index b58f0afff..610f629d6 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone_test.go @@ -8,9 +8,9 @@ import ( vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" cloudprovider "k8s.io/cloud-provider" fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - "sigs.k8s.io/controller-runtime/pkg/envtest" ) var ( @@ -23,13 +23,13 @@ var ( func TestNewZones(t *testing.T) { testCases := []struct { name string - testEnv *envtest.Environment + config *rest.Config expectedErr error testVM *vmopv1alpha1.VirtualMachine }{ { name: "NewZone: when everything is ok", - testEnv: &envtest.Environment{}, + config: &rest.Config{}, testVM: createTestVMWithZone(string(vmName), testClusterNameSpace), expectedErr: nil, }, @@ -37,15 +37,10 @@ func TestNewZones(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - cfg, err := testCase.testEnv.Start() - assert.NoError(t, err) //initVMopClient(testCase.testVM) - _, err = NewZones(testClusterNameSpace, cfg) + _, err := NewZones(testClusterNameSpace, testCase.config) assert.NoError(t, err) assert.Equal(t, testCase.expectedErr, err) - - err = testCase.testEnv.Stop() - assert.NoError(t, err) }) } } @@ -53,7 +48,6 @@ func TestNewZones(t *testing.T) { func TestZonesByProviderID(t *testing.T) { testCases := []struct { name string - testEnv *envtest.Environment expectedResult string expectedErr error testVM *vmopv1alpha1.VirtualMachine @@ -94,7 +88,6 @@ func TestZonesByProviderID(t *testing.T) { func TestZonesByNodeName(t *testing.T) { testCases := []struct { name string - testEnv *envtest.Environment expectedResult string expectedErr error testVM *vmopv1alpha1.VirtualMachine diff --git a/pkg/util/fake_vm_client_wrapper.go b/pkg/util/fake_vm_client_wrapper.go deleted file mode 100644 index 9140994b2..000000000 --- a/pkg/util/fake_vm_client_wrapper.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package util - -import ( - "context" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/discovery" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - fake "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" -) - -// FakeClientWrapper allows functions to be replaced for fault injection -type FakeVMClientWrapper struct { - fakeClient vmopclient.Interface - // Set these functions if you want to override the default fakeClient behavior - GetFunc func(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachine, err error) - ListFunc func(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineList, err error) - CreateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachine, err error) - UpdateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachine, err error) - DeleteFunc func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error -} - -// NewFakeVMClientWrapper creates a FakeClientWrapper -func NewFakeVMClientWrapper(fakeClient *fake.Clientset) *FakeVMClientWrapper { - fcw := FakeVMClientWrapper{} - fcw.fakeClient = fakeClient - return &fcw -} - -// Get retrieves an obj for the given object key from the Kubernetes Cluster. -func (w *FakeVMClientWrapper) Get(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachine, err error) { - if w.GetFunc != nil { - return w.GetFunc(ctx, namespace, name, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).Get(ctx, name, opts) -} - -// List retrieves list of objects for a given namespace and list options. -func (w *FakeVMClientWrapper) List(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineList, err error) { - if w.ListFunc != nil { - return w.ListFunc(ctx, namespace, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).List(ctx, opts) -} - -// Create saves the object obj in the Kubernetes cluster. -func (w *FakeVMClientWrapper) Create(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachine, err error) { - if w.CreateFunc != nil { - return w.CreateFunc(ctx, vm, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(vm.Namespace).Create(ctx, vm, opts) -} - -// Update updates the given obj in the Kubernetes cluster. -func (w *FakeVMClientWrapper) Update(ctx context.Context, vm *vmopv1alpha1.VirtualMachine, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachine, err error) { - if w.UpdateFunc != nil { - return w.UpdateFunc(ctx, vm, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(vm.Namespace).Update(ctx, vm, opts) -} - -// Delete deletes the given obj from Kubernetes cluster. -func (w *FakeVMClientWrapper) Delete(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - if w.DeleteFunc != nil { - return w.DeleteFunc(ctx, namespace, name, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachines(namespace).Delete(ctx, name, opts) -} - -// Discovery retrieves the DiscoveryClient -func (w *FakeVMClientWrapper) Discovery() discovery.DiscoveryInterface { - return w.fakeClient.Discovery() -} - -// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client -func (w *FakeVMClientWrapper) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { - return w.fakeClient.VmoperatorV1alpha1() -} diff --git a/pkg/util/fake_vm_service_client_wrapper.go b/pkg/util/fake_vm_service_client_wrapper.go deleted file mode 100644 index f505904dd..000000000 --- a/pkg/util/fake_vm_service_client_wrapper.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package util - -import ( - "context" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/discovery" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - fake "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" - vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" -) - -// FakeVMServiceClientWrapper allows functions to be replaced for fault injection -type FakeVMServiceClientWrapper struct { - fakeClient vmopclient.Interface - // Set these functions if you want to override the default fakeClient behavior - GetFunc func(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachineService, err error) - ListFunc func(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineServiceList, err error) - CreateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachineService, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) - UpdateFunc func(ctx context.Context, vm *vmopv1alpha1.VirtualMachineService, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) - DeleteFunc func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error -} - -// NewFakeVMClientWrapper creates a FakeClientWrapper -func NewFakeVMServiceClientWrapper(fakeClient *fake.Clientset) *FakeVMServiceClientWrapper { - fcw := FakeVMServiceClientWrapper{} - fcw.fakeClient = fakeClient - return &fcw -} - -// Get retrieves an obj for the given object key from the Kubernetes Cluster. -func (w *FakeVMServiceClientWrapper) Get(ctx context.Context, namespace, name string, opts metav1.GetOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { - if w.GetFunc != nil { - return w.GetFunc(ctx, namespace, name, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).Get(ctx, name, opts) -} - -// List retrieves list of objects for a given namespace and list options. -func (w *FakeVMServiceClientWrapper) List(ctx context.Context, namespace string, opts metav1.ListOptions) (result *vmopv1alpha1.VirtualMachineServiceList, err error) { - if w.ListFunc != nil { - return w.ListFunc(ctx, namespace, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).List(ctx, opts) -} - -// Create saves the object obj in the Kubernetes cluster. -func (w *FakeVMServiceClientWrapper) Create(ctx context.Context, vmservice *vmopv1alpha1.VirtualMachineService, opts metav1.CreateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { - if w.CreateFunc != nil { - return w.CreateFunc(ctx, vmservice, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(vmservice.Namespace).Create(ctx, vmservice, opts) -} - -// Update updates the given obj in the Kubernetes cluster. -func (w *FakeVMServiceClientWrapper) Update(ctx context.Context, vmservice *vmopv1alpha1.VirtualMachineService, opts metav1.UpdateOptions) (result *vmopv1alpha1.VirtualMachineService, err error) { - if w.UpdateFunc != nil { - return w.UpdateFunc(ctx, vmservice, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(vmservice.Namespace).Update(ctx, vmservice, opts) -} - -// Delete deletes the given obj from Kubernetes cluster. -func (w *FakeVMServiceClientWrapper) Delete(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - if w.DeleteFunc != nil { - return w.DeleteFunc(ctx, namespace, name, opts) - } - return w.fakeClient.VmoperatorV1alpha1().VirtualMachineServices(namespace).Delete(ctx, name, opts) -} - -// Discovery retrieves the DiscoveryClient -func (w *FakeVMServiceClientWrapper) Discovery() discovery.DiscoveryInterface { - return w.fakeClient.Discovery() -} - -// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client -func (w *FakeVMServiceClientWrapper) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { - return w.fakeClient.VmoperatorV1alpha1() -} From 37441be713097d3052a358756d427b5958b32205 Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Mon, 29 Jan 2024 21:33:46 +0800 Subject: [PATCH 5/8] change to use dynamic client Signed-off-by: Xudong Liu --- go.mod | 18 +- go.sum | 32 +-- .../vsphereparavirtual/instances.go | 4 +- .../vsphereparavirtual/instances_test.go | 21 +- .../vsphereparavirtual/loadbalancer_test.go | 51 ++-- .../applyconfiguration/internal/internal.go | 62 ----- .../vmop/applyconfiguration/utils.go | 113 -------- .../vmop/v1alpha1/clustermodulespec.go | 39 --- .../vmop/v1alpha1/clustermodulestatus.go | 48 ---- .../vmop/v1alpha1/folderspec.go | 39 --- .../vmop/v1alpha1/loadbalanceringress.go | 48 ---- .../vmop/v1alpha1/loadbalancerstatus.go | 44 --- .../networkinterfaceproviderreference.go | 66 ----- .../applyconfiguration/vmop/v1alpha1/probe.go | 57 ---- .../vmop/v1alpha1/resourcepoolspec.go | 57 ---- .../vmop/v1alpha1/tcpsocketaction.go | 52 ---- .../vmop/v1alpha1/virtualmachine.go | 219 --------------- .../v1alpha1/virtualmachineadvancedoptions.go | 48 ---- .../vmop/v1alpha1/virtualmachineclass.go | 219 --------------- .../v1alpha1/virtualmachineclasshardware.go | 52 ---- .../v1alpha1/virtualmachineclasspolicies.go | 39 --- .../v1alpha1/virtualmachineclassresources.go | 48 ---- .../vmop/v1alpha1/virtualmachineclassspec.go | 48 ---- .../vmop/v1alpha1/virtualmachinecondition.go | 80 ------ .../vmop/v1alpha1/virtualmachineimage.go | 218 --------------- .../v1alpha1/virtualmachineimageosinfo.go | 48 ---- .../virtualmachineimageproductinfo.go | 66 ----- .../vmop/v1alpha1/virtualmachineimagespec.go | 66 ----- .../v1alpha1/virtualmachineimagestatus.go | 66 ----- .../vmop/v1alpha1/virtualmachinemetadata.go | 52 ---- .../virtualmachinenetworkinterface.go | 66 ----- .../vmop/v1alpha1/virtualmachineport.go | 70 ----- .../v1alpha1/virtualmachineresourcespec.go | 52 ---- .../vmop/v1alpha1/virtualmachineservice.go | 219 --------------- .../v1alpha1/virtualmachineserviceport.go | 66 ----- .../v1alpha1/virtualmachineservicespec.go | 110 -------- .../v1alpha1/virtualmachineservicestatus.go | 39 --- .../virtualmachinesetresourcepolicy.go | 219 --------------- .../virtualmachinesetresourcepolicyspec.go | 62 ----- .../virtualmachinesetresourcepolicystatus.go | 44 --- .../vmop/v1alpha1/virtualmachinespec.go | 148 ---------- .../vmop/v1alpha1/virtualmachinestatus.go | 134 --------- .../vmop/v1alpha1/virtualmachinevolume.go | 79 ------ ...virtualmachinevolumeprovisioningoptions.go | 48 ---- .../v1alpha1/virtualmachinevolumestatus.go | 66 ----- .../vmop/v1alpha1/vspherevolumesource.go | 52 ---- .../vmop/clientset/versioned/clientset.go | 120 -------- .../versioned/fake/clientset_generated.go | 85 ------ .../vmop/clientset/versioned/fake/doc.go | 20 -- .../vmop/clientset/versioned/fake/register.go | 56 ---- .../vmop/clientset/versioned/scheme/doc.go | 20 -- .../clientset/versioned/scheme/register.go | 56 ---- .../versioned/typed/vmop/v1alpha1/doc.go | 20 -- .../versioned/typed/vmop/v1alpha1/fake/doc.go | 20 -- .../vmop/v1alpha1/fake/fake_virtualmachine.go | 189 ------------- .../v1alpha1/fake/fake_virtualmachineclass.go | 178 ------------ .../v1alpha1/fake/fake_virtualmachineimage.go | 178 ------------ .../fake/fake_virtualmachineservice.go | 189 ------------- .../fake_virtualmachinesetresourcepolicy.go | 189 ------------- .../vmop/v1alpha1/fake/fake_vmop_client.go | 56 ---- .../vmop/v1alpha1/generated_expansion.go | 29 -- .../typed/vmop/v1alpha1/virtualmachine.go | 256 ----------------- .../vmop/v1alpha1/virtualmachineclass.go | 243 ---------------- .../vmop/v1alpha1/virtualmachineimage.go | 243 ---------------- .../vmop/v1alpha1/virtualmachineservice.go | 256 ----------------- .../virtualmachinesetresourcepolicy.go | 256 ----------------- .../typed/vmop/v1alpha1/vmop_client.go | 127 --------- .../informers/externalversions/factory.go | 261 ------------------ .../informers/externalversions/generic.go | 70 ----- .../internalinterfaces/factory_interfaces.go | 40 --- .../externalversions/vmop/interface.go | 46 --- .../vmop/v1alpha1/interface.go | 73 ----- .../vmop/v1alpha1/virtualmachine.go | 90 ------ .../vmop/v1alpha1/virtualmachineclass.go | 89 ------ .../vmop/v1alpha1/virtualmachineimage.go | 89 ------ .../vmop/v1alpha1/virtualmachineservice.go | 90 ------ .../virtualmachinesetresourcepolicy.go | 90 ------ .../vmop/v1alpha1/expansion_generated.go | 51 ---- .../listers/vmop/v1alpha1/virtualmachine.go | 99 ------- .../vmop/v1alpha1/virtualmachineclass.go | 68 ----- .../vmop/v1alpha1/virtualmachineimage.go | 68 ----- .../vmop/v1alpha1/virtualmachineservice.go | 99 ------- .../virtualmachinesetresourcepolicy.go | 99 ------- .../vsphereparavirtual/vmoperator.go | 10 +- .../vmoperator/client/client.go | 60 ++++ .../vmoperator/client/fake_client.go | 34 +++ .../client/virtualmachine_client.go | 87 ++++++ .../client/virtualmachineservice_client.go | 87 ++++++ .../vmoperator/interface.go | 35 +++ .../vsphereparavirtual/vmservice/types.go | 4 +- .../vsphereparavirtual/vmservice/vmservice.go | 18 +- .../vmservice/vmservice_test.go | 13 +- pkg/cloudprovider/vsphereparavirtual/zone.go | 4 +- .../vsphereparavirtual/zone_test.go | 16 +- 94 files changed, 408 insertions(+), 7662 deletions(-) delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go delete mode 100644 pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go diff --git a/go.mod b/go.mod index fbd0fec06..6c2b43c99 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,6 @@ require ( k8s.io/code-generator v0.29.0 k8s.io/component-base v0.29.0 k8s.io/klog/v2 v2.110.1 - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 ) @@ -92,17 +91,17 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.14.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect @@ -123,4 +122,5 @@ require ( sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect sigs.k8s.io/controller-runtime v0.14.5 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index 25299cfff..58dc34c9e 100644 --- a/go.sum +++ b/go.sum @@ -293,15 +293,15 @@ go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o= golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -311,8 +311,8 @@ golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -320,8 +320,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -332,17 +332,17 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -353,8 +353,8 @@ golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/cloudprovider/vsphereparavirtual/instances.go b/pkg/cloudprovider/vsphereparavirtual/instances.go index e1f8b997c..7e73f7c3e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances.go @@ -32,12 +32,12 @@ import ( "k8s.io/klog/v2" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" ) type instances struct { - vmClient vmopclient.Interface + vmClient vmop.VmoperatorV1alpha1Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/instances_test.go b/pkg/cloudprovider/vsphereparavirtual/instances_test.go index b32af288a..9de735f84 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances_test.go @@ -30,7 +30,9 @@ import ( "k8s.io/client-go/rest" clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" - fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator/client" + + dynamicfake "k8s.io/client-go/dynamic/fake" ) var ( @@ -87,13 +89,16 @@ func TestNewInstances(t *testing.T) { } } -func initTest(testVM *vmopv1alpha1.VirtualMachine) (*instances, *fakevmclient.Clientset, error) { - fc := fakevmclient.NewSimpleClientset() +func initTest(testVM *vmopv1alpha1.VirtualMachine) (*instances, *dynamicfake.FakeDynamicClient, error) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + fcw := vmopclient.NewFakeClient(fc) instance := &instances{ - vmClient: fc, + vmClient: fcw, namespace: testClusterNameSpace, } - _, err := fc.VmoperatorV1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + _, err := fcw.VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) return instance, fc, err } @@ -160,7 +165,7 @@ func TestInstanceIDThrowsErr(t *testing.T) { instance, fc, err := initTest(testCase.testVM) assert.NoError(t, err) fc.PrependReactor("get", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachine{}, fmt.Errorf("Internal error getting VMs") + return true, nil, fmt.Errorf("Internal error getting VMs") }) instanceID, err := instance.InstanceID(context.Background(), testVMName) assert.NotEqual(t, nil, err) @@ -322,7 +327,7 @@ func TestNodeAddressesByProviderIDInternalErr(t *testing.T) { instance, fc, err := initTest(testCase.testVM) assert.NoError(t, err) fc.PrependReactor("list", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachineList{}, fmt.Errorf("Internal error listing VMs") + return true, nil, fmt.Errorf("Internal error listing VMs") }) ret, err := instance.NodeAddressesByProviderID(context.Background(), testProviderID) assert.NotEqual(t, nil, err) @@ -397,7 +402,7 @@ func TestNodeAddressesInternalErr(t *testing.T) { instance, fc, err := initTest(testCase.testVM) assert.NoError(t, err) fc.PrependReactor("get", "virtualmachines", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachine{}, fmt.Errorf("Internal error getting VMs") + return true, nil, fmt.Errorf("Internal error getting VMs") }) ret, err := instance.NodeAddresses(context.Background(), testVMName) assert.NotEqual(t, nil, err) diff --git a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go index 32fa77c04..1c61d8439 100644 --- a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go @@ -26,15 +26,18 @@ import ( v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + dynamicfake "k8s.io/client-go/dynamic/fake" "k8s.io/client-go/rest" clientgotesting "k8s.io/client-go/testing" cloudprovider "k8s.io/cloud-provider" - fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmservice" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator/client" ) var ( @@ -50,13 +53,14 @@ var ( } ) -func newTestLoadBalancer() (cloudprovider.LoadBalancer, *fakevmclient.Clientset) { - fc := fakevmclient.NewSimpleClientset() +func newTestLoadBalancer() (cloudprovider.LoadBalancer, *vmopclient.FakeClient) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + fcw := vmopclient.NewFakeClient(fc) - vms := vmservice.NewVMService(fc, testClusterNameSpace, &testOwnerReference) - return &loadBalancer{ - vmService: vms, - }, fc + vms := vmservice.NewVMService(fcw, testClusterNameSpace, &testOwnerReference) + return &loadBalancer{vmService: vms}, fcw } func TestNewLoadBalancer(t *testing.T) { @@ -146,7 +150,7 @@ func TestUpdateLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fc := newTestLoadBalancer() + lb, fcw := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -172,8 +176,8 @@ func TestUpdateLoadBalancer(t *testing.T) { if testCase.expectErr { // Ensure that the client Update call returns an error on update - fc.PrependReactor("update", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachineService{}, fmt.Errorf("Some undefined update error") + fcw.DynamicClient.PrependReactor("update", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + return true, nil, fmt.Errorf("Some undefined update error") }) err = lb.UpdateLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.Error(t, err) @@ -186,7 +190,7 @@ func TestUpdateLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { - lb, fc := newTestLoadBalancer() + lb, fcw := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -197,8 +201,8 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { }, } - fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachineService{ + fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + unstructuredObj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(&vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ Ingress: []vmopv1alpha1.LoadBalancerIngress{ @@ -208,7 +212,8 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { }, }, }, - }, nil + }) + return true, &unstructured.Unstructured{Object: unstructuredObj}, nil }) _, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) @@ -242,14 +247,14 @@ func TestEnsureLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fc := newTestLoadBalancer() + lb, fcw := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, Namespace: testK8sServiceNameSpace, }, } - fc.PrependReactor("create", "virtualmachineservices", testCase.createFunc) + fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", testCase.createFunc) _, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.Equal(t, ensureErr.Error(), testCase.expectErr.Error()) @@ -261,7 +266,7 @@ func TestEnsureLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { - lb, fc := newTestLoadBalancer() + lb, fcw := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -269,8 +274,8 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { }, } // Ensure that the client Create call returns a VMService with a valid IP - fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &vmopv1alpha1.VirtualMachineService{ + fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + unstructuredObj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(&vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ Ingress: []vmopv1alpha1.LoadBalancerIngress{ @@ -301,7 +306,9 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { vmservice.NodeSelectorKey: vmservice.NodeRole, }, }, - }, nil + }) + + return true, &unstructured.Unstructured{Object: unstructuredObj}, nil }) status, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) @@ -335,7 +342,7 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fc := newTestLoadBalancer() + lb, fcw := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -347,7 +354,7 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { err := lb.EnsureLoadBalancerDeleted(context.Background(), testClustername, testK8sService) assert.NoError(t, err) - fc.PrependReactor("delete", "virtualmachineservices", testCase.deleteFunc) + fcw.DynamicClient.PrependReactor("delete", "virtualmachineservices", testCase.deleteFunc) err = lb.EnsureLoadBalancerDeleted(context.Background(), "test", testK8sService) if err != nil { diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go deleted file mode 100644 index eb6431c35..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/internal/internal.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package internal - -import ( - "fmt" - "sync" - - typed "sigs.k8s.io/structured-merge-diff/v4/typed" -) - -func Parser() *typed.Parser { - parserOnce.Do(func() { - var err error - parser, err = typed.NewParser(schemaYAML) - if err != nil { - panic(fmt.Sprintf("Failed to parse schema: %v", err)) - } - }) - return parser -} - -var parserOnce sync.Once -var parser *typed.Parser -var schemaYAML = typed.YAMLObject(`types: -- name: __untyped_atomic_ - scalar: untyped - list: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic - map: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic -- name: __untyped_deduced_ - scalar: untyped - list: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic - map: - elementType: - namedType: __untyped_deduced_ - elementRelationship: separable -`) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go deleted file mode 100644 index a557dfba3..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/utils.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package applyconfiguration - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no -// apply configuration type exists for the given GroupVersionKind. -func ForKind(kind schema.GroupVersionKind) interface{} { - switch kind { - // Group=vmoperator.vmware.com, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithKind("ClusterModuleSpec"): - return &vmopv1alpha1.ClusterModuleSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("ClusterModuleStatus"): - return &vmopv1alpha1.ClusterModuleStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("FolderSpec"): - return &vmopv1alpha1.FolderSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("LoadBalancerIngress"): - return &vmopv1alpha1.LoadBalancerIngressApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("LoadBalancerStatus"): - return &vmopv1alpha1.LoadBalancerStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceProviderReference"): - return &vmopv1alpha1.NetworkInterfaceProviderReferenceApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("Probe"): - return &vmopv1alpha1.ProbeApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("ResourcePoolSpec"): - return &vmopv1alpha1.ResourcePoolSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("TCPSocketAction"): - return &vmopv1alpha1.TCPSocketActionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachine"): - return &vmopv1alpha1.VirtualMachineApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineAdvancedOptions"): - return &vmopv1alpha1.VirtualMachineAdvancedOptionsApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClass"): - return &vmopv1alpha1.VirtualMachineClassApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassHardware"): - return &vmopv1alpha1.VirtualMachineClassHardwareApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassPolicies"): - return &vmopv1alpha1.VirtualMachineClassPoliciesApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassResources"): - return &vmopv1alpha1.VirtualMachineClassResourcesApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClassSpec"): - return &vmopv1alpha1.VirtualMachineClassSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineCondition"): - return &vmopv1alpha1.VirtualMachineConditionApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImage"): - return &vmopv1alpha1.VirtualMachineImageApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageOSInfo"): - return &vmopv1alpha1.VirtualMachineImageOSInfoApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageProductInfo"): - return &vmopv1alpha1.VirtualMachineImageProductInfoApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageSpec"): - return &vmopv1alpha1.VirtualMachineImageSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImageStatus"): - return &vmopv1alpha1.VirtualMachineImageStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineMetadata"): - return &vmopv1alpha1.VirtualMachineMetadataApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineNetworkInterface"): - return &vmopv1alpha1.VirtualMachineNetworkInterfaceApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachinePort"): - return &vmopv1alpha1.VirtualMachinePortApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineResourceSpec"): - return &vmopv1alpha1.VirtualMachineResourceSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineService"): - return &vmopv1alpha1.VirtualMachineServiceApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServicePort"): - return &vmopv1alpha1.VirtualMachineServicePortApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServiceSpec"): - return &vmopv1alpha1.VirtualMachineServiceSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineServiceStatus"): - return &vmopv1alpha1.VirtualMachineServiceStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicy"): - return &vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicySpec"): - return &vmopv1alpha1.VirtualMachineSetResourcePolicySpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicyStatus"): - return &vmopv1alpha1.VirtualMachineSetResourcePolicyStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSpec"): - return &vmopv1alpha1.VirtualMachineSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineStatus"): - return &vmopv1alpha1.VirtualMachineStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolume"): - return &vmopv1alpha1.VirtualMachineVolumeApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolumeProvisioningOptions"): - return &vmopv1alpha1.VirtualMachineVolumeProvisioningOptionsApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineVolumeStatus"): - return &vmopv1alpha1.VirtualMachineVolumeStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("VsphereVolumeSource"): - return &vmopv1alpha1.VsphereVolumeSourceApplyConfiguration{} - - } - return nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go deleted file mode 100644 index 05f64e7fd..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulespec.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// ClusterModuleSpecApplyConfiguration represents an declarative configuration of the ClusterModuleSpec type for use -// with apply. -type ClusterModuleSpecApplyConfiguration struct { - GroupName *string `json:"groupname,omitempty"` -} - -// ClusterModuleSpecApplyConfiguration constructs an declarative configuration of the ClusterModuleSpec type for use with -// apply. -func ClusterModuleSpec() *ClusterModuleSpecApplyConfiguration { - return &ClusterModuleSpecApplyConfiguration{} -} - -// WithGroupName sets the GroupName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GroupName field is set to the value of the last call. -func (b *ClusterModuleSpecApplyConfiguration) WithGroupName(value string) *ClusterModuleSpecApplyConfiguration { - b.GroupName = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go deleted file mode 100644 index 50b933943..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/clustermodulestatus.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// ClusterModuleStatusApplyConfiguration represents an declarative configuration of the ClusterModuleStatus type for use -// with apply. -type ClusterModuleStatusApplyConfiguration struct { - GroupName *string `json:"groupname,omitempty"` - ModuleUuid *string `json:"moduleUUID,omitempty"` -} - -// ClusterModuleStatusApplyConfiguration constructs an declarative configuration of the ClusterModuleStatus type for use with -// apply. -func ClusterModuleStatus() *ClusterModuleStatusApplyConfiguration { - return &ClusterModuleStatusApplyConfiguration{} -} - -// WithGroupName sets the GroupName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GroupName field is set to the value of the last call. -func (b *ClusterModuleStatusApplyConfiguration) WithGroupName(value string) *ClusterModuleStatusApplyConfiguration { - b.GroupName = &value - return b -} - -// WithModuleUuid sets the ModuleUuid field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ModuleUuid field is set to the value of the last call. -func (b *ClusterModuleStatusApplyConfiguration) WithModuleUuid(value string) *ClusterModuleStatusApplyConfiguration { - b.ModuleUuid = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go deleted file mode 100644 index 89a5f83df..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/folderspec.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// FolderSpecApplyConfiguration represents an declarative configuration of the FolderSpec type for use -// with apply. -type FolderSpecApplyConfiguration struct { - Name *string `json:"name,omitempty"` -} - -// FolderSpecApplyConfiguration constructs an declarative configuration of the FolderSpec type for use with -// apply. -func FolderSpec() *FolderSpecApplyConfiguration { - return &FolderSpecApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *FolderSpecApplyConfiguration) WithName(value string) *FolderSpecApplyConfiguration { - b.Name = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go deleted file mode 100644 index 5f33a9469..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalanceringress.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// LoadBalancerIngressApplyConfiguration represents an declarative configuration of the LoadBalancerIngress type for use -// with apply. -type LoadBalancerIngressApplyConfiguration struct { - IP *string `json:"ip,omitempty"` - Hostname *string `json:"hostname,omitempty"` -} - -// LoadBalancerIngressApplyConfiguration constructs an declarative configuration of the LoadBalancerIngress type for use with -// apply. -func LoadBalancerIngress() *LoadBalancerIngressApplyConfiguration { - return &LoadBalancerIngressApplyConfiguration{} -} - -// WithIP sets the IP field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the IP field is set to the value of the last call. -func (b *LoadBalancerIngressApplyConfiguration) WithIP(value string) *LoadBalancerIngressApplyConfiguration { - b.IP = &value - return b -} - -// WithHostname sets the Hostname field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Hostname field is set to the value of the last call. -func (b *LoadBalancerIngressApplyConfiguration) WithHostname(value string) *LoadBalancerIngressApplyConfiguration { - b.Hostname = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go deleted file mode 100644 index d2d6ae4c6..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/loadbalancerstatus.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// LoadBalancerStatusApplyConfiguration represents an declarative configuration of the LoadBalancerStatus type for use -// with apply. -type LoadBalancerStatusApplyConfiguration struct { - Ingress []LoadBalancerIngressApplyConfiguration `json:"ingress,omitempty"` -} - -// LoadBalancerStatusApplyConfiguration constructs an declarative configuration of the LoadBalancerStatus type for use with -// apply. -func LoadBalancerStatus() *LoadBalancerStatusApplyConfiguration { - return &LoadBalancerStatusApplyConfiguration{} -} - -// WithIngress adds the given value to the Ingress field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Ingress field. -func (b *LoadBalancerStatusApplyConfiguration) WithIngress(values ...*LoadBalancerIngressApplyConfiguration) *LoadBalancerStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithIngress") - } - b.Ingress = append(b.Ingress, *values[i]) - } - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go deleted file mode 100644 index 18187b26c..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/networkinterfaceproviderreference.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// NetworkInterfaceProviderReferenceApplyConfiguration represents an declarative configuration of the NetworkInterfaceProviderReference type for use -// with apply. -type NetworkInterfaceProviderReferenceApplyConfiguration struct { - APIGroup *string `json:"apiGroup,omitempty"` - Kind *string `json:"kind,omitempty"` - Name *string `json:"name,omitempty"` - APIVersion *string `json:"apiVersion,omitempty"` -} - -// NetworkInterfaceProviderReferenceApplyConfiguration constructs an declarative configuration of the NetworkInterfaceProviderReference type for use with -// apply. -func NetworkInterfaceProviderReference() *NetworkInterfaceProviderReferenceApplyConfiguration { - return &NetworkInterfaceProviderReferenceApplyConfiguration{} -} - -// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIGroup field is set to the value of the last call. -func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithAPIGroup(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { - b.APIGroup = &value - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithKind(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { - b.Kind = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithName(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { - b.Name = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *NetworkInterfaceProviderReferenceApplyConfiguration) WithAPIVersion(value string) *NetworkInterfaceProviderReferenceApplyConfiguration { - b.APIVersion = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go deleted file mode 100644 index e27555a53..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/probe.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// ProbeApplyConfiguration represents an declarative configuration of the Probe type for use -// with apply. -type ProbeApplyConfiguration struct { - TCPSocket *TCPSocketActionApplyConfiguration `json:"tcpSocket,omitempty"` - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - PeriodSeconds *int32 `json:"periodSeconds,omitempty"` -} - -// ProbeApplyConfiguration constructs an declarative configuration of the Probe type for use with -// apply. -func Probe() *ProbeApplyConfiguration { - return &ProbeApplyConfiguration{} -} - -// WithTCPSocket sets the TCPSocket field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TCPSocket field is set to the value of the last call. -func (b *ProbeApplyConfiguration) WithTCPSocket(value *TCPSocketActionApplyConfiguration) *ProbeApplyConfiguration { - b.TCPSocket = value - return b -} - -// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TimeoutSeconds field is set to the value of the last call. -func (b *ProbeApplyConfiguration) WithTimeoutSeconds(value int32) *ProbeApplyConfiguration { - b.TimeoutSeconds = &value - return b -} - -// WithPeriodSeconds sets the PeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PeriodSeconds field is set to the value of the last call. -func (b *ProbeApplyConfiguration) WithPeriodSeconds(value int32) *ProbeApplyConfiguration { - b.PeriodSeconds = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go deleted file mode 100644 index 2aad5744d..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/resourcepoolspec.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// ResourcePoolSpecApplyConfiguration represents an declarative configuration of the ResourcePoolSpec type for use -// with apply. -type ResourcePoolSpecApplyConfiguration struct { - Name *string `json:"name,omitempty"` - Reservations *VirtualMachineResourceSpecApplyConfiguration `json:"reservations,omitempty"` - Limits *VirtualMachineResourceSpecApplyConfiguration `json:"limits,omitempty"` -} - -// ResourcePoolSpecApplyConfiguration constructs an declarative configuration of the ResourcePoolSpec type for use with -// apply. -func ResourcePoolSpec() *ResourcePoolSpecApplyConfiguration { - return &ResourcePoolSpecApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ResourcePoolSpecApplyConfiguration) WithName(value string) *ResourcePoolSpecApplyConfiguration { - b.Name = &value - return b -} - -// WithReservations sets the Reservations field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reservations field is set to the value of the last call. -func (b *ResourcePoolSpecApplyConfiguration) WithReservations(value *VirtualMachineResourceSpecApplyConfiguration) *ResourcePoolSpecApplyConfiguration { - b.Reservations = value - return b -} - -// WithLimits sets the Limits field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Limits field is set to the value of the last call. -func (b *ResourcePoolSpecApplyConfiguration) WithLimits(value *VirtualMachineResourceSpecApplyConfiguration) *ResourcePoolSpecApplyConfiguration { - b.Limits = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go deleted file mode 100644 index f755c5846..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/tcpsocketaction.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - intstr "k8s.io/apimachinery/pkg/util/intstr" -) - -// TCPSocketActionApplyConfiguration represents an declarative configuration of the TCPSocketAction type for use -// with apply. -type TCPSocketActionApplyConfiguration struct { - Port *intstr.IntOrString `json:"port,omitempty"` - Host *string `json:"host,omitempty"` -} - -// TCPSocketActionApplyConfiguration constructs an declarative configuration of the TCPSocketAction type for use with -// apply. -func TCPSocketAction() *TCPSocketActionApplyConfiguration { - return &TCPSocketActionApplyConfiguration{} -} - -// WithPort sets the Port field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Port field is set to the value of the last call. -func (b *TCPSocketActionApplyConfiguration) WithPort(value intstr.IntOrString) *TCPSocketActionApplyConfiguration { - b.Port = &value - return b -} - -// WithHost sets the Host field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Host field is set to the value of the last call. -func (b *TCPSocketActionApplyConfiguration) WithHost(value string) *TCPSocketActionApplyConfiguration { - b.Host = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go deleted file mode 100644 index 96358cbd5..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachine.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// VirtualMachineApplyConfiguration represents an declarative configuration of the VirtualMachine type for use -// with apply. -type VirtualMachineApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *VirtualMachineSpecApplyConfiguration `json:"spec,omitempty"` - Status *VirtualMachineStatusApplyConfiguration `json:"status,omitempty"` -} - -// VirtualMachine constructs an declarative configuration of the VirtualMachine type for use with -// apply. -func VirtualMachine(name, namespace string) *VirtualMachineApplyConfiguration { - b := &VirtualMachineApplyConfiguration{} - b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("VirtualMachine") - b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithKind(value string) *VirtualMachineApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithAPIVersion(value string) *VirtualMachineApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithName(value string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithGenerateName(value string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithNamespace(value string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithUID(value types.UID) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithResourceVersion(value string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithGeneration(value int64) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *VirtualMachineApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *VirtualMachineApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *VirtualMachineApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *VirtualMachineApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *VirtualMachineApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithSpec(value *VirtualMachineSpecApplyConfiguration) *VirtualMachineApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineApplyConfiguration) WithStatus(value *VirtualMachineStatusApplyConfiguration) *VirtualMachineApplyConfiguration { - b.Status = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go deleted file mode 100644 index 32e435a95..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineadvancedoptions.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineAdvancedOptionsApplyConfiguration represents an declarative configuration of the VirtualMachineAdvancedOptions type for use -// with apply. -type VirtualMachineAdvancedOptionsApplyConfiguration struct { - DefaultVolumeProvisioningOptions *VirtualMachineVolumeProvisioningOptionsApplyConfiguration `json:"defaultVolumeProvisioningOptions,omitempty"` - ChangeBlockTracking *bool `json:"changeBlockTracking,omitempty"` -} - -// VirtualMachineAdvancedOptionsApplyConfiguration constructs an declarative configuration of the VirtualMachineAdvancedOptions type for use with -// apply. -func VirtualMachineAdvancedOptions() *VirtualMachineAdvancedOptionsApplyConfiguration { - return &VirtualMachineAdvancedOptionsApplyConfiguration{} -} - -// WithDefaultVolumeProvisioningOptions sets the DefaultVolumeProvisioningOptions field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DefaultVolumeProvisioningOptions field is set to the value of the last call. -func (b *VirtualMachineAdvancedOptionsApplyConfiguration) WithDefaultVolumeProvisioningOptions(value *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) *VirtualMachineAdvancedOptionsApplyConfiguration { - b.DefaultVolumeProvisioningOptions = value - return b -} - -// WithChangeBlockTracking sets the ChangeBlockTracking field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ChangeBlockTracking field is set to the value of the last call. -func (b *VirtualMachineAdvancedOptionsApplyConfiguration) WithChangeBlockTracking(value bool) *VirtualMachineAdvancedOptionsApplyConfiguration { - b.ChangeBlockTracking = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go deleted file mode 100644 index 896559c62..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclass.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// VirtualMachineClassApplyConfiguration represents an declarative configuration of the VirtualMachineClass type for use -// with apply. -type VirtualMachineClassApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *VirtualMachineClassSpecApplyConfiguration `json:"spec,omitempty"` - Status *vmopv1alpha1.VirtualMachineClassStatus `json:"status,omitempty"` -} - -// VirtualMachineClass constructs an declarative configuration of the VirtualMachineClass type for use with -// apply. -func VirtualMachineClass(name string) *VirtualMachineClassApplyConfiguration { - b := &VirtualMachineClassApplyConfiguration{} - b.WithName(name) - b.WithKind("VirtualMachineClass") - b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithKind(value string) *VirtualMachineClassApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithAPIVersion(value string) *VirtualMachineClassApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithName(value string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithGenerateName(value string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithNamespace(value string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithUID(value types.UID) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithResourceVersion(value string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithGeneration(value int64) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *VirtualMachineClassApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *VirtualMachineClassApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *VirtualMachineClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *VirtualMachineClassApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineClassApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *VirtualMachineClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithSpec(value *VirtualMachineClassSpecApplyConfiguration) *VirtualMachineClassApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineClassApplyConfiguration) WithStatus(value vmopv1alpha1.VirtualMachineClassStatus) *VirtualMachineClassApplyConfiguration { - b.Status = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go deleted file mode 100644 index dd6a6191f..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasshardware.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// VirtualMachineClassHardwareApplyConfiguration represents an declarative configuration of the VirtualMachineClassHardware type for use -// with apply. -type VirtualMachineClassHardwareApplyConfiguration struct { - Cpus *int64 `json:"cpus,omitempty"` - Memory *resource.Quantity `json:"memory,omitempty"` -} - -// VirtualMachineClassHardwareApplyConfiguration constructs an declarative configuration of the VirtualMachineClassHardware type for use with -// apply. -func VirtualMachineClassHardware() *VirtualMachineClassHardwareApplyConfiguration { - return &VirtualMachineClassHardwareApplyConfiguration{} -} - -// WithCpus sets the Cpus field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Cpus field is set to the value of the last call. -func (b *VirtualMachineClassHardwareApplyConfiguration) WithCpus(value int64) *VirtualMachineClassHardwareApplyConfiguration { - b.Cpus = &value - return b -} - -// WithMemory sets the Memory field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Memory field is set to the value of the last call. -func (b *VirtualMachineClassHardwareApplyConfiguration) WithMemory(value resource.Quantity) *VirtualMachineClassHardwareApplyConfiguration { - b.Memory = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go deleted file mode 100644 index afaf29102..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclasspolicies.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineClassPoliciesApplyConfiguration represents an declarative configuration of the VirtualMachineClassPolicies type for use -// with apply. -type VirtualMachineClassPoliciesApplyConfiguration struct { - Resources *VirtualMachineClassResourcesApplyConfiguration `json:"resources,omitempty"` -} - -// VirtualMachineClassPoliciesApplyConfiguration constructs an declarative configuration of the VirtualMachineClassPolicies type for use with -// apply. -func VirtualMachineClassPolicies() *VirtualMachineClassPoliciesApplyConfiguration { - return &VirtualMachineClassPoliciesApplyConfiguration{} -} - -// WithResources sets the Resources field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resources field is set to the value of the last call. -func (b *VirtualMachineClassPoliciesApplyConfiguration) WithResources(value *VirtualMachineClassResourcesApplyConfiguration) *VirtualMachineClassPoliciesApplyConfiguration { - b.Resources = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go deleted file mode 100644 index 0dcfb39e4..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassresources.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineClassResourcesApplyConfiguration represents an declarative configuration of the VirtualMachineClassResources type for use -// with apply. -type VirtualMachineClassResourcesApplyConfiguration struct { - Requests *VirtualMachineResourceSpecApplyConfiguration `json:"requests,omitempty"` - Limits *VirtualMachineResourceSpecApplyConfiguration `json:"limits,omitempty"` -} - -// VirtualMachineClassResourcesApplyConfiguration constructs an declarative configuration of the VirtualMachineClassResources type for use with -// apply. -func VirtualMachineClassResources() *VirtualMachineClassResourcesApplyConfiguration { - return &VirtualMachineClassResourcesApplyConfiguration{} -} - -// WithRequests sets the Requests field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Requests field is set to the value of the last call. -func (b *VirtualMachineClassResourcesApplyConfiguration) WithRequests(value *VirtualMachineResourceSpecApplyConfiguration) *VirtualMachineClassResourcesApplyConfiguration { - b.Requests = value - return b -} - -// WithLimits sets the Limits field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Limits field is set to the value of the last call. -func (b *VirtualMachineClassResourcesApplyConfiguration) WithLimits(value *VirtualMachineResourceSpecApplyConfiguration) *VirtualMachineClassResourcesApplyConfiguration { - b.Limits = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go deleted file mode 100644 index c66b0b9f7..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineclassspec.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineClassSpecApplyConfiguration represents an declarative configuration of the VirtualMachineClassSpec type for use -// with apply. -type VirtualMachineClassSpecApplyConfiguration struct { - Hardware *VirtualMachineClassHardwareApplyConfiguration `json:"hardware,omitempty"` - Policies *VirtualMachineClassPoliciesApplyConfiguration `json:"policies,omitempty"` -} - -// VirtualMachineClassSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineClassSpec type for use with -// apply. -func VirtualMachineClassSpec() *VirtualMachineClassSpecApplyConfiguration { - return &VirtualMachineClassSpecApplyConfiguration{} -} - -// WithHardware sets the Hardware field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Hardware field is set to the value of the last call. -func (b *VirtualMachineClassSpecApplyConfiguration) WithHardware(value *VirtualMachineClassHardwareApplyConfiguration) *VirtualMachineClassSpecApplyConfiguration { - b.Hardware = value - return b -} - -// WithPolicies sets the Policies field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Policies field is set to the value of the last call. -func (b *VirtualMachineClassSpecApplyConfiguration) WithPolicies(value *VirtualMachineClassPoliciesApplyConfiguration) *VirtualMachineClassSpecApplyConfiguration { - b.Policies = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go deleted file mode 100644 index 344ae2ae1..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinecondition.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// VirtualMachineConditionApplyConfiguration represents an declarative configuration of the VirtualMachineCondition type for use -// with apply. -type VirtualMachineConditionApplyConfiguration struct { - Type *v1alpha1.VirtualMachineConditionType `json:"type,omitempty"` - Status *v1.ConditionStatus `json:"status,omitempty"` - LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// VirtualMachineConditionApplyConfiguration constructs an declarative configuration of the VirtualMachineCondition type for use with -// apply. -func VirtualMachineCondition() *VirtualMachineConditionApplyConfiguration { - return &VirtualMachineConditionApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *VirtualMachineConditionApplyConfiguration) WithType(value v1alpha1.VirtualMachineConditionType) *VirtualMachineConditionApplyConfiguration { - b.Type = &value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *VirtualMachineConditionApplyConfiguration { - b.Status = &value - return b -} - -// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastTransitionTime field is set to the value of the last call. -func (b *VirtualMachineConditionApplyConfiguration) WithLastTransitionTime(value v1.Time) *VirtualMachineConditionApplyConfiguration { - b.LastTransitionTime = &value - return b -} - -// WithReason sets the Reason field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reason field is set to the value of the last call. -func (b *VirtualMachineConditionApplyConfiguration) WithReason(value string) *VirtualMachineConditionApplyConfiguration { - b.Reason = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *VirtualMachineConditionApplyConfiguration) WithMessage(value string) *VirtualMachineConditionApplyConfiguration { - b.Message = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go deleted file mode 100644 index fc15d9bb8..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimage.go +++ /dev/null @@ -1,218 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// VirtualMachineImageApplyConfiguration represents an declarative configuration of the VirtualMachineImage type for use -// with apply. -type VirtualMachineImageApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *VirtualMachineImageSpecApplyConfiguration `json:"spec,omitempty"` - Status *VirtualMachineImageStatusApplyConfiguration `json:"status,omitempty"` -} - -// VirtualMachineImage constructs an declarative configuration of the VirtualMachineImage type for use with -// apply. -func VirtualMachineImage(name string) *VirtualMachineImageApplyConfiguration { - b := &VirtualMachineImageApplyConfiguration{} - b.WithName(name) - b.WithKind("VirtualMachineImage") - b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithKind(value string) *VirtualMachineImageApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithAPIVersion(value string) *VirtualMachineImageApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithName(value string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithGenerateName(value string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithNamespace(value string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithUID(value types.UID) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithResourceVersion(value string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithGeneration(value int64) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *VirtualMachineImageApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *VirtualMachineImageApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *VirtualMachineImageApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *VirtualMachineImageApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineImageApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *VirtualMachineImageApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithSpec(value *VirtualMachineImageSpecApplyConfiguration) *VirtualMachineImageApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineImageApplyConfiguration) WithStatus(value *VirtualMachineImageStatusApplyConfiguration) *VirtualMachineImageApplyConfiguration { - b.Status = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go deleted file mode 100644 index ee3214ee0..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageosinfo.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineImageOSInfoApplyConfiguration represents an declarative configuration of the VirtualMachineImageOSInfo type for use -// with apply. -type VirtualMachineImageOSInfoApplyConfiguration struct { - Version *string `json:"version,omitempty"` - Type *string `json:"type,omitempty"` -} - -// VirtualMachineImageOSInfoApplyConfiguration constructs an declarative configuration of the VirtualMachineImageOSInfo type for use with -// apply. -func VirtualMachineImageOSInfo() *VirtualMachineImageOSInfoApplyConfiguration { - return &VirtualMachineImageOSInfoApplyConfiguration{} -} - -// WithVersion sets the Version field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Version field is set to the value of the last call. -func (b *VirtualMachineImageOSInfoApplyConfiguration) WithVersion(value string) *VirtualMachineImageOSInfoApplyConfiguration { - b.Version = &value - return b -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *VirtualMachineImageOSInfoApplyConfiguration) WithType(value string) *VirtualMachineImageOSInfoApplyConfiguration { - b.Type = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go deleted file mode 100644 index 23097beb3..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimageproductinfo.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineImageProductInfoApplyConfiguration represents an declarative configuration of the VirtualMachineImageProductInfo type for use -// with apply. -type VirtualMachineImageProductInfoApplyConfiguration struct { - Product *string `json:"product,omitempty"` - Vendor *string `json:"vendor,omitempty"` - Version *string `json:"version,omitempty"` - FullVersion *string `json:"fullVersion,omitempty"` -} - -// VirtualMachineImageProductInfoApplyConfiguration constructs an declarative configuration of the VirtualMachineImageProductInfo type for use with -// apply. -func VirtualMachineImageProductInfo() *VirtualMachineImageProductInfoApplyConfiguration { - return &VirtualMachineImageProductInfoApplyConfiguration{} -} - -// WithProduct sets the Product field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Product field is set to the value of the last call. -func (b *VirtualMachineImageProductInfoApplyConfiguration) WithProduct(value string) *VirtualMachineImageProductInfoApplyConfiguration { - b.Product = &value - return b -} - -// WithVendor sets the Vendor field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Vendor field is set to the value of the last call. -func (b *VirtualMachineImageProductInfoApplyConfiguration) WithVendor(value string) *VirtualMachineImageProductInfoApplyConfiguration { - b.Vendor = &value - return b -} - -// WithVersion sets the Version field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Version field is set to the value of the last call. -func (b *VirtualMachineImageProductInfoApplyConfiguration) WithVersion(value string) *VirtualMachineImageProductInfoApplyConfiguration { - b.Version = &value - return b -} - -// WithFullVersion sets the FullVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the FullVersion field is set to the value of the last call. -func (b *VirtualMachineImageProductInfoApplyConfiguration) WithFullVersion(value string) *VirtualMachineImageProductInfoApplyConfiguration { - b.FullVersion = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go deleted file mode 100644 index cc3ec6a11..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagespec.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineImageSpecApplyConfiguration represents an declarative configuration of the VirtualMachineImageSpec type for use -// with apply. -type VirtualMachineImageSpecApplyConfiguration struct { - Type *string `json:"type,omitempty"` - ImageSourceType *string `json:"imageSourceType,omitempty"` - ProductInfo *VirtualMachineImageProductInfoApplyConfiguration `json:"productInfo,omitempty"` - OSInfo *VirtualMachineImageOSInfoApplyConfiguration `json:"osInfo,omitempty"` -} - -// VirtualMachineImageSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineImageSpec type for use with -// apply. -func VirtualMachineImageSpec() *VirtualMachineImageSpecApplyConfiguration { - return &VirtualMachineImageSpecApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *VirtualMachineImageSpecApplyConfiguration) WithType(value string) *VirtualMachineImageSpecApplyConfiguration { - b.Type = &value - return b -} - -// WithImageSourceType sets the ImageSourceType field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ImageSourceType field is set to the value of the last call. -func (b *VirtualMachineImageSpecApplyConfiguration) WithImageSourceType(value string) *VirtualMachineImageSpecApplyConfiguration { - b.ImageSourceType = &value - return b -} - -// WithProductInfo sets the ProductInfo field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ProductInfo field is set to the value of the last call. -func (b *VirtualMachineImageSpecApplyConfiguration) WithProductInfo(value *VirtualMachineImageProductInfoApplyConfiguration) *VirtualMachineImageSpecApplyConfiguration { - b.ProductInfo = value - return b -} - -// WithOSInfo sets the OSInfo field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the OSInfo field is set to the value of the last call. -func (b *VirtualMachineImageSpecApplyConfiguration) WithOSInfo(value *VirtualMachineImageOSInfoApplyConfiguration) *VirtualMachineImageSpecApplyConfiguration { - b.OSInfo = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go deleted file mode 100644 index a0c16cb76..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineimagestatus.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineImageStatusApplyConfiguration represents an declarative configuration of the VirtualMachineImageStatus type for use -// with apply. -type VirtualMachineImageStatusApplyConfiguration struct { - Uuid *string `json:"uuid,omitempty"` - InternalId *string `json:"internalId,omitempty"` - PowerState *string `json:"powerState,omitempty"` - GuestOSCustomizable *bool `json:"guestOsCustomizable,omitempty"` -} - -// VirtualMachineImageStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineImageStatus type for use with -// apply. -func VirtualMachineImageStatus() *VirtualMachineImageStatusApplyConfiguration { - return &VirtualMachineImageStatusApplyConfiguration{} -} - -// WithUuid sets the Uuid field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Uuid field is set to the value of the last call. -func (b *VirtualMachineImageStatusApplyConfiguration) WithUuid(value string) *VirtualMachineImageStatusApplyConfiguration { - b.Uuid = &value - return b -} - -// WithInternalId sets the InternalId field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the InternalId field is set to the value of the last call. -func (b *VirtualMachineImageStatusApplyConfiguration) WithInternalId(value string) *VirtualMachineImageStatusApplyConfiguration { - b.InternalId = &value - return b -} - -// WithPowerState sets the PowerState field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PowerState field is set to the value of the last call. -func (b *VirtualMachineImageStatusApplyConfiguration) WithPowerState(value string) *VirtualMachineImageStatusApplyConfiguration { - b.PowerState = &value - return b -} - -// WithGuestOSCustomizable sets the GuestOSCustomizable field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GuestOSCustomizable field is set to the value of the last call. -func (b *VirtualMachineImageStatusApplyConfiguration) WithGuestOSCustomizable(value bool) *VirtualMachineImageStatusApplyConfiguration { - b.GuestOSCustomizable = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go deleted file mode 100644 index a61a0daca..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinemetadata.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" -) - -// VirtualMachineMetadataApplyConfiguration represents an declarative configuration of the VirtualMachineMetadata type for use -// with apply. -type VirtualMachineMetadataApplyConfiguration struct { - ConfigMapName *string `json:"configMapName,omitempty"` - Transport *v1alpha1.VirtualMachineMetadataTransport `json:"transport,omitempty"` -} - -// VirtualMachineMetadataApplyConfiguration constructs an declarative configuration of the VirtualMachineMetadata type for use with -// apply. -func VirtualMachineMetadata() *VirtualMachineMetadataApplyConfiguration { - return &VirtualMachineMetadataApplyConfiguration{} -} - -// WithConfigMapName sets the ConfigMapName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ConfigMapName field is set to the value of the last call. -func (b *VirtualMachineMetadataApplyConfiguration) WithConfigMapName(value string) *VirtualMachineMetadataApplyConfiguration { - b.ConfigMapName = &value - return b -} - -// WithTransport sets the Transport field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Transport field is set to the value of the last call. -func (b *VirtualMachineMetadataApplyConfiguration) WithTransport(value v1alpha1.VirtualMachineMetadataTransport) *VirtualMachineMetadataApplyConfiguration { - b.Transport = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go deleted file mode 100644 index 98325e478..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinenetworkinterface.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineNetworkInterfaceApplyConfiguration represents an declarative configuration of the VirtualMachineNetworkInterface type for use -// with apply. -type VirtualMachineNetworkInterfaceApplyConfiguration struct { - NetworkType *string `json:"networkType,omitempty"` - NetworkName *string `json:"networkName,omitempty"` - ProviderRef *NetworkInterfaceProviderReferenceApplyConfiguration `json:"providerRef,omitempty"` - EthernetCardType *string `json:"ethernetCardType,omitempty"` -} - -// VirtualMachineNetworkInterfaceApplyConfiguration constructs an declarative configuration of the VirtualMachineNetworkInterface type for use with -// apply. -func VirtualMachineNetworkInterface() *VirtualMachineNetworkInterfaceApplyConfiguration { - return &VirtualMachineNetworkInterfaceApplyConfiguration{} -} - -// WithNetworkType sets the NetworkType field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the NetworkType field is set to the value of the last call. -func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithNetworkType(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { - b.NetworkType = &value - return b -} - -// WithNetworkName sets the NetworkName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the NetworkName field is set to the value of the last call. -func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithNetworkName(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { - b.NetworkName = &value - return b -} - -// WithProviderRef sets the ProviderRef field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ProviderRef field is set to the value of the last call. -func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithProviderRef(value *NetworkInterfaceProviderReferenceApplyConfiguration) *VirtualMachineNetworkInterfaceApplyConfiguration { - b.ProviderRef = value - return b -} - -// WithEthernetCardType sets the EthernetCardType field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the EthernetCardType field is set to the value of the last call. -func (b *VirtualMachineNetworkInterfaceApplyConfiguration) WithEthernetCardType(value string) *VirtualMachineNetworkInterfaceApplyConfiguration { - b.EthernetCardType = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go deleted file mode 100644 index ea1e78089..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineport.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" -) - -// VirtualMachinePortApplyConfiguration represents an declarative configuration of the VirtualMachinePort type for use -// with apply. -type VirtualMachinePortApplyConfiguration struct { - Port *int `json:"port,omitempty"` - Ip *string `json:"ip,omitempty"` - Name *string `json:"name,omitempty"` - Protocol *v1.Protocol `json:"protocol,omitempty"` -} - -// VirtualMachinePortApplyConfiguration constructs an declarative configuration of the VirtualMachinePort type for use with -// apply. -func VirtualMachinePort() *VirtualMachinePortApplyConfiguration { - return &VirtualMachinePortApplyConfiguration{} -} - -// WithPort sets the Port field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Port field is set to the value of the last call. -func (b *VirtualMachinePortApplyConfiguration) WithPort(value int) *VirtualMachinePortApplyConfiguration { - b.Port = &value - return b -} - -// WithIp sets the Ip field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Ip field is set to the value of the last call. -func (b *VirtualMachinePortApplyConfiguration) WithIp(value string) *VirtualMachinePortApplyConfiguration { - b.Ip = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachinePortApplyConfiguration) WithName(value string) *VirtualMachinePortApplyConfiguration { - b.Name = &value - return b -} - -// WithProtocol sets the Protocol field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Protocol field is set to the value of the last call. -func (b *VirtualMachinePortApplyConfiguration) WithProtocol(value v1.Protocol) *VirtualMachinePortApplyConfiguration { - b.Protocol = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go deleted file mode 100644 index cb9e19ba3..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineresourcespec.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// VirtualMachineResourceSpecApplyConfiguration represents an declarative configuration of the VirtualMachineResourceSpec type for use -// with apply. -type VirtualMachineResourceSpecApplyConfiguration struct { - Cpu *resource.Quantity `json:"cpu,omitempty"` - Memory *resource.Quantity `json:"memory,omitempty"` -} - -// VirtualMachineResourceSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineResourceSpec type for use with -// apply. -func VirtualMachineResourceSpec() *VirtualMachineResourceSpecApplyConfiguration { - return &VirtualMachineResourceSpecApplyConfiguration{} -} - -// WithCpu sets the Cpu field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Cpu field is set to the value of the last call. -func (b *VirtualMachineResourceSpecApplyConfiguration) WithCpu(value resource.Quantity) *VirtualMachineResourceSpecApplyConfiguration { - b.Cpu = &value - return b -} - -// WithMemory sets the Memory field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Memory field is set to the value of the last call. -func (b *VirtualMachineResourceSpecApplyConfiguration) WithMemory(value resource.Quantity) *VirtualMachineResourceSpecApplyConfiguration { - b.Memory = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go deleted file mode 100644 index f1a5cb52e..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservice.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// VirtualMachineServiceApplyConfiguration represents an declarative configuration of the VirtualMachineService type for use -// with apply. -type VirtualMachineServiceApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *VirtualMachineServiceSpecApplyConfiguration `json:"spec,omitempty"` - Status *VirtualMachineServiceStatusApplyConfiguration `json:"status,omitempty"` -} - -// VirtualMachineService constructs an declarative configuration of the VirtualMachineService type for use with -// apply. -func VirtualMachineService(name, namespace string) *VirtualMachineServiceApplyConfiguration { - b := &VirtualMachineServiceApplyConfiguration{} - b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("VirtualMachineService") - b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithKind(value string) *VirtualMachineServiceApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithAPIVersion(value string) *VirtualMachineServiceApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithName(value string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithGenerateName(value string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithNamespace(value string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithUID(value types.UID) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithResourceVersion(value string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithGeneration(value int64) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *VirtualMachineServiceApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *VirtualMachineServiceApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *VirtualMachineServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *VirtualMachineServiceApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineServiceApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *VirtualMachineServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithSpec(value *VirtualMachineServiceSpecApplyConfiguration) *VirtualMachineServiceApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineServiceApplyConfiguration) WithStatus(value *VirtualMachineServiceStatusApplyConfiguration) *VirtualMachineServiceApplyConfiguration { - b.Status = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go deleted file mode 100644 index 6bb05ecd1..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineserviceport.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineServicePortApplyConfiguration represents an declarative configuration of the VirtualMachineServicePort type for use -// with apply. -type VirtualMachineServicePortApplyConfiguration struct { - Name *string `json:"name,omitempty"` - Protocol *string `json:"protocol,omitempty"` - Port *int32 `json:"port,omitempty"` - TargetPort *int32 `json:"targetPort,omitempty"` -} - -// VirtualMachineServicePortApplyConfiguration constructs an declarative configuration of the VirtualMachineServicePort type for use with -// apply. -func VirtualMachineServicePort() *VirtualMachineServicePortApplyConfiguration { - return &VirtualMachineServicePortApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineServicePortApplyConfiguration) WithName(value string) *VirtualMachineServicePortApplyConfiguration { - b.Name = &value - return b -} - -// WithProtocol sets the Protocol field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Protocol field is set to the value of the last call. -func (b *VirtualMachineServicePortApplyConfiguration) WithProtocol(value string) *VirtualMachineServicePortApplyConfiguration { - b.Protocol = &value - return b -} - -// WithPort sets the Port field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Port field is set to the value of the last call. -func (b *VirtualMachineServicePortApplyConfiguration) WithPort(value int32) *VirtualMachineServicePortApplyConfiguration { - b.Port = &value - return b -} - -// WithTargetPort sets the TargetPort field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetPort field is set to the value of the last call. -func (b *VirtualMachineServicePortApplyConfiguration) WithTargetPort(value int32) *VirtualMachineServicePortApplyConfiguration { - b.TargetPort = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go deleted file mode 100644 index f6e690e95..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicespec.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" -) - -// VirtualMachineServiceSpecApplyConfiguration represents an declarative configuration of the VirtualMachineServiceSpec type for use -// with apply. -type VirtualMachineServiceSpecApplyConfiguration struct { - Type *v1alpha1.VirtualMachineServiceType `json:"type,omitempty"` - Ports []VirtualMachineServicePortApplyConfiguration `json:"ports,omitempty"` - Selector map[string]string `json:"selector,omitempty"` - LoadBalancerIP *string `json:"loadBalancerIP,omitempty"` - LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"` - ClusterIP *string `json:"clusterIp,omitempty"` - ExternalName *string `json:"externalName,omitempty"` -} - -// VirtualMachineServiceSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineServiceSpec type for use with -// apply. -func VirtualMachineServiceSpec() *VirtualMachineServiceSpecApplyConfiguration { - return &VirtualMachineServiceSpecApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithType(value v1alpha1.VirtualMachineServiceType) *VirtualMachineServiceSpecApplyConfiguration { - b.Type = &value - return b -} - -// WithPorts adds the given value to the Ports field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Ports field. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithPorts(values ...*VirtualMachineServicePortApplyConfiguration) *VirtualMachineServiceSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithPorts") - } - b.Ports = append(b.Ports, *values[i]) - } - return b -} - -// WithSelector puts the entries into the Selector field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Selector field, -// overwriting an existing map entries in Selector field with the same key. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithSelector(entries map[string]string) *VirtualMachineServiceSpecApplyConfiguration { - if b.Selector == nil && len(entries) > 0 { - b.Selector = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Selector[k] = v - } - return b -} - -// WithLoadBalancerIP sets the LoadBalancerIP field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LoadBalancerIP field is set to the value of the last call. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithLoadBalancerIP(value string) *VirtualMachineServiceSpecApplyConfiguration { - b.LoadBalancerIP = &value - return b -} - -// WithLoadBalancerSourceRanges adds the given value to the LoadBalancerSourceRanges field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the LoadBalancerSourceRanges field. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithLoadBalancerSourceRanges(values ...string) *VirtualMachineServiceSpecApplyConfiguration { - for i := range values { - b.LoadBalancerSourceRanges = append(b.LoadBalancerSourceRanges, values[i]) - } - return b -} - -// WithClusterIP sets the ClusterIP field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ClusterIP field is set to the value of the last call. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithClusterIP(value string) *VirtualMachineServiceSpecApplyConfiguration { - b.ClusterIP = &value - return b -} - -// WithExternalName sets the ExternalName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ExternalName field is set to the value of the last call. -func (b *VirtualMachineServiceSpecApplyConfiguration) WithExternalName(value string) *VirtualMachineServiceSpecApplyConfiguration { - b.ExternalName = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go deleted file mode 100644 index fd56ca568..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachineservicestatus.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineServiceStatusApplyConfiguration represents an declarative configuration of the VirtualMachineServiceStatus type for use -// with apply. -type VirtualMachineServiceStatusApplyConfiguration struct { - LoadBalancer *LoadBalancerStatusApplyConfiguration `json:"loadBalancer,omitempty"` -} - -// VirtualMachineServiceStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineServiceStatus type for use with -// apply. -func VirtualMachineServiceStatus() *VirtualMachineServiceStatusApplyConfiguration { - return &VirtualMachineServiceStatusApplyConfiguration{} -} - -// WithLoadBalancer sets the LoadBalancer field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LoadBalancer field is set to the value of the last call. -func (b *VirtualMachineServiceStatusApplyConfiguration) WithLoadBalancer(value *LoadBalancerStatusApplyConfiguration) *VirtualMachineServiceStatusApplyConfiguration { - b.LoadBalancer = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go deleted file mode 100644 index 70a341a46..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// VirtualMachineSetResourcePolicyApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicy type for use -// with apply. -type VirtualMachineSetResourcePolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *VirtualMachineSetResourcePolicySpecApplyConfiguration `json:"spec,omitempty"` - Status *VirtualMachineSetResourcePolicyStatusApplyConfiguration `json:"status,omitempty"` -} - -// VirtualMachineSetResourcePolicy constructs an declarative configuration of the VirtualMachineSetResourcePolicy type for use with -// apply. -func VirtualMachineSetResourcePolicy(name, namespace string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b := &VirtualMachineSetResourcePolicyApplyConfiguration{} - b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("VirtualMachineSetResourcePolicy") - b.WithAPIVersion("vmoperator.vmware.com/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithKind(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithAPIVersion(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithName(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithGenerateName(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithNamespace(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithUID(value types.UID) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithResourceVersion(value string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithGeneration(value int64) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithLabels(entries map[string]string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithFinalizers(values ...string) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithSpec(value *VirtualMachineSetResourcePolicySpecApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicyApplyConfiguration) WithStatus(value *VirtualMachineSetResourcePolicyStatusApplyConfiguration) *VirtualMachineSetResourcePolicyApplyConfiguration { - b.Status = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go deleted file mode 100644 index b526ddcf1..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicyspec.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineSetResourcePolicySpecApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicySpec type for use -// with apply. -type VirtualMachineSetResourcePolicySpecApplyConfiguration struct { - ResourcePool *ResourcePoolSpecApplyConfiguration `json:"resourcepool,omitempty"` - Folder *FolderSpecApplyConfiguration `json:"folder,omitempty"` - ClusterModules []ClusterModuleSpecApplyConfiguration `json:"clustermodules,omitempty"` -} - -// VirtualMachineSetResourcePolicySpecApplyConfiguration constructs an declarative configuration of the VirtualMachineSetResourcePolicySpec type for use with -// apply. -func VirtualMachineSetResourcePolicySpec() *VirtualMachineSetResourcePolicySpecApplyConfiguration { - return &VirtualMachineSetResourcePolicySpecApplyConfiguration{} -} - -// WithResourcePool sets the ResourcePool field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourcePool field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithResourcePool(value *ResourcePoolSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { - b.ResourcePool = value - return b -} - -// WithFolder sets the Folder field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Folder field is set to the value of the last call. -func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithFolder(value *FolderSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { - b.Folder = value - return b -} - -// WithClusterModules adds the given value to the ClusterModules field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ClusterModules field. -func (b *VirtualMachineSetResourcePolicySpecApplyConfiguration) WithClusterModules(values ...*ClusterModuleSpecApplyConfiguration) *VirtualMachineSetResourcePolicySpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithClusterModules") - } - b.ClusterModules = append(b.ClusterModules, *values[i]) - } - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go deleted file mode 100644 index 82f17e84a..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinesetresourcepolicystatus.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineSetResourcePolicyStatusApplyConfiguration represents an declarative configuration of the VirtualMachineSetResourcePolicyStatus type for use -// with apply. -type VirtualMachineSetResourcePolicyStatusApplyConfiguration struct { - ClusterModules []ClusterModuleStatusApplyConfiguration `json:"clustermodules,omitempty"` -} - -// VirtualMachineSetResourcePolicyStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineSetResourcePolicyStatus type for use with -// apply. -func VirtualMachineSetResourcePolicyStatus() *VirtualMachineSetResourcePolicyStatusApplyConfiguration { - return &VirtualMachineSetResourcePolicyStatusApplyConfiguration{} -} - -// WithClusterModules adds the given value to the ClusterModules field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ClusterModules field. -func (b *VirtualMachineSetResourcePolicyStatusApplyConfiguration) WithClusterModules(values ...*ClusterModuleStatusApplyConfiguration) *VirtualMachineSetResourcePolicyStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithClusterModules") - } - b.ClusterModules = append(b.ClusterModules, *values[i]) - } - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go deleted file mode 100644 index 130c472cc..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinespec.go +++ /dev/null @@ -1,148 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" -) - -// VirtualMachineSpecApplyConfiguration represents an declarative configuration of the VirtualMachineSpec type for use -// with apply. -type VirtualMachineSpecApplyConfiguration struct { - ImageName *string `json:"imageName,omitempty"` - ClassName *string `json:"className,omitempty"` - PowerState *v1alpha1.VirtualMachinePowerState `json:"powerState,omitempty"` - Ports []VirtualMachinePortApplyConfiguration `json:"ports,omitempty"` - VmMetadata *VirtualMachineMetadataApplyConfiguration `json:"vmMetadata,omitempty"` - StorageClass *string `json:"storageClass,omitempty"` - NetworkInterfaces []VirtualMachineNetworkInterfaceApplyConfiguration `json:"networkInterfaces,omitempty"` - ResourcePolicyName *string `json:"resourcePolicyName,omitempty"` - Volumes []VirtualMachineVolumeApplyConfiguration `json:"volumes,omitempty"` - ReadinessProbe *ProbeApplyConfiguration `json:"readinessProbe,omitempty"` - AdvancedOptions *VirtualMachineAdvancedOptionsApplyConfiguration `json:"advancedOptions,omitempty"` -} - -// VirtualMachineSpecApplyConfiguration constructs an declarative configuration of the VirtualMachineSpec type for use with -// apply. -func VirtualMachineSpec() *VirtualMachineSpecApplyConfiguration { - return &VirtualMachineSpecApplyConfiguration{} -} - -// WithImageName sets the ImageName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ImageName field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithImageName(value string) *VirtualMachineSpecApplyConfiguration { - b.ImageName = &value - return b -} - -// WithClassName sets the ClassName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ClassName field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithClassName(value string) *VirtualMachineSpecApplyConfiguration { - b.ClassName = &value - return b -} - -// WithPowerState sets the PowerState field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PowerState field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithPowerState(value v1alpha1.VirtualMachinePowerState) *VirtualMachineSpecApplyConfiguration { - b.PowerState = &value - return b -} - -// WithPorts adds the given value to the Ports field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Ports field. -func (b *VirtualMachineSpecApplyConfiguration) WithPorts(values ...*VirtualMachinePortApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithPorts") - } - b.Ports = append(b.Ports, *values[i]) - } - return b -} - -// WithVmMetadata sets the VmMetadata field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the VmMetadata field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithVmMetadata(value *VirtualMachineMetadataApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - b.VmMetadata = value - return b -} - -// WithStorageClass sets the StorageClass field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the StorageClass field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithStorageClass(value string) *VirtualMachineSpecApplyConfiguration { - b.StorageClass = &value - return b -} - -// WithNetworkInterfaces adds the given value to the NetworkInterfaces field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the NetworkInterfaces field. -func (b *VirtualMachineSpecApplyConfiguration) WithNetworkInterfaces(values ...*VirtualMachineNetworkInterfaceApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithNetworkInterfaces") - } - b.NetworkInterfaces = append(b.NetworkInterfaces, *values[i]) - } - return b -} - -// WithResourcePolicyName sets the ResourcePolicyName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourcePolicyName field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithResourcePolicyName(value string) *VirtualMachineSpecApplyConfiguration { - b.ResourcePolicyName = &value - return b -} - -// WithVolumes adds the given value to the Volumes field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Volumes field. -func (b *VirtualMachineSpecApplyConfiguration) WithVolumes(values ...*VirtualMachineVolumeApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithVolumes") - } - b.Volumes = append(b.Volumes, *values[i]) - } - return b -} - -// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ReadinessProbe field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - b.ReadinessProbe = value - return b -} - -// WithAdvancedOptions sets the AdvancedOptions field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AdvancedOptions field is set to the value of the last call. -func (b *VirtualMachineSpecApplyConfiguration) WithAdvancedOptions(value *VirtualMachineAdvancedOptionsApplyConfiguration) *VirtualMachineSpecApplyConfiguration { - b.AdvancedOptions = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go deleted file mode 100644 index 08581951f..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinestatus.go +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" -) - -// VirtualMachineStatusApplyConfiguration represents an declarative configuration of the VirtualMachineStatus type for use -// with apply. -type VirtualMachineStatusApplyConfiguration struct { - Host *string `json:"host,omitempty"` - PowerState *v1alpha1.VirtualMachinePowerState `json:"powerState,omitempty"` - Phase *v1alpha1.VMStatusPhase `json:"phase,omitempty"` - Conditions []VirtualMachineConditionApplyConfiguration `json:"conditions,omitempty"` - VmIp *string `json:"vmIp,omitempty"` - UniqueID *string `json:"uniqueID,omitempty"` - BiosUUID *string `json:"biosUUID,omitempty"` - InstanceUUID *string `json:"instanceUUID,omitempty"` - Volumes []VirtualMachineVolumeStatusApplyConfiguration `json:"volumes,omitempty"` - ChangeBlockTracking *bool `json:"changeBlockTracking,omitempty"` -} - -// VirtualMachineStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineStatus type for use with -// apply. -func VirtualMachineStatus() *VirtualMachineStatusApplyConfiguration { - return &VirtualMachineStatusApplyConfiguration{} -} - -// WithHost sets the Host field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Host field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithHost(value string) *VirtualMachineStatusApplyConfiguration { - b.Host = &value - return b -} - -// WithPowerState sets the PowerState field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PowerState field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithPowerState(value v1alpha1.VirtualMachinePowerState) *VirtualMachineStatusApplyConfiguration { - b.PowerState = &value - return b -} - -// WithPhase sets the Phase field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Phase field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithPhase(value v1alpha1.VMStatusPhase) *VirtualMachineStatusApplyConfiguration { - b.Phase = &value - return b -} - -// WithConditions adds the given value to the Conditions field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *VirtualMachineStatusApplyConfiguration) WithConditions(values ...*VirtualMachineConditionApplyConfiguration) *VirtualMachineStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithConditions") - } - b.Conditions = append(b.Conditions, *values[i]) - } - return b -} - -// WithVmIp sets the VmIp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the VmIp field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithVmIp(value string) *VirtualMachineStatusApplyConfiguration { - b.VmIp = &value - return b -} - -// WithUniqueID sets the UniqueID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UniqueID field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithUniqueID(value string) *VirtualMachineStatusApplyConfiguration { - b.UniqueID = &value - return b -} - -// WithBiosUUID sets the BiosUUID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the BiosUUID field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithBiosUUID(value string) *VirtualMachineStatusApplyConfiguration { - b.BiosUUID = &value - return b -} - -// WithInstanceUUID sets the InstanceUUID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the InstanceUUID field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithInstanceUUID(value string) *VirtualMachineStatusApplyConfiguration { - b.InstanceUUID = &value - return b -} - -// WithVolumes adds the given value to the Volumes field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Volumes field. -func (b *VirtualMachineStatusApplyConfiguration) WithVolumes(values ...*VirtualMachineVolumeStatusApplyConfiguration) *VirtualMachineStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithVolumes") - } - b.Volumes = append(b.Volumes, *values[i]) - } - return b -} - -// WithChangeBlockTracking sets the ChangeBlockTracking field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ChangeBlockTracking field is set to the value of the last call. -func (b *VirtualMachineStatusApplyConfiguration) WithChangeBlockTracking(value bool) *VirtualMachineStatusApplyConfiguration { - b.ChangeBlockTracking = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go deleted file mode 100644 index e27d36415..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolume.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" -) - -// VirtualMachineVolumeApplyConfiguration represents an declarative configuration of the VirtualMachineVolume type for use -// with apply. -type VirtualMachineVolumeApplyConfiguration struct { - Name *string `json:"name,omitempty"` - StoragePolicyID *string `json:"storagePolicyID,omitempty"` - StoragePolicyName *string `json:"storagePolicyName,omitempty"` - PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` - VsphereVolume *VsphereVolumeSourceApplyConfiguration `json:"vSphereVolume,omitempty"` -} - -// VirtualMachineVolumeApplyConfiguration constructs an declarative configuration of the VirtualMachineVolume type for use with -// apply. -func VirtualMachineVolume() *VirtualMachineVolumeApplyConfiguration { - return &VirtualMachineVolumeApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineVolumeApplyConfiguration) WithName(value string) *VirtualMachineVolumeApplyConfiguration { - b.Name = &value - return b -} - -// WithStoragePolicyID sets the StoragePolicyID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the StoragePolicyID field is set to the value of the last call. -func (b *VirtualMachineVolumeApplyConfiguration) WithStoragePolicyID(value string) *VirtualMachineVolumeApplyConfiguration { - b.StoragePolicyID = &value - return b -} - -// WithStoragePolicyName sets the StoragePolicyName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the StoragePolicyName field is set to the value of the last call. -func (b *VirtualMachineVolumeApplyConfiguration) WithStoragePolicyName(value string) *VirtualMachineVolumeApplyConfiguration { - b.StoragePolicyName = &value - return b -} - -// WithPersistentVolumeClaim sets the PersistentVolumeClaim field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PersistentVolumeClaim field is set to the value of the last call. -func (b *VirtualMachineVolumeApplyConfiguration) WithPersistentVolumeClaim(value v1.PersistentVolumeClaimVolumeSource) *VirtualMachineVolumeApplyConfiguration { - b.PersistentVolumeClaim = &value - return b -} - -// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the VsphereVolume field is set to the value of the last call. -func (b *VirtualMachineVolumeApplyConfiguration) WithVsphereVolume(value *VsphereVolumeSourceApplyConfiguration) *VirtualMachineVolumeApplyConfiguration { - b.VsphereVolume = value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go deleted file mode 100644 index d56f9b571..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumeprovisioningoptions.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineVolumeProvisioningOptionsApplyConfiguration represents an declarative configuration of the VirtualMachineVolumeProvisioningOptions type for use -// with apply. -type VirtualMachineVolumeProvisioningOptionsApplyConfiguration struct { - ThinProvisioned *bool `json:"thinProvisioned,omitempty"` - EagerZeroed *bool `json:"eagerZeroed,omitempty"` -} - -// VirtualMachineVolumeProvisioningOptionsApplyConfiguration constructs an declarative configuration of the VirtualMachineVolumeProvisioningOptions type for use with -// apply. -func VirtualMachineVolumeProvisioningOptions() *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { - return &VirtualMachineVolumeProvisioningOptionsApplyConfiguration{} -} - -// WithThinProvisioned sets the ThinProvisioned field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ThinProvisioned field is set to the value of the last call. -func (b *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) WithThinProvisioned(value bool) *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { - b.ThinProvisioned = &value - return b -} - -// WithEagerZeroed sets the EagerZeroed field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the EagerZeroed field is set to the value of the last call. -func (b *VirtualMachineVolumeProvisioningOptionsApplyConfiguration) WithEagerZeroed(value bool) *VirtualMachineVolumeProvisioningOptionsApplyConfiguration { - b.EagerZeroed = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go deleted file mode 100644 index cce7ae174..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/virtualmachinevolumestatus.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineVolumeStatusApplyConfiguration represents an declarative configuration of the VirtualMachineVolumeStatus type for use -// with apply. -type VirtualMachineVolumeStatusApplyConfiguration struct { - Name *string `json:"name,omitempty"` - Attached *bool `json:"attached,omitempty"` - DiskUuid *string `json:"diskUUID,omitempty"` - Error *string `json:"error,omitempty"` -} - -// VirtualMachineVolumeStatusApplyConfiguration constructs an declarative configuration of the VirtualMachineVolumeStatus type for use with -// apply. -func VirtualMachineVolumeStatus() *VirtualMachineVolumeStatusApplyConfiguration { - return &VirtualMachineVolumeStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *VirtualMachineVolumeStatusApplyConfiguration) WithName(value string) *VirtualMachineVolumeStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithAttached sets the Attached field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Attached field is set to the value of the last call. -func (b *VirtualMachineVolumeStatusApplyConfiguration) WithAttached(value bool) *VirtualMachineVolumeStatusApplyConfiguration { - b.Attached = &value - return b -} - -// WithDiskUuid sets the DiskUuid field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DiskUuid field is set to the value of the last call. -func (b *VirtualMachineVolumeStatusApplyConfiguration) WithDiskUuid(value string) *VirtualMachineVolumeStatusApplyConfiguration { - b.DiskUuid = &value - return b -} - -// WithError sets the Error field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Error field is set to the value of the last call. -func (b *VirtualMachineVolumeStatusApplyConfiguration) WithError(value string) *VirtualMachineVolumeStatusApplyConfiguration { - b.Error = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go b/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go deleted file mode 100644 index 2387c8977..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1/vspherevolumesource.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" -) - -// VsphereVolumeSourceApplyConfiguration represents an declarative configuration of the VsphereVolumeSource type for use -// with apply. -type VsphereVolumeSourceApplyConfiguration struct { - Capacity *v1.ResourceList `json:"capacity,omitempty"` - DeviceKey *int `json:"deviceKey,omitempty"` -} - -// VsphereVolumeSourceApplyConfiguration constructs an declarative configuration of the VsphereVolumeSource type for use with -// apply. -func VsphereVolumeSource() *VsphereVolumeSourceApplyConfiguration { - return &VsphereVolumeSourceApplyConfiguration{} -} - -// WithCapacity sets the Capacity field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Capacity field is set to the value of the last call. -func (b *VsphereVolumeSourceApplyConfiguration) WithCapacity(value v1.ResourceList) *VsphereVolumeSourceApplyConfiguration { - b.Capacity = &value - return b -} - -// WithDeviceKey sets the DeviceKey field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeviceKey field is set to the value of the last call. -func (b *VsphereVolumeSourceApplyConfiguration) WithDeviceKey(value int) *VsphereVolumeSourceApplyConfiguration { - b.DeviceKey = &value - return b -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go deleted file mode 100644 index 9ed22ed76..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/clientset.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - "fmt" - "net/http" - - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" - vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface -} - -// Clientset contains the clients for groups. -type Clientset struct { - *discovery.DiscoveryClient - vmoperatorV1alpha1 *vmoperatorv1alpha1.VmoperatorV1alpha1Client -} - -// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client -func (c *Clientset) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { - return c.vmoperatorV1alpha1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.vmoperatorV1alpha1, err = vmoperatorv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.vmoperatorV1alpha1 = vmoperatorv1alpha1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index 9c2ad0903..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" - clientset "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - vmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" - fakevmoperatorv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// VmoperatorV1alpha1 retrieves the VmoperatorV1alpha1Client -func (c *Clientset) VmoperatorV1alpha1() vmoperatorv1alpha1.VmoperatorV1alpha1Interface { - return &fakevmoperatorv1alpha1.FakeVmoperatorV1alpha1{Fake: &c.Fake} -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go deleted file mode 100644 index 4b91eb6a6..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go deleted file mode 100644 index 456b37ed8..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - vmoperatorv1alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go deleted file mode 100644 index 6dc5e6530..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go deleted file mode 100644 index 0efd72eb4..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - vmoperatorv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - vmoperatorv1alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go deleted file mode 100644 index be4e7e92b..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1alpha1 diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go deleted file mode 100644 index 43eec078a..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go deleted file mode 100644 index ca88f1a2b..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachine.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// FakeVirtualMachines implements VirtualMachineInterface -type FakeVirtualMachines struct { - Fake *FakeVmoperatorV1alpha1 - ns string -} - -var virtualmachinesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachines") - -var virtualmachinesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachine") - -// Get takes name of the virtualMachine, and returns the corresponding virtualMachine object, and an error if there is any. -func (c *FakeVirtualMachines) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachine, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualmachinesResource, c.ns, name), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// List takes label and field selectors, and returns the list of VirtualMachines that match those selectors. -func (c *FakeVirtualMachines) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(virtualmachinesResource, virtualmachinesKind, c.ns, opts), &v1alpha1.VirtualMachineList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VirtualMachineList{ListMeta: obj.(*v1alpha1.VirtualMachineList).ListMeta} - for _, item := range obj.(*v1alpha1.VirtualMachineList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested virtualMachines. -func (c *FakeVirtualMachines) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualmachinesResource, c.ns, opts)) - -} - -// Create takes the representation of a virtualMachine and creates it. Returns the server's representation of the virtualMachine, and an error, if there is any. -func (c *FakeVirtualMachines) Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (result *v1alpha1.VirtualMachine, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualmachinesResource, c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// Update takes the representation of a virtualMachine and updates it. Returns the server's representation of the virtualMachine, and an error, if there is any. -func (c *FakeVirtualMachines) Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualmachinesResource, c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualMachines) UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualmachinesResource, "status", c.ns, virtualMachine), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// Delete takes name of the virtualMachine and deletes it. Returns an error if one occurs. -func (c *FakeVirtualMachines) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(virtualmachinesResource, c.ns, name, opts), &v1alpha1.VirtualMachine{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVirtualMachines) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualmachinesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineList{}) - return err -} - -// Patch applies the patch and returns the patched virtualMachine. -func (c *FakeVirtualMachines) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachine. -func (c *FakeVirtualMachines) Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { - if virtualMachine == nil { - return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachine) - if err != nil { - return nil, err - } - name := virtualMachine.Name - if name == nil { - return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeVirtualMachines) ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { - if virtualMachine == nil { - return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachine) - if err != nil { - return nil, err - } - name := virtualMachine.Name - if name == nil { - return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachine{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachine), err -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go deleted file mode 100644 index 23eb14817..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineclass.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// FakeVirtualMachineClasses implements VirtualMachineClassInterface -type FakeVirtualMachineClasses struct { - Fake *FakeVmoperatorV1alpha1 -} - -var virtualmachineclassesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineclasses") - -var virtualmachineclassesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineClass") - -// Get takes name of the virtualMachineClass, and returns the corresponding virtualMachineClass object, and an error if there is any. -func (c *FakeVirtualMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(virtualmachineclassesResource, name), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// List takes label and field selectors, and returns the list of VirtualMachineClasses that match those selectors. -func (c *FakeVirtualMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineClassList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(virtualmachineclassesResource, virtualmachineclassesKind, opts), &v1alpha1.VirtualMachineClassList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VirtualMachineClassList{ListMeta: obj.(*v1alpha1.VirtualMachineClassList).ListMeta} - for _, item := range obj.(*v1alpha1.VirtualMachineClassList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested virtualMachineClasses. -func (c *FakeVirtualMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(virtualmachineclassesResource, opts)) -} - -// Create takes the representation of a virtualMachineClass and creates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. -func (c *FakeVirtualMachineClasses) Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(virtualmachineclassesResource, virtualMachineClass), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// Update takes the representation of a virtualMachineClass and updates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. -func (c *FakeVirtualMachineClasses) Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(virtualmachineclassesResource, virtualMachineClass), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualMachineClasses) UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(virtualmachineclassesResource, "status", virtualMachineClass), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// Delete takes name of the virtualMachineClass and deletes it. Returns an error if one occurs. -func (c *FakeVirtualMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(virtualmachineclassesResource, name, opts), &v1alpha1.VirtualMachineClass{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVirtualMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(virtualmachineclassesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineClassList{}) - return err -} - -// Patch applies the patch and returns the patched virtualMachineClass. -func (c *FakeVirtualMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, name, pt, data, subresources...), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineClass. -func (c *FakeVirtualMachineClasses) Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { - if virtualMachineClass == nil { - return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineClass) - if err != nil { - return nil, err - } - name := virtualMachineClass.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeVirtualMachineClasses) ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { - if virtualMachineClass == nil { - return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineClass) - if err != nil { - return nil, err - } - name := virtualMachineClass.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineclassesResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineClass{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineClass), err -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go deleted file mode 100644 index 02863b1a3..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineimage.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// FakeVirtualMachineImages implements VirtualMachineImageInterface -type FakeVirtualMachineImages struct { - Fake *FakeVmoperatorV1alpha1 -} - -var virtualmachineimagesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineimages") - -var virtualmachineimagesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineImage") - -// Get takes name of the virtualMachineImage, and returns the corresponding virtualMachineImage object, and an error if there is any. -func (c *FakeVirtualMachineImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineImage, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(virtualmachineimagesResource, name), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// List takes label and field selectors, and returns the list of VirtualMachineImages that match those selectors. -func (c *FakeVirtualMachineImages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineImageList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(virtualmachineimagesResource, virtualmachineimagesKind, opts), &v1alpha1.VirtualMachineImageList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VirtualMachineImageList{ListMeta: obj.(*v1alpha1.VirtualMachineImageList).ListMeta} - for _, item := range obj.(*v1alpha1.VirtualMachineImageList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested virtualMachineImages. -func (c *FakeVirtualMachineImages) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(virtualmachineimagesResource, opts)) -} - -// Create takes the representation of a virtualMachineImage and creates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. -func (c *FakeVirtualMachineImages) Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineImage, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(virtualmachineimagesResource, virtualMachineImage), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// Update takes the representation of a virtualMachineImage and updates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. -func (c *FakeVirtualMachineImages) Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(virtualmachineimagesResource, virtualMachineImage), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualMachineImages) UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(virtualmachineimagesResource, "status", virtualMachineImage), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// Delete takes name of the virtualMachineImage and deletes it. Returns an error if one occurs. -func (c *FakeVirtualMachineImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(virtualmachineimagesResource, name, opts), &v1alpha1.VirtualMachineImage{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVirtualMachineImages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(virtualmachineimagesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineImageList{}) - return err -} - -// Patch applies the patch and returns the patched virtualMachineImage. -func (c *FakeVirtualMachineImages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, name, pt, data, subresources...), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineImage. -func (c *FakeVirtualMachineImages) Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { - if virtualMachineImage == nil { - return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineImage) - if err != nil { - return nil, err - } - name := virtualMachineImage.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeVirtualMachineImages) ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { - if virtualMachineImage == nil { - return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineImage) - if err != nil { - return nil, err - } - name := virtualMachineImage.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(virtualmachineimagesResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineImage{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineImage), err -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go deleted file mode 100644 index e519b4504..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachineservice.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// FakeVirtualMachineServices implements VirtualMachineServiceInterface -type FakeVirtualMachineServices struct { - Fake *FakeVmoperatorV1alpha1 - ns string -} - -var virtualmachineservicesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachineservices") - -var virtualmachineservicesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineService") - -// Get takes name of the virtualMachineService, and returns the corresponding virtualMachineService object, and an error if there is any. -func (c *FakeVirtualMachineServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineService, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualmachineservicesResource, c.ns, name), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// List takes label and field selectors, and returns the list of VirtualMachineServices that match those selectors. -func (c *FakeVirtualMachineServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineServiceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(virtualmachineservicesResource, virtualmachineservicesKind, c.ns, opts), &v1alpha1.VirtualMachineServiceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VirtualMachineServiceList{ListMeta: obj.(*v1alpha1.VirtualMachineServiceList).ListMeta} - for _, item := range obj.(*v1alpha1.VirtualMachineServiceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested virtualMachineServices. -func (c *FakeVirtualMachineServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualmachineservicesResource, c.ns, opts)) - -} - -// Create takes the representation of a virtualMachineService and creates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. -func (c *FakeVirtualMachineServices) Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineService, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualmachineservicesResource, c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// Update takes the representation of a virtualMachineService and updates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. -func (c *FakeVirtualMachineServices) Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualmachineservicesResource, c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualMachineServices) UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualmachineservicesResource, "status", c.ns, virtualMachineService), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// Delete takes name of the virtualMachineService and deletes it. Returns an error if one occurs. -func (c *FakeVirtualMachineServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(virtualmachineservicesResource, c.ns, name, opts), &v1alpha1.VirtualMachineService{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVirtualMachineServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualmachineservicesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineServiceList{}) - return err -} - -// Patch applies the patch and returns the patched virtualMachineService. -func (c *FakeVirtualMachineServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineService. -func (c *FakeVirtualMachineServices) Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { - if virtualMachineService == nil { - return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineService) - if err != nil { - return nil, err - } - name := virtualMachineService.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeVirtualMachineServices) ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { - if virtualMachineService == nil { - return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineService) - if err != nil { - return nil, err - } - name := virtualMachineService.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachineservicesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineService), err -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go deleted file mode 100644 index 4ec9ea282..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_virtualmachinesetresourcepolicy.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" -) - -// FakeVirtualMachineSetResourcePolicies implements VirtualMachineSetResourcePolicyInterface -type FakeVirtualMachineSetResourcePolicies struct { - Fake *FakeVmoperatorV1alpha1 - ns string -} - -var virtualmachinesetresourcepoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("virtualmachinesetresourcepolicies") - -var virtualmachinesetresourcepoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("VirtualMachineSetResourcePolicy") - -// Get takes name of the virtualMachineSetResourcePolicy, and returns the corresponding virtualMachineSetResourcePolicy object, and an error if there is any. -func (c *FakeVirtualMachineSetResourcePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualmachinesetresourcepoliciesResource, c.ns, name), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// List takes label and field selectors, and returns the list of VirtualMachineSetResourcePolicies that match those selectors. -func (c *FakeVirtualMachineSetResourcePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineSetResourcePolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(virtualmachinesetresourcepoliciesResource, virtualmachinesetresourcepoliciesKind, c.ns, opts), &v1alpha1.VirtualMachineSetResourcePolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VirtualMachineSetResourcePolicyList{ListMeta: obj.(*v1alpha1.VirtualMachineSetResourcePolicyList).ListMeta} - for _, item := range obj.(*v1alpha1.VirtualMachineSetResourcePolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested virtualMachineSetResourcePolicies. -func (c *FakeVirtualMachineSetResourcePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualmachinesetresourcepoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a virtualMachineSetResourcePolicy and creates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. -func (c *FakeVirtualMachineSetResourcePolicies) Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualmachinesetresourcepoliciesResource, c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// Update takes the representation of a virtualMachineSetResourcePolicy and updates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. -func (c *FakeVirtualMachineSetResourcePolicies) Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualmachinesetresourcepoliciesResource, c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualMachineSetResourcePolicies) UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualmachinesetresourcepoliciesResource, "status", c.ns, virtualMachineSetResourcePolicy), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// Delete takes name of the virtualMachineSetResourcePolicy and deletes it. Returns an error if one occurs. -func (c *FakeVirtualMachineSetResourcePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(virtualmachinesetresourcepoliciesResource, c.ns, name, opts), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVirtualMachineSetResourcePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualmachinesetresourcepoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VirtualMachineSetResourcePolicyList{}) - return err -} - -// Patch applies the patch and returns the patched virtualMachineSetResourcePolicy. -func (c *FakeVirtualMachineSetResourcePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineSetResourcePolicy. -func (c *FakeVirtualMachineSetResourcePolicies) Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - if virtualMachineSetResourcePolicy == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineSetResourcePolicy) - if err != nil { - return nil, err - } - name := virtualMachineSetResourcePolicy.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeVirtualMachineSetResourcePolicies) ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - if virtualMachineSetResourcePolicy == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") - } - data, err := json.Marshal(virtualMachineSetResourcePolicy) - if err != nil { - return nil, err - } - name := virtualMachineSetResourcePolicy.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualmachinesetresourcepoliciesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualMachineSetResourcePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), err -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go deleted file mode 100644 index 50f4bb34a..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/fake/fake_vmop_client.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1" -) - -type FakeVmoperatorV1alpha1 struct { - *testing.Fake -} - -func (c *FakeVmoperatorV1alpha1) VirtualMachines(namespace string) v1alpha1.VirtualMachineInterface { - return &FakeVirtualMachines{c, namespace} -} - -func (c *FakeVmoperatorV1alpha1) VirtualMachineClasses() v1alpha1.VirtualMachineClassInterface { - return &FakeVirtualMachineClasses{c} -} - -func (c *FakeVmoperatorV1alpha1) VirtualMachineImages() v1alpha1.VirtualMachineImageInterface { - return &FakeVirtualMachineImages{c} -} - -func (c *FakeVmoperatorV1alpha1) VirtualMachineServices(namespace string) v1alpha1.VirtualMachineServiceInterface { - return &FakeVirtualMachineServices{c, namespace} -} - -func (c *FakeVmoperatorV1alpha1) VirtualMachineSetResourcePolicies(namespace string) v1alpha1.VirtualMachineSetResourcePolicyInterface { - return &FakeVirtualMachineSetResourcePolicies{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeVmoperatorV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go deleted file mode 100644 index b0e5b1489..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -type VirtualMachineExpansion interface{} - -type VirtualMachineClassExpansion interface{} - -type VirtualMachineImageExpansion interface{} - -type VirtualMachineServiceExpansion interface{} - -type VirtualMachineSetResourcePolicyExpansion interface{} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go deleted file mode 100644 index d3bf04fe4..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachine.go +++ /dev/null @@ -1,256 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" - scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -// VirtualMachinesGetter has a method to return a VirtualMachineInterface. -// A group's client should implement this interface. -type VirtualMachinesGetter interface { - VirtualMachines(namespace string) VirtualMachineInterface -} - -// VirtualMachineInterface has methods to work with VirtualMachine resources. -type VirtualMachineInterface interface { - Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (*v1alpha1.VirtualMachine, error) - Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) - UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (*v1alpha1.VirtualMachine, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachine, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) - Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) - ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) - VirtualMachineExpansion -} - -// virtualMachines implements VirtualMachineInterface -type virtualMachines struct { - client rest.Interface - ns string -} - -// newVirtualMachines returns a VirtualMachines -func newVirtualMachines(c *VmoperatorV1alpha1Client, namespace string) *virtualMachines { - return &virtualMachines{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the virtualMachine, and returns the corresponding virtualMachine object, and an error if there is any. -func (c *virtualMachines) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachine, err error) { - result = &v1alpha1.VirtualMachine{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachines"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualMachines that match those selectors. -func (c *virtualMachines) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VirtualMachineList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachines"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualMachines. -func (c *virtualMachines) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualmachines"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualMachine and creates it. Returns the server's representation of the virtualMachine, and an error, if there is any. -func (c *virtualMachines) Create(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.CreateOptions) (result *v1alpha1.VirtualMachine, err error) { - result = &v1alpha1.VirtualMachine{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualmachines"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachine). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualMachine and updates it. Returns the server's representation of the virtualMachine, and an error, if there is any. -func (c *virtualMachines) Update(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { - result = &v1alpha1.VirtualMachine{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachines"). - Name(virtualMachine.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachine). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualMachines) UpdateStatus(ctx context.Context, virtualMachine *v1alpha1.VirtualMachine, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachine, err error) { - result = &v1alpha1.VirtualMachine{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachines"). - Name(virtualMachine.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachine). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualMachine and deletes it. Returns an error if one occurs. -func (c *virtualMachines) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachines"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualMachines) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachines"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualMachine. -func (c *virtualMachines) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachine, err error) { - result = &v1alpha1.VirtualMachine{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualmachines"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachine. -func (c *virtualMachines) Apply(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { - if virtualMachine == nil { - return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachine) - if err != nil { - return nil, err - } - name := virtualMachine.Name - if name == nil { - return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") - } - result = &v1alpha1.VirtualMachine{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachines"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *virtualMachines) ApplyStatus(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachine, err error) { - if virtualMachine == nil { - return nil, fmt.Errorf("virtualMachine provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachine) - if err != nil { - return nil, err - } - - name := virtualMachine.Name - if name == nil { - return nil, fmt.Errorf("virtualMachine.Name must be provided to Apply") - } - - result = &v1alpha1.VirtualMachine{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachines"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go deleted file mode 100644 index 89df625a4..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineclass.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" - scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -// VirtualMachineClassesGetter has a method to return a VirtualMachineClassInterface. -// A group's client should implement this interface. -type VirtualMachineClassesGetter interface { - VirtualMachineClasses() VirtualMachineClassInterface -} - -// VirtualMachineClassInterface has methods to work with VirtualMachineClass resources. -type VirtualMachineClassInterface interface { - Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (*v1alpha1.VirtualMachineClass, error) - Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) - UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineClass, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineClass, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineClassList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) - Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) - ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) - VirtualMachineClassExpansion -} - -// virtualMachineClasses implements VirtualMachineClassInterface -type virtualMachineClasses struct { - client rest.Interface -} - -// newVirtualMachineClasses returns a VirtualMachineClasses -func newVirtualMachineClasses(c *VmoperatorV1alpha1Client) *virtualMachineClasses { - return &virtualMachineClasses{ - client: c.RESTClient(), - } -} - -// Get takes name of the virtualMachineClass, and returns the corresponding virtualMachineClass object, and an error if there is any. -func (c *virtualMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineClass, err error) { - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Get(). - Resource("virtualmachineclasses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualMachineClasses that match those selectors. -func (c *virtualMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineClassList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VirtualMachineClassList{} - err = c.client.Get(). - Resource("virtualmachineclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualMachineClasses. -func (c *virtualMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("virtualmachineclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualMachineClass and creates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. -func (c *virtualMachineClasses) Create(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineClass, err error) { - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Post(). - Resource("virtualmachineclasses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineClass). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualMachineClass and updates it. Returns the server's representation of the virtualMachineClass, and an error, if there is any. -func (c *virtualMachineClasses) Update(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Put(). - Resource("virtualmachineclasses"). - Name(virtualMachineClass.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineClass). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualMachineClasses) UpdateStatus(ctx context.Context, virtualMachineClass *v1alpha1.VirtualMachineClass, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineClass, err error) { - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Put(). - Resource("virtualmachineclasses"). - Name(virtualMachineClass.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineClass). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualMachineClass and deletes it. Returns an error if one occurs. -func (c *virtualMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("virtualmachineclasses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("virtualmachineclasses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualMachineClass. -func (c *virtualMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineClass, err error) { - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Patch(pt). - Resource("virtualmachineclasses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineClass. -func (c *virtualMachineClasses) Apply(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { - if virtualMachineClass == nil { - return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineClass) - if err != nil { - return nil, err - } - name := virtualMachineClass.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") - } - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("virtualmachineclasses"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *virtualMachineClasses) ApplyStatus(ctx context.Context, virtualMachineClass *vmopv1alpha1.VirtualMachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineClass, err error) { - if virtualMachineClass == nil { - return nil, fmt.Errorf("virtualMachineClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineClass) - if err != nil { - return nil, err - } - - name := virtualMachineClass.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineClass.Name must be provided to Apply") - } - - result = &v1alpha1.VirtualMachineClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("virtualmachineclasses"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go deleted file mode 100644 index d5d03b8f1..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineimage.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" - scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -// VirtualMachineImagesGetter has a method to return a VirtualMachineImageInterface. -// A group's client should implement this interface. -type VirtualMachineImagesGetter interface { - VirtualMachineImages() VirtualMachineImageInterface -} - -// VirtualMachineImageInterface has methods to work with VirtualMachineImage resources. -type VirtualMachineImageInterface interface { - Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (*v1alpha1.VirtualMachineImage, error) - Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) - UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineImage, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineImage, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineImageList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) - Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) - ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) - VirtualMachineImageExpansion -} - -// virtualMachineImages implements VirtualMachineImageInterface -type virtualMachineImages struct { - client rest.Interface -} - -// newVirtualMachineImages returns a VirtualMachineImages -func newVirtualMachineImages(c *VmoperatorV1alpha1Client) *virtualMachineImages { - return &virtualMachineImages{ - client: c.RESTClient(), - } -} - -// Get takes name of the virtualMachineImage, and returns the corresponding virtualMachineImage object, and an error if there is any. -func (c *virtualMachineImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineImage, err error) { - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Get(). - Resource("virtualmachineimages"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualMachineImages that match those selectors. -func (c *virtualMachineImages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineImageList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VirtualMachineImageList{} - err = c.client.Get(). - Resource("virtualmachineimages"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualMachineImages. -func (c *virtualMachineImages) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("virtualmachineimages"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualMachineImage and creates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. -func (c *virtualMachineImages) Create(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineImage, err error) { - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Post(). - Resource("virtualmachineimages"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineImage). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualMachineImage and updates it. Returns the server's representation of the virtualMachineImage, and an error, if there is any. -func (c *virtualMachineImages) Update(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Put(). - Resource("virtualmachineimages"). - Name(virtualMachineImage.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineImage). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualMachineImages) UpdateStatus(ctx context.Context, virtualMachineImage *v1alpha1.VirtualMachineImage, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineImage, err error) { - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Put(). - Resource("virtualmachineimages"). - Name(virtualMachineImage.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineImage). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualMachineImage and deletes it. Returns an error if one occurs. -func (c *virtualMachineImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("virtualmachineimages"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualMachineImages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("virtualmachineimages"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualMachineImage. -func (c *virtualMachineImages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineImage, err error) { - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Patch(pt). - Resource("virtualmachineimages"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineImage. -func (c *virtualMachineImages) Apply(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { - if virtualMachineImage == nil { - return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineImage) - if err != nil { - return nil, err - } - name := virtualMachineImage.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") - } - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Patch(types.ApplyPatchType). - Resource("virtualmachineimages"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *virtualMachineImages) ApplyStatus(ctx context.Context, virtualMachineImage *vmopv1alpha1.VirtualMachineImageApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineImage, err error) { - if virtualMachineImage == nil { - return nil, fmt.Errorf("virtualMachineImage provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineImage) - if err != nil { - return nil, err - } - - name := virtualMachineImage.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineImage.Name must be provided to Apply") - } - - result = &v1alpha1.VirtualMachineImage{} - err = c.client.Patch(types.ApplyPatchType). - Resource("virtualmachineimages"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go deleted file mode 100644 index c7690c2ef..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachineservice.go +++ /dev/null @@ -1,256 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" - scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -// VirtualMachineServicesGetter has a method to return a VirtualMachineServiceInterface. -// A group's client should implement this interface. -type VirtualMachineServicesGetter interface { - VirtualMachineServices(namespace string) VirtualMachineServiceInterface -} - -// VirtualMachineServiceInterface has methods to work with VirtualMachineService resources. -type VirtualMachineServiceInterface interface { - Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (*v1alpha1.VirtualMachineService, error) - Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) - UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineService, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineService, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineServiceList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) - Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) - ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) - VirtualMachineServiceExpansion -} - -// virtualMachineServices implements VirtualMachineServiceInterface -type virtualMachineServices struct { - client rest.Interface - ns string -} - -// newVirtualMachineServices returns a VirtualMachineServices -func newVirtualMachineServices(c *VmoperatorV1alpha1Client, namespace string) *virtualMachineServices { - return &virtualMachineServices{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the virtualMachineService, and returns the corresponding virtualMachineService object, and an error if there is any. -func (c *virtualMachineServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineService, err error) { - result = &v1alpha1.VirtualMachineService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualMachineServices that match those selectors. -func (c *virtualMachineServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VirtualMachineServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachineservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualMachineServices. -func (c *virtualMachineServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualmachineservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualMachineService and creates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. -func (c *virtualMachineServices) Create(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineService, err error) { - result = &v1alpha1.VirtualMachineService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualmachineservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualMachineService and updates it. Returns the server's representation of the virtualMachineService, and an error, if there is any. -func (c *virtualMachineServices) Update(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { - result = &v1alpha1.VirtualMachineService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(virtualMachineService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineService). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualMachineServices) UpdateStatus(ctx context.Context, virtualMachineService *v1alpha1.VirtualMachineService, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineService, err error) { - result = &v1alpha1.VirtualMachineService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(virtualMachineService.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualMachineService and deletes it. Returns an error if one occurs. -func (c *virtualMachineServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualMachineServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachineservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualMachineService. -func (c *virtualMachineServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineService, err error) { - result = &v1alpha1.VirtualMachineService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineService. -func (c *virtualMachineServices) Apply(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { - if virtualMachineService == nil { - return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineService) - if err != nil { - return nil, err - } - name := virtualMachineService.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") - } - result = &v1alpha1.VirtualMachineService{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *virtualMachineServices) ApplyStatus(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineServiceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineService, err error) { - if virtualMachineService == nil { - return nil, fmt.Errorf("virtualMachineService provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineService) - if err != nil { - return nil, err - } - - name := virtualMachineService.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineService.Name must be provided to Apply") - } - - result = &v1alpha1.VirtualMachineService{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachineservices"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go deleted file mode 100644 index 7e54ac1be..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ /dev/null @@ -1,256 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - vmopv1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/applyconfiguration/vmop/v1alpha1" - scheme "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -// VirtualMachineSetResourcePoliciesGetter has a method to return a VirtualMachineSetResourcePolicyInterface. -// A group's client should implement this interface. -type VirtualMachineSetResourcePoliciesGetter interface { - VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyInterface -} - -// VirtualMachineSetResourcePolicyInterface has methods to work with VirtualMachineSetResourcePolicy resources. -type VirtualMachineSetResourcePolicyInterface interface { - Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) - Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) - UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualMachineSetResourcePolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualMachineSetResourcePolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) - Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) - ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) - VirtualMachineSetResourcePolicyExpansion -} - -// virtualMachineSetResourcePolicies implements VirtualMachineSetResourcePolicyInterface -type virtualMachineSetResourcePolicies struct { - client rest.Interface - ns string -} - -// newVirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicies -func newVirtualMachineSetResourcePolicies(c *VmoperatorV1alpha1Client, namespace string) *virtualMachineSetResourcePolicies { - return &virtualMachineSetResourcePolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the virtualMachineSetResourcePolicy, and returns the corresponding virtualMachineSetResourcePolicy object, and an error if there is any. -func (c *virtualMachineSetResourcePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualMachineSetResourcePolicies that match those selectors. -func (c *virtualMachineSetResourcePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualMachineSetResourcePolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VirtualMachineSetResourcePolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualMachineSetResourcePolicies. -func (c *virtualMachineSetResourcePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualMachineSetResourcePolicy and creates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. -func (c *virtualMachineSetResourcePolicies) Create(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.CreateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineSetResourcePolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualMachineSetResourcePolicy and updates it. Returns the server's representation of the virtualMachineSetResourcePolicy, and an error, if there is any. -func (c *virtualMachineSetResourcePolicies) Update(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(virtualMachineSetResourcePolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineSetResourcePolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualMachineSetResourcePolicies) UpdateStatus(ctx context.Context, virtualMachineSetResourcePolicy *v1alpha1.VirtualMachineSetResourcePolicy, opts v1.UpdateOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(virtualMachineSetResourcePolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualMachineSetResourcePolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualMachineSetResourcePolicy and deletes it. Returns an error if one occurs. -func (c *virtualMachineSetResourcePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualMachineSetResourcePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualMachineSetResourcePolicy. -func (c *virtualMachineSetResourcePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied virtualMachineSetResourcePolicy. -func (c *virtualMachineSetResourcePolicies) Apply(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - if virtualMachineSetResourcePolicy == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineSetResourcePolicy) - if err != nil { - return nil, err - } - name := virtualMachineSetResourcePolicy.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") - } - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *virtualMachineSetResourcePolicies) ApplyStatus(ctx context.Context, virtualMachineSetResourcePolicy *vmopv1alpha1.VirtualMachineSetResourcePolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualMachineSetResourcePolicy, err error) { - if virtualMachineSetResourcePolicy == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(virtualMachineSetResourcePolicy) - if err != nil { - return nil, err - } - - name := virtualMachineSetResourcePolicy.Name - if name == nil { - return nil, fmt.Errorf("virtualMachineSetResourcePolicy.Name must be provided to Apply") - } - - result = &v1alpha1.VirtualMachineSetResourcePolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("virtualmachinesetresourcepolicies"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go b/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go deleted file mode 100644 index 1fbf5a3f7..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/typed/vmop/v1alpha1/vmop_client.go +++ /dev/null @@ -1,127 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - rest "k8s.io/client-go/rest" - "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/scheme" -) - -type VmoperatorV1alpha1Interface interface { - RESTClient() rest.Interface - VirtualMachinesGetter - VirtualMachineClassesGetter - VirtualMachineImagesGetter - VirtualMachineServicesGetter - VirtualMachineSetResourcePoliciesGetter -} - -// VmoperatorV1alpha1Client is used to interact with features provided by the vmoperator.vmware.com group. -type VmoperatorV1alpha1Client struct { - restClient rest.Interface -} - -func (c *VmoperatorV1alpha1Client) VirtualMachines(namespace string) VirtualMachineInterface { - return newVirtualMachines(c, namespace) -} - -func (c *VmoperatorV1alpha1Client) VirtualMachineClasses() VirtualMachineClassInterface { - return newVirtualMachineClasses(c) -} - -func (c *VmoperatorV1alpha1Client) VirtualMachineImages() VirtualMachineImageInterface { - return newVirtualMachineImages(c) -} - -func (c *VmoperatorV1alpha1Client) VirtualMachineServices(namespace string) VirtualMachineServiceInterface { - return newVirtualMachineServices(c, namespace) -} - -func (c *VmoperatorV1alpha1Client) VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyInterface { - return newVirtualMachineSetResourcePolicies(c, namespace) -} - -// NewForConfig creates a new VmoperatorV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new VmoperatorV1alpha1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*VmoperatorV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &VmoperatorV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new VmoperatorV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *VmoperatorV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new VmoperatorV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *VmoperatorV1alpha1Client { - return &VmoperatorV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *VmoperatorV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go deleted file mode 100644 index f89f24169..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/factory.go +++ /dev/null @@ -1,261 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory - -type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - transform cache.TransformFunc - - informers map[reflect.Type]cache.SharedIndexInformer - // startedInformers is used for tracking which informers have been started. - // This allows Start() to be called multiple times safely. - startedInformers map[reflect.Type]bool - // wg tracks how many goroutines were started. - wg sync.WaitGroup - // shuttingDown is true when Shutdown has been called. It may still be running - // because it needs to wait for goroutines. - shuttingDown bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - for k, v := range resyncConfig { - factory.customResync[reflect.TypeOf(k)] = v - } - return factory - } -} - -// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. -func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.tweakListOptions = tweakListOptions - return factory - } -} - -// WithNamespace limits the SharedInformerFactory to the specified namespace. -func WithNamespace(namespace string) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.namespace = namespace - return factory - } -} - -// WithTransform sets a transform on all informers. -func WithTransform(transform cache.TransformFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.transform = transform - return factory - } -} - -// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. -func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync) -} - -// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. -// Listers obtained via this SharedInformerFactory will be subject to the same filters -// as specified here. -// Deprecated: Please use NewSharedInformerFactoryWithOptions instead -func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. -func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { - factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - if f.shuttingDown { - return - } - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - f.wg.Add(1) - // We need a new variable in each loop iteration, - // otherwise the goroutine would use the loop variable - // and that keeps changing. - informer := informer - go func() { - defer f.wg.Done() - informer.Run(stopCh) - }() - f.startedInformers[informerType] = true - } - } -} - -func (f *sharedInformerFactory) Shutdown() { - f.lock.Lock() - f.shuttingDown = true - f.lock.Unlock() - - // Will return immediately if there is nothing to wait for. - f.wg.Wait() -} - -func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func() map[reflect.Type]cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res -} - -// InformerFor returns the SharedIndexInformer for obj using an internal -// client. -func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informerType := reflect.TypeOf(obj) - informer, exists := f.informers[informerType] - if exists { - return informer - } - - resyncPeriod, exists := f.customResync[informerType] - if !exists { - resyncPeriod = f.defaultResync - } - - informer = newFunc(f.client, resyncPeriod) - informer.SetTransform(f.transform) - f.informers[informerType] = informer - - return informer -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -// -// It is typically used like this: -// -// ctx, cancel := context.Background() -// defer cancel() -// factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. -// genericInformer := factory.ForResource(resource) -// typedInformer := factory.SomeAPIGroup().V1().SomeType() -// factory.Start(ctx.Done()) // Start processing these informers. -// synced := factory.WaitForCacheSync(ctx.Done()) -// for v, ok := range synced { -// if !ok { -// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) -// return -// } -// } -// -// // Creating informers can also be created after Start, but then -// // Start must be called again: -// anotherGenericInformer := factory.ForResource(resource) -// factory.Start(ctx.Done()) -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - - // Start initializes all requested informers. They are handled in goroutines - // which run until the stop channel gets closed. - Start(stopCh <-chan struct{}) - - // Shutdown marks a factory as shutting down. At that point no new - // informers can be started anymore and Start will return without - // doing anything. - // - // In addition, Shutdown blocks until all goroutines have terminated. For that - // to happen, the close channel(s) that they were started with must be closed, - // either before Shutdown gets called or while it is waiting. - // - // Shutdown may be called multiple times, even concurrently. All such calls will - // block until all goroutines have terminated. - Shutdown() - - // WaitForCacheSync blocks until all started informers' caches were synced - // or the stop channel gets closed. - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - // ForResource gives generic access to a shared informer of the matching type. - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - - // InformerFor returns the SharedIndexInformer for obj using an internal - // client. - InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - - Vmoperator() vmop.Interface -} - -func (f *sharedInformerFactory) Vmoperator() vmop.Interface { - return vmop.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go deleted file mode 100644 index a4b33ab37..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/generic.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=vmoperator.vmware.com, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("virtualmachines"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachines().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineClasses().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineimages"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineImages().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("virtualmachineservices"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineServices().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("virtualmachinesetresourcepolicies"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vmoperator().V1alpha1().VirtualMachineSetResourcePolicies().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index 38baf81e2..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" -) - -// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. -type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -// TweakListOptionsFunc is a function that transforms a v1.ListOptions. -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go deleted file mode 100644 index 3c7c0a15b..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package vmop - -import ( - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go deleted file mode 100644 index c63350753..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/interface.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // VirtualMachines returns a VirtualMachineInformer. - VirtualMachines() VirtualMachineInformer - // VirtualMachineClasses returns a VirtualMachineClassInformer. - VirtualMachineClasses() VirtualMachineClassInformer - // VirtualMachineImages returns a VirtualMachineImageInformer. - VirtualMachineImages() VirtualMachineImageInformer - // VirtualMachineServices returns a VirtualMachineServiceInformer. - VirtualMachineServices() VirtualMachineServiceInformer - // VirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicyInformer. - VirtualMachineSetResourcePolicies() VirtualMachineSetResourcePolicyInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// VirtualMachines returns a VirtualMachineInformer. -func (v *version) VirtualMachines() VirtualMachineInformer { - return &virtualMachineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VirtualMachineClasses returns a VirtualMachineClassInformer. -func (v *version) VirtualMachineClasses() VirtualMachineClassInformer { - return &virtualMachineClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VirtualMachineImages returns a VirtualMachineImageInformer. -func (v *version) VirtualMachineImages() VirtualMachineImageInformer { - return &virtualMachineImageInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VirtualMachineServices returns a VirtualMachineServiceInformer. -func (v *version) VirtualMachineServices() VirtualMachineServiceInformer { - return &virtualMachineServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VirtualMachineSetResourcePolicies returns a VirtualMachineSetResourcePolicyInformer. -func (v *version) VirtualMachineSetResourcePolicies() VirtualMachineSetResourcePolicyInformer { - return &virtualMachineSetResourcePolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go deleted file mode 100644 index d53911942..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachine.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" -) - -// VirtualMachineInformer provides access to a shared informer and lister for -// VirtualMachines. -type VirtualMachineInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VirtualMachineLister -} - -type virtualMachineInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVirtualMachineInformer constructs a new informer for VirtualMachine type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualMachineInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualMachineInformer constructs a new informer for VirtualMachine type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualMachineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachines(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachines(namespace).Watch(context.TODO(), options) - }, - }, - &vmopv1alpha1.VirtualMachine{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualMachineInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualMachineInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualMachineInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vmopv1alpha1.VirtualMachine{}, f.defaultInformer) -} - -func (f *virtualMachineInformer) Lister() v1alpha1.VirtualMachineLister { - return v1alpha1.NewVirtualMachineLister(f.Informer().GetIndexer()) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go deleted file mode 100644 index 4ee0066c5..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineclass.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" -) - -// VirtualMachineClassInformer provides access to a shared informer and lister for -// VirtualMachineClasses. -type VirtualMachineClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VirtualMachineClassLister -} - -type virtualMachineClassInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVirtualMachineClassInformer constructs a new informer for VirtualMachineClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualMachineClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualMachineClassInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualMachineClassInformer constructs a new informer for VirtualMachineClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualMachineClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineClasses().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineClasses().Watch(context.TODO(), options) - }, - }, - &vmopv1alpha1.VirtualMachineClass{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualMachineClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualMachineClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineClass{}, f.defaultInformer) -} - -func (f *virtualMachineClassInformer) Lister() v1alpha1.VirtualMachineClassLister { - return v1alpha1.NewVirtualMachineClassLister(f.Informer().GetIndexer()) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go deleted file mode 100644 index beda0e4fe..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineimage.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" -) - -// VirtualMachineImageInformer provides access to a shared informer and lister for -// VirtualMachineImages. -type VirtualMachineImageInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VirtualMachineImageLister -} - -type virtualMachineImageInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVirtualMachineImageInformer constructs a new informer for VirtualMachineImage type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualMachineImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualMachineImageInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualMachineImageInformer constructs a new informer for VirtualMachineImage type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualMachineImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineImages().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineImages().Watch(context.TODO(), options) - }, - }, - &vmopv1alpha1.VirtualMachineImage{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualMachineImageInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualMachineImageInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualMachineImageInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineImage{}, f.defaultInformer) -} - -func (f *virtualMachineImageInformer) Lister() v1alpha1.VirtualMachineImageLister { - return v1alpha1.NewVirtualMachineImageLister(f.Informer().GetIndexer()) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go deleted file mode 100644 index 4b51ff16e..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachineservice.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" -) - -// VirtualMachineServiceInformer provides access to a shared informer and lister for -// VirtualMachineServices. -type VirtualMachineServiceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VirtualMachineServiceLister -} - -type virtualMachineServiceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVirtualMachineServiceInformer constructs a new informer for VirtualMachineService type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualMachineServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualMachineServiceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualMachineServiceInformer constructs a new informer for VirtualMachineService type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualMachineServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineServices(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineServices(namespace).Watch(context.TODO(), options) - }, - }, - &vmopv1alpha1.VirtualMachineService{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualMachineServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualMachineServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualMachineServiceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineService{}, f.defaultInformer) -} - -func (f *virtualMachineServiceInformer) Lister() v1alpha1.VirtualMachineServiceLister { - return v1alpha1.NewVirtualMachineServiceLister(f.Informer().GetIndexer()) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go deleted file mode 100644 index d564924f1..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" - internalinterfaces "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/informers/externalversions/internalinterfaces" - v1alpha1 "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1" -) - -// VirtualMachineSetResourcePolicyInformer provides access to a shared informer and lister for -// VirtualMachineSetResourcePolicies. -type VirtualMachineSetResourcePolicyInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VirtualMachineSetResourcePolicyLister -} - -type virtualMachineSetResourcePolicyInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVirtualMachineSetResourcePolicyInformer constructs a new informer for VirtualMachineSetResourcePolicy type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualMachineSetResourcePolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualMachineSetResourcePolicyInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualMachineSetResourcePolicyInformer constructs a new informer for VirtualMachineSetResourcePolicy type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualMachineSetResourcePolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineSetResourcePolicies(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VmoperatorV1alpha1().VirtualMachineSetResourcePolicies(namespace).Watch(context.TODO(), options) - }, - }, - &vmopv1alpha1.VirtualMachineSetResourcePolicy{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualMachineSetResourcePolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualMachineSetResourcePolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualMachineSetResourcePolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vmopv1alpha1.VirtualMachineSetResourcePolicy{}, f.defaultInformer) -} - -func (f *virtualMachineSetResourcePolicyInformer) Lister() v1alpha1.VirtualMachineSetResourcePolicyLister { - return v1alpha1.NewVirtualMachineSetResourcePolicyLister(f.Informer().GetIndexer()) -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go deleted file mode 100644 index b688353a7..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -// VirtualMachineListerExpansion allows custom methods to be added to -// VirtualMachineLister. -type VirtualMachineListerExpansion interface{} - -// VirtualMachineNamespaceListerExpansion allows custom methods to be added to -// VirtualMachineNamespaceLister. -type VirtualMachineNamespaceListerExpansion interface{} - -// VirtualMachineClassListerExpansion allows custom methods to be added to -// VirtualMachineClassLister. -type VirtualMachineClassListerExpansion interface{} - -// VirtualMachineImageListerExpansion allows custom methods to be added to -// VirtualMachineImageLister. -type VirtualMachineImageListerExpansion interface{} - -// VirtualMachineServiceListerExpansion allows custom methods to be added to -// VirtualMachineServiceLister. -type VirtualMachineServiceListerExpansion interface{} - -// VirtualMachineServiceNamespaceListerExpansion allows custom methods to be added to -// VirtualMachineServiceNamespaceLister. -type VirtualMachineServiceNamespaceListerExpansion interface{} - -// VirtualMachineSetResourcePolicyListerExpansion allows custom methods to be added to -// VirtualMachineSetResourcePolicyLister. -type VirtualMachineSetResourcePolicyListerExpansion interface{} - -// VirtualMachineSetResourcePolicyNamespaceListerExpansion allows custom methods to be added to -// VirtualMachineSetResourcePolicyNamespaceLister. -type VirtualMachineSetResourcePolicyNamespaceListerExpansion interface{} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go deleted file mode 100644 index ebbed93fc..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachine.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualMachineLister helps list VirtualMachines. -// All objects returned here must be treated as read-only. -type VirtualMachineLister interface { - // List lists all VirtualMachines in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) - // VirtualMachines returns an object that can list and get VirtualMachines. - VirtualMachines(namespace string) VirtualMachineNamespaceLister - VirtualMachineListerExpansion -} - -// virtualMachineLister implements the VirtualMachineLister interface. -type virtualMachineLister struct { - indexer cache.Indexer -} - -// NewVirtualMachineLister returns a new VirtualMachineLister. -func NewVirtualMachineLister(indexer cache.Indexer) VirtualMachineLister { - return &virtualMachineLister{indexer: indexer} -} - -// List lists all VirtualMachines in the indexer. -func (s *virtualMachineLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachine)) - }) - return ret, err -} - -// VirtualMachines returns an object that can list and get VirtualMachines. -func (s *virtualMachineLister) VirtualMachines(namespace string) VirtualMachineNamespaceLister { - return virtualMachineNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VirtualMachineNamespaceLister helps list and get VirtualMachines. -// All objects returned here must be treated as read-only. -type VirtualMachineNamespaceLister interface { - // List lists all VirtualMachines in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) - // Get retrieves the VirtualMachine from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VirtualMachine, error) - VirtualMachineNamespaceListerExpansion -} - -// virtualMachineNamespaceLister implements the VirtualMachineNamespaceLister -// interface. -type virtualMachineNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualMachines in the indexer for a given namespace. -func (s virtualMachineNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachine, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachine)) - }) - return ret, err -} - -// Get retrieves the VirtualMachine from the indexer for a given namespace and name. -func (s virtualMachineNamespaceLister) Get(name string) (*v1alpha1.VirtualMachine, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachine"), name) - } - return obj.(*v1alpha1.VirtualMachine), nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go deleted file mode 100644 index a189482e5..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineclass.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualMachineClassLister helps list VirtualMachineClasses. -// All objects returned here must be treated as read-only. -type VirtualMachineClassLister interface { - // List lists all VirtualMachineClasses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineClass, err error) - // Get retrieves the VirtualMachineClass from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VirtualMachineClass, error) - VirtualMachineClassListerExpansion -} - -// virtualMachineClassLister implements the VirtualMachineClassLister interface. -type virtualMachineClassLister struct { - indexer cache.Indexer -} - -// NewVirtualMachineClassLister returns a new VirtualMachineClassLister. -func NewVirtualMachineClassLister(indexer cache.Indexer) VirtualMachineClassLister { - return &virtualMachineClassLister{indexer: indexer} -} - -// List lists all VirtualMachineClasses in the indexer. -func (s *virtualMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineClass)) - }) - return ret, err -} - -// Get retrieves the VirtualMachineClass from the index for a given name. -func (s *virtualMachineClassLister) Get(name string) (*v1alpha1.VirtualMachineClass, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineclass"), name) - } - return obj.(*v1alpha1.VirtualMachineClass), nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go deleted file mode 100644 index fd1941b99..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineimage.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualMachineImageLister helps list VirtualMachineImages. -// All objects returned here must be treated as read-only. -type VirtualMachineImageLister interface { - // List lists all VirtualMachineImages in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineImage, err error) - // Get retrieves the VirtualMachineImage from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VirtualMachineImage, error) - VirtualMachineImageListerExpansion -} - -// virtualMachineImageLister implements the VirtualMachineImageLister interface. -type virtualMachineImageLister struct { - indexer cache.Indexer -} - -// NewVirtualMachineImageLister returns a new VirtualMachineImageLister. -func NewVirtualMachineImageLister(indexer cache.Indexer) VirtualMachineImageLister { - return &virtualMachineImageLister{indexer: indexer} -} - -// List lists all VirtualMachineImages in the indexer. -func (s *virtualMachineImageLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineImage, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineImage)) - }) - return ret, err -} - -// Get retrieves the VirtualMachineImage from the index for a given name. -func (s *virtualMachineImageLister) Get(name string) (*v1alpha1.VirtualMachineImage, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineimage"), name) - } - return obj.(*v1alpha1.VirtualMachineImage), nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go deleted file mode 100644 index f05e0af98..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachineservice.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualMachineServiceLister helps list VirtualMachineServices. -// All objects returned here must be treated as read-only. -type VirtualMachineServiceLister interface { - // List lists all VirtualMachineServices in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) - // VirtualMachineServices returns an object that can list and get VirtualMachineServices. - VirtualMachineServices(namespace string) VirtualMachineServiceNamespaceLister - VirtualMachineServiceListerExpansion -} - -// virtualMachineServiceLister implements the VirtualMachineServiceLister interface. -type virtualMachineServiceLister struct { - indexer cache.Indexer -} - -// NewVirtualMachineServiceLister returns a new VirtualMachineServiceLister. -func NewVirtualMachineServiceLister(indexer cache.Indexer) VirtualMachineServiceLister { - return &virtualMachineServiceLister{indexer: indexer} -} - -// List lists all VirtualMachineServices in the indexer. -func (s *virtualMachineServiceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineService)) - }) - return ret, err -} - -// VirtualMachineServices returns an object that can list and get VirtualMachineServices. -func (s *virtualMachineServiceLister) VirtualMachineServices(namespace string) VirtualMachineServiceNamespaceLister { - return virtualMachineServiceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VirtualMachineServiceNamespaceLister helps list and get VirtualMachineServices. -// All objects returned here must be treated as read-only. -type VirtualMachineServiceNamespaceLister interface { - // List lists all VirtualMachineServices in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) - // Get retrieves the VirtualMachineService from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VirtualMachineService, error) - VirtualMachineServiceNamespaceListerExpansion -} - -// virtualMachineServiceNamespaceLister implements the VirtualMachineServiceNamespaceLister -// interface. -type virtualMachineServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualMachineServices in the indexer for a given namespace. -func (s virtualMachineServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineService)) - }) - return ret, err -} - -// Get retrieves the VirtualMachineService from the indexer for a given namespace and name. -func (s virtualMachineServiceNamespaceLister) Get(name string) (*v1alpha1.VirtualMachineService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachineservice"), name) - } - return obj.(*v1alpha1.VirtualMachineService), nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go b/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go deleted file mode 100644 index d7288b287..000000000 --- a/pkg/cloudprovider/vsphereparavirtual/vmop/listers/vmop/v1alpha1/virtualmachinesetresourcepolicy.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualMachineSetResourcePolicyLister helps list VirtualMachineSetResourcePolicies. -// All objects returned here must be treated as read-only. -type VirtualMachineSetResourcePolicyLister interface { - // List lists all VirtualMachineSetResourcePolicies in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) - // VirtualMachineSetResourcePolicies returns an object that can list and get VirtualMachineSetResourcePolicies. - VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyNamespaceLister - VirtualMachineSetResourcePolicyListerExpansion -} - -// virtualMachineSetResourcePolicyLister implements the VirtualMachineSetResourcePolicyLister interface. -type virtualMachineSetResourcePolicyLister struct { - indexer cache.Indexer -} - -// NewVirtualMachineSetResourcePolicyLister returns a new VirtualMachineSetResourcePolicyLister. -func NewVirtualMachineSetResourcePolicyLister(indexer cache.Indexer) VirtualMachineSetResourcePolicyLister { - return &virtualMachineSetResourcePolicyLister{indexer: indexer} -} - -// List lists all VirtualMachineSetResourcePolicies in the indexer. -func (s *virtualMachineSetResourcePolicyLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineSetResourcePolicy)) - }) - return ret, err -} - -// VirtualMachineSetResourcePolicies returns an object that can list and get VirtualMachineSetResourcePolicies. -func (s *virtualMachineSetResourcePolicyLister) VirtualMachineSetResourcePolicies(namespace string) VirtualMachineSetResourcePolicyNamespaceLister { - return virtualMachineSetResourcePolicyNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VirtualMachineSetResourcePolicyNamespaceLister helps list and get VirtualMachineSetResourcePolicies. -// All objects returned here must be treated as read-only. -type VirtualMachineSetResourcePolicyNamespaceLister interface { - // List lists all VirtualMachineSetResourcePolicies in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) - // Get retrieves the VirtualMachineSetResourcePolicy from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VirtualMachineSetResourcePolicy, error) - VirtualMachineSetResourcePolicyNamespaceListerExpansion -} - -// virtualMachineSetResourcePolicyNamespaceLister implements the VirtualMachineSetResourcePolicyNamespaceLister -// interface. -type virtualMachineSetResourcePolicyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualMachineSetResourcePolicies in the indexer for a given namespace. -func (s virtualMachineSetResourcePolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualMachineSetResourcePolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VirtualMachineSetResourcePolicy)) - }) - return ret, err -} - -// Get retrieves the VirtualMachineSetResourcePolicy from the indexer for a given namespace and name. -func (s virtualMachineSetResourcePolicyNamespaceLister) Get(name string) (*v1alpha1.VirtualMachineSetResourcePolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("virtualmachinesetresourcepolicy"), name) - } - return obj.(*v1alpha1.VirtualMachineSetResourcePolicy), nil -} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go index 5bc0fcb9e..e1b5a87ad 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go @@ -9,12 +9,12 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/cloud-provider-vsphere/pkg/util" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" ) // discoverNodeByProviderID takes a ProviderID and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmopclient.Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmop.VmoperatorV1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -24,7 +24,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace checkError, func() error { uuid := GetUUIDFromProviderID(providerID) - vms, err := vmClient.VmoperatorV1alpha1().VirtualMachines(namespace).List(ctx, metav1.ListOptions{}) + vms, err := vmClient.VirtualMachines(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return err } @@ -44,7 +44,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace // discoverNodeByName takes a node name and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmopclient.Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmop.VmoperatorV1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -53,7 +53,7 @@ func discoverNodeByName(ctx context.Context, name types.NodeName, namespace stri DiscoverNodeBackoff, checkError, func() error { - vm, err := vmClient.VmoperatorV1alpha1().VirtualMachines(namespace).Get(ctx, string(name), metav1.GetOptions{}) + vm, err := vmClient.VirtualMachines(namespace).Get(ctx, string(name), metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { return nil diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go new file mode 100644 index 000000000..d34e1901e --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go @@ -0,0 +1,60 @@ +package client + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + + "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" +) + +var ( + VirtualMachineServiceGVR = schema.GroupVersionResource{ + Group: "vmoperator.vmware.com", + Version: "v1alpha1", + Resource: "virtualmachineservices", + } + + VirtualMachineGVR = schema.GroupVersionResource{ + Group: "vmoperator.vmware.com", + Version: "v1alpha1", + Resource: "virtualmachines", + } +) + +type VmoperatorV1alpha1Client struct { + dynamicClient *dynamic.DynamicClient +} + +func (c *VmoperatorV1alpha1Client) VirtualMachines(namespace string) vmoperator.VirtualMachineInterface { + return newVirtualMachines(c, namespace) +} + +func (c *VmoperatorV1alpha1Client) VirtualMachineServices(namespace string) vmoperator.VirtualMachineServiceInterface { + return newVirtualMachineServices(c, namespace) +} + +func (c *VmoperatorV1alpha1Client) Client() dynamic.Interface { + if c == nil { + return nil + } + return c.dynamicClient +} + +func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + + dynamicClient, err := dynamic.NewForConfig(c) + if err != nil { + return nil, err + } + + client := &VmoperatorV1alpha1Client{ + dynamicClient: dynamicClient, + } + return client, nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go new file mode 100644 index 000000000..16f33d4c8 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go @@ -0,0 +1,34 @@ +package client + +import ( + "k8s.io/client-go/dynamic" + dynamicfake "k8s.io/client-go/dynamic/fake" + + "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" +) + +type FakeClient struct { + DynamicClient *dynamicfake.FakeDynamicClient +} + +// NewFakeClientWrapper creates a FakeClientWrapper +func NewFakeClient(fakeClient *dynamicfake.FakeDynamicClient) *FakeClient { + fcw := FakeClient{} + fcw.DynamicClient = fakeClient + return &fcw +} + +func (c *FakeClient) VirtualMachines(namespace string) vmoperator.VirtualMachineInterface { + return newVirtualMachines(c, namespace) +} + +func (c *FakeClient) VirtualMachineServices(namespace string) vmoperator.VirtualMachineServiceInterface { + return newVirtualMachineServices(c, namespace) +} + +func (c *FakeClient) Client() dynamic.Interface { + if c == nil { + return nil + } + return c.DynamicClient +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go new file mode 100644 index 000000000..e6b89e2b7 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go @@ -0,0 +1,87 @@ +package client + +import ( + "context" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/dynamic" + + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" +) + +// virtualMachines implements VirtualMachineInterface +type virtualMachines struct { + client dynamic.Interface + ns string +} + +func newVirtualMachines(c vmoperator.VmoperatorV1alpha1Interface, namespace string) *virtualMachines { + return &virtualMachines{ + client: c.Client(), + ns: namespace, + } +} + +func (v *virtualMachines) Create(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachine, opts v1.CreateOptions) (*vmopv1alpha1.VirtualMachine, error) { + unstructuredObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(virtualMachine) + if err != nil { + return nil, err + } + + obj, err := v.client.Resource(VirtualMachineGVR).Namespace(v.ns).Create(ctx, &unstructured.Unstructured{Object: unstructuredObj}, opts) + if err != nil { + return nil, err + } + + createdVirtualMachine := &vmopv1alpha1.VirtualMachine{} + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), createdVirtualMachine); err != nil { + return nil, err + } + return createdVirtualMachine, nil +} + +func (v *virtualMachines) Update(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachine, opts v1.UpdateOptions) (*vmopv1alpha1.VirtualMachine, error) { + unstructuredObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(virtualMachine) + if err != nil { + return nil, err + } + + obj, err := v.client.Resource(VirtualMachineGVR).Namespace(v.ns).Update(ctx, &unstructured.Unstructured{Object: unstructuredObj}, opts) + if err != nil { + return nil, err + } + + updatedVirtualMachine := &vmopv1alpha1.VirtualMachine{} + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), updatedVirtualMachine); err != nil { + return nil, err + } + return updatedVirtualMachine, nil +} + +func (v *virtualMachines) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return v.client.Resource(VirtualMachineGVR).Namespace(v.ns).Delete(ctx, name, opts) +} + +func (v *virtualMachines) Get(ctx context.Context, name string, opts v1.GetOptions) (*vmopv1alpha1.VirtualMachine, error) { + virtualMachine := &vmopv1alpha1.VirtualMachine{} + if obj, err := v.client.Resource(VirtualMachineGVR).Namespace(v.ns).Get(ctx, name, opts); err != nil { + return nil, err + } else if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), virtualMachine); err != nil { + return nil, err + } + return virtualMachine, nil +} + +func (v *virtualMachines) List(ctx context.Context, opts v1.ListOptions) (*vmopv1alpha1.VirtualMachineList, error) { + virtualMachineList := &vmopv1alpha1.VirtualMachineList{} + if obj, err := v.client.Resource(VirtualMachineGVR).Namespace(v.ns).List(ctx, opts); err != nil { + return nil, err + } else if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), virtualMachineList); err != nil { + return nil, err + } + return virtualMachineList, nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go new file mode 100644 index 000000000..76d5f48b7 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go @@ -0,0 +1,87 @@ +package client + +import ( + "context" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/dynamic" + + "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" +) + +// virtualMachineServices implements VirtualMachineServiceInterface +type virtualMachineServices struct { + client dynamic.Interface + ns string +} + +// newVirtualMachineServices returns a VirtualMachineServices +func newVirtualMachineServices(c vmoperator.VmoperatorV1alpha1Interface, namespace string) *virtualMachineServices { + return &virtualMachineServices{ + client: c.Client(), + ns: namespace, + } +} + +func (v *virtualMachineServices) Create(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineService, opts v1.CreateOptions) (*vmopv1alpha1.VirtualMachineService, error) { + unstructuredObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(virtualMachineService) + if err != nil { + return nil, err + } + + obj, err := v.client.Resource(VirtualMachineServiceGVR).Namespace(v.ns).Create(ctx, &unstructured.Unstructured{Object: unstructuredObj}, opts) + if err != nil { + return nil, err + } + + createdVirtualMachineService := &vmopv1alpha1.VirtualMachineService{} + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), createdVirtualMachineService); err != nil { + return nil, err + } + return createdVirtualMachineService, nil +} + +func (v *virtualMachineServices) Update(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*vmopv1alpha1.VirtualMachineService, error) { + unstructuredObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(virtualMachineService) + if err != nil { + return nil, err + } + + obj, err := v.client.Resource(VirtualMachineServiceGVR).Namespace(v.ns).Update(ctx, &unstructured.Unstructured{Object: unstructuredObj}, opts) + if err != nil { + return nil, err + } + + updatedVirtualMachineService := &vmopv1alpha1.VirtualMachineService{} + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), updatedVirtualMachineService); err != nil { + return nil, err + } + return updatedVirtualMachineService, nil +} + +func (v *virtualMachineServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return v.client.Resource(VirtualMachineServiceGVR).Namespace(v.ns).Delete(ctx, name, opts) +} + +func (v *virtualMachineServices) Get(ctx context.Context, name string, opts v1.GetOptions) (*vmopv1alpha1.VirtualMachineService, error) { + virtualMachineService := &vmopv1alpha1.VirtualMachineService{} + if obj, err := v.client.Resource(VirtualMachineServiceGVR).Namespace(v.ns).Get(ctx, name, opts); err != nil { + return nil, err + } else if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), virtualMachineService); err != nil { + return nil, err + } + return virtualMachineService, nil +} + +func (v *virtualMachineServices) List(ctx context.Context, opts v1.ListOptions) (*vmopv1alpha1.VirtualMachineServiceList, error) { + virtualMachineServiceList := &vmopv1alpha1.VirtualMachineServiceList{} + if obj, err := v.client.Resource(VirtualMachineServiceGVR).Namespace(v.ns).List(ctx, opts); err != nil { + return nil, err + } else if err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.UnstructuredContent(), virtualMachineServiceList); err != nil { + return nil, err + } + return virtualMachineServiceList, nil +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go new file mode 100644 index 000000000..d122c7fcc --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go @@ -0,0 +1,35 @@ +package vmoperator + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/dynamic" + + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" +) + +// VmoperatorV1alpha1Interface has methods to work with Vmoperator V1alpha1 resources. +type VmoperatorV1alpha1Interface interface { + Client() dynamic.Interface + VirtualMachines(namespace string) VirtualMachineInterface + VirtualMachineServices(namespace string) VirtualMachineServiceInterface +} + +// VirtualMachineInterface has methods to work with VirtualMachineService resources. +type VirtualMachineInterface interface { + Create(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachine, opts v1.CreateOptions) (*vmopv1alpha1.VirtualMachine, error) + Update(ctx context.Context, virtualMachine *vmopv1alpha1.VirtualMachine, opts v1.UpdateOptions) (*vmopv1alpha1.VirtualMachine, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*vmopv1alpha1.VirtualMachine, error) + List(ctx context.Context, opts v1.ListOptions) (*vmopv1alpha1.VirtualMachineList, error) +} + +// VirtualMachineServiceInterface has methods to work with VirtualMachineService resources. +type VirtualMachineServiceInterface interface { + Create(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineService, opts v1.CreateOptions) (*vmopv1alpha1.VirtualMachineService, error) + Update(ctx context.Context, virtualMachineService *vmopv1alpha1.VirtualMachineService, opts v1.UpdateOptions) (*vmopv1alpha1.VirtualMachineService, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*vmopv1alpha1.VirtualMachineService, error) + List(ctx context.Context, opts v1.ListOptions) (*vmopv1alpha1.VirtualMachineServiceList, error) +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go index cd7726629..8755610dd 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go @@ -24,7 +24,7 @@ import ( "k8s.io/klog/v2/klogr" "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" ) var log = klogr.New().WithName("vmservice") @@ -41,7 +41,7 @@ type VMService interface { // vmService takes care of mapping of LB type of service to VM service in supervisor cluster type vmService struct { - vmClient vmopclient.Interface + vmClient vmop.VmoperatorV1alpha1Interface namespace string ownerReference *metav1.OwnerReference } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go index 267de3e7a..7027204b3 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go @@ -28,11 +28,11 @@ import ( v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" rest "k8s.io/client-go/rest" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator/client" ) const ( @@ -88,14 +88,12 @@ var ( // GetVmopClient gets a vm-operator-api client // This is separate from NewVMService so that a fake client can be injected for testing -func GetVmopClient(config *rest.Config) (vmopclient.Interface, error) { - scheme := runtime.NewScheme() - _ = vmopv1alpha1.AddToScheme(scheme) +func GetVmopClient(config *rest.Config) (vmop.VmoperatorV1alpha1Interface, error) { return vmopclient.NewForConfig(config) } // NewVMService creates a vmService object -func NewVMService(vmClient vmopclient.Interface, ns string, ownerRef *metav1.OwnerReference) VMService { +func NewVMService(vmClient vmop.VmoperatorV1alpha1Interface, ns string, ownerRef *metav1.OwnerReference) VMService { return &vmService{ vmClient: vmClient, namespace: ns, @@ -131,7 +129,7 @@ func (s *vmService) Get(ctx context.Context, service *v1.Service, clusterName st logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to get VirtualMachineService") - vmService, err := s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Get(ctx, s.GetVMServiceName(service, clusterName), metav1.GetOptions{}) + vmService, err := s.vmClient.VirtualMachineServices(s.namespace).Get(ctx, s.GetVMServiceName(service, clusterName), metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { return nil, nil @@ -154,7 +152,7 @@ func (s *vmService) Create(ctx context.Context, service *v1.Service, clusterName return nil, err } - vmService, err = s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Create(ctx, vmService, metav1.CreateOptions{}) + vmService, err = s.vmClient.VirtualMachineServices(s.namespace).Create(ctx, vmService, metav1.CreateOptions{}) if err != nil { logger.Error(ErrCreateVMService, fmt.Sprintf("%v", err)) return nil, err @@ -252,7 +250,7 @@ func (s *vmService) Update(ctx context.Context, service *v1.Service, clusterName } if needsUpdate { - newVMService, err = s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Update(ctx, newVMService, metav1.UpdateOptions{}) + newVMService, err = s.vmClient.VirtualMachineServices(s.namespace).Update(ctx, newVMService, metav1.UpdateOptions{}) if err != nil { logger.Error(ErrUpdateVMService, fmt.Sprintf("%v", err)) return nil, err @@ -270,7 +268,7 @@ func (s *vmService) Delete(ctx context.Context, service *v1.Service, clusterName logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to delete VirtualMachineService") - err := s.vmClient.VmoperatorV1alpha1().VirtualMachineServices(s.namespace).Delete(ctx, s.GetVMServiceName(service, clusterName), metav1.DeleteOptions{}) + err := s.vmClient.VirtualMachineServices(s.namespace).Delete(ctx, s.GetVMServiceName(service, clusterName), metav1.DeleteOptions{}) if err != nil { logger.Error(ErrDeleteVMService, fmt.Sprintf("%v", err)) return err diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go index 335c3d4b6..1f1c35237 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go @@ -34,7 +34,9 @@ import ( clientgotesting "k8s.io/client-go/testing" "k8s.io/apimachinery/pkg/util/intstr" - fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" + dynamicfake "k8s.io/client-go/dynamic/fake" + + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator/client" ) var ( @@ -52,7 +54,7 @@ var ( fakeLBIP = "1.1.1.1" ) -func initTest() (*v1.Service, VMService, *fakevmclient.Clientset) { +func initTest() (*v1.Service, VMService, *dynamicfake.FakeDynamicClient) { testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -73,9 +75,11 @@ func initTest() (*v1.Service, VMService, *fakevmclient.Clientset) { }, }, } - fc := fakevmclient.NewSimpleClientset() - vms = NewVMService(fc, testClusterNameSpace, &testOwnerReference) + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + vms = NewVMService(vmopclient.NewFakeClient(fc), testClusterNameSpace, &testOwnerReference) return testK8sService, vms, fc } @@ -141,7 +145,6 @@ func TestGetVMService(t *testing.T) { } // create a fake VMService createdVMService, _ := vms.Create(context.Background(), k8sService, testClustername) - vmService, err := vms.Get(context.Background(), k8sService, testClustername) assert.NoError(t, err) assert.Equal(t, (*vmService).Spec, (*createdVMService).Spec) diff --git a/pkg/cloudprovider/vsphereparavirtual/zone.go b/pkg/cloudprovider/vsphereparavirtual/zone.go index aff4816a0..2ce79f799 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone.go @@ -4,7 +4,7 @@ import ( "context" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" - vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned" + vmop "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" @@ -14,7 +14,7 @@ import ( ) type zones struct { - vmClient vmopclient.Interface + vmClient vmop.VmoperatorV1alpha1Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone_test.go b/pkg/cloudprovider/vsphereparavirtual/zone_test.go index 610f629d6..831f99290 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone_test.go @@ -7,10 +7,13 @@ import ( "github.com/stretchr/testify/assert" vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + dynamicfake "k8s.io/client-go/dynamic/fake" "k8s.io/client-go/rest" cloudprovider "k8s.io/cloud-provider" - fakevmclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmop/clientset/versioned/fake" + + vmopclient "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator/client" ) var ( @@ -128,13 +131,16 @@ func TestZonesByNodeName(t *testing.T) { } } -func initVMopClient(testVM *vmopv1alpha1.VirtualMachine) (zones, *fakevmclient.Clientset, error) { - fc := fakevmclient.NewSimpleClientset() +func initVMopClient(testVM *vmopv1alpha1.VirtualMachine) (zones, *dynamicfake.FakeDynamicClient, error) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + fcw := vmopclient.NewFakeClient(fc) zone := zones{ - vmClient: fc, + vmClient: fcw, namespace: testClusterNameSpace, } - _, err := fc.VmoperatorV1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + _, err := fcw.VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) return zone, fc, err } From 7cc41d59af10cad5d953b2e7c6733ed9ffb045d8 Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Tue, 30 Jan 2024 20:28:18 +0800 Subject: [PATCH 6/8] fix lint Signed-off-by: Xudong Liu --- pkg/cloudprovider/vsphereparavirtual/instances.go | 2 +- pkg/cloudprovider/vsphereparavirtual/vmoperator.go | 4 ++-- .../vsphereparavirtual/vmoperator/client/client.go | 8 +++++++- .../vsphereparavirtual/vmoperator/client/fake_client.go | 6 +++++- .../vmoperator/client/virtualmachine_client.go | 2 +- .../vmoperator/client/virtualmachineservice_client.go | 2 +- .../vsphereparavirtual/vmoperator/interface.go | 4 ++-- pkg/cloudprovider/vsphereparavirtual/vmservice/types.go | 2 +- .../vsphereparavirtual/vmservice/vmservice.go | 4 ++-- pkg/cloudprovider/vsphereparavirtual/zone.go | 2 +- 10 files changed, 23 insertions(+), 13 deletions(-) diff --git a/pkg/cloudprovider/vsphereparavirtual/instances.go b/pkg/cloudprovider/vsphereparavirtual/instances.go index 7e73f7c3e..4323ff911 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances.go @@ -37,7 +37,7 @@ import ( ) type instances struct { - vmClient vmop.VmoperatorV1alpha1Interface + vmClient vmop.V1alpha1Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go index e1b5a87ad..c91a81494 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go @@ -14,7 +14,7 @@ import ( // discoverNodeByProviderID takes a ProviderID and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmop.VmoperatorV1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmop.V1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -44,7 +44,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace // discoverNodeByName takes a node name and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmop.VmoperatorV1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmop.V1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go index d34e1901e..7d7a6b059 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go @@ -12,12 +12,13 @@ import ( ) var ( + // VirtualMachineServiceGVR has virtualmachineservice resource info. VirtualMachineServiceGVR = schema.GroupVersionResource{ Group: "vmoperator.vmware.com", Version: "v1alpha1", Resource: "virtualmachineservices", } - + // VirtualMachineGVR has virtualmachine resource info. VirtualMachineGVR = schema.GroupVersionResource{ Group: "vmoperator.vmware.com", Version: "v1alpha1", @@ -25,18 +26,22 @@ var ( } ) +// VmoperatorV1alpha1Client contains the dynamic client for vm operator group type VmoperatorV1alpha1Client struct { dynamicClient *dynamic.DynamicClient } +// VirtualMachines retrieves the virtualmachine client func (c *VmoperatorV1alpha1Client) VirtualMachines(namespace string) vmoperator.VirtualMachineInterface { return newVirtualMachines(c, namespace) } +// VirtualMachineServices retrieves the virtualmachineservice client func (c *VmoperatorV1alpha1Client) VirtualMachineServices(namespace string) vmoperator.VirtualMachineServiceInterface { return newVirtualMachineServices(c, namespace) } +// Client retrieves the dynamic client func (c *VmoperatorV1alpha1Client) Client() dynamic.Interface { if c == nil { return nil @@ -44,6 +49,7 @@ func (c *VmoperatorV1alpha1Client) Client() dynamic.Interface { return c.dynamicClient } +// NewForConfig creates a new client for the given config. func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go index 16f33d4c8..608ac95cb 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go @@ -7,25 +7,29 @@ import ( "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" ) +// FakeClient contains the fake dynamic client for vm operator group type FakeClient struct { DynamicClient *dynamicfake.FakeDynamicClient } -// NewFakeClientWrapper creates a FakeClientWrapper +// NewFakeClient creates a FakeClientWrapper func NewFakeClient(fakeClient *dynamicfake.FakeDynamicClient) *FakeClient { fcw := FakeClient{} fcw.DynamicClient = fakeClient return &fcw } +// VirtualMachines retrieves the virtualmachine client func (c *FakeClient) VirtualMachines(namespace string) vmoperator.VirtualMachineInterface { return newVirtualMachines(c, namespace) } +// VirtualMachineServices retrieves the virtualmachineservice client func (c *FakeClient) VirtualMachineServices(namespace string) vmoperator.VirtualMachineServiceInterface { return newVirtualMachineServices(c, namespace) } +// Client retrieves the dynamic client func (c *FakeClient) Client() dynamic.Interface { if c == nil { return nil diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go index e6b89e2b7..4dea14b16 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client.go @@ -19,7 +19,7 @@ type virtualMachines struct { ns string } -func newVirtualMachines(c vmoperator.VmoperatorV1alpha1Interface, namespace string) *virtualMachines { +func newVirtualMachines(c vmoperator.V1alpha1Interface, namespace string) *virtualMachines { return &virtualMachines{ client: c.Client(), ns: namespace, diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go index 76d5f48b7..56e3a9845 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client.go @@ -19,7 +19,7 @@ type virtualMachineServices struct { } // newVirtualMachineServices returns a VirtualMachineServices -func newVirtualMachineServices(c vmoperator.VmoperatorV1alpha1Interface, namespace string) *virtualMachineServices { +func newVirtualMachineServices(c vmoperator.V1alpha1Interface, namespace string) *virtualMachineServices { return &virtualMachineServices{ client: c.Client(), ns: namespace, diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go index d122c7fcc..6e4eaa34e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go @@ -9,8 +9,8 @@ import ( vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) -// VmoperatorV1alpha1Interface has methods to work with Vmoperator V1alpha1 resources. -type VmoperatorV1alpha1Interface interface { +// V1alpha1Interface has methods to work with Vmoperator V1alpha1 resources. +type V1alpha1Interface interface { Client() dynamic.Interface VirtualMachines(namespace string) VirtualMachineInterface VirtualMachineServices(namespace string) VirtualMachineServiceInterface diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go index 8755610dd..3a477b1e7 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go @@ -41,7 +41,7 @@ type VMService interface { // vmService takes care of mapping of LB type of service to VM service in supervisor cluster type vmService struct { - vmClient vmop.VmoperatorV1alpha1Interface + vmClient vmop.V1alpha1Interface namespace string ownerReference *metav1.OwnerReference } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go index 7027204b3..4b9cd3ffc 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go @@ -88,12 +88,12 @@ var ( // GetVmopClient gets a vm-operator-api client // This is separate from NewVMService so that a fake client can be injected for testing -func GetVmopClient(config *rest.Config) (vmop.VmoperatorV1alpha1Interface, error) { +func GetVmopClient(config *rest.Config) (vmop.V1alpha1Interface, error) { return vmopclient.NewForConfig(config) } // NewVMService creates a vmService object -func NewVMService(vmClient vmop.VmoperatorV1alpha1Interface, ns string, ownerRef *metav1.OwnerReference) VMService { +func NewVMService(vmClient vmop.V1alpha1Interface, ns string, ownerRef *metav1.OwnerReference) VMService { return &vmService{ vmClient: vmClient, namespace: ns, diff --git a/pkg/cloudprovider/vsphereparavirtual/zone.go b/pkg/cloudprovider/vsphereparavirtual/zone.go index 2ce79f799..f0033a580 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone.go @@ -14,7 +14,7 @@ import ( ) type zones struct { - vmClient vmop.VmoperatorV1alpha1Interface + vmClient vmop.V1alpha1Interface namespace string } From 1071d14884564dae37eb7ab9ad1f99460052c90d Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Wed, 31 Jan 2024 12:42:20 +0800 Subject: [PATCH 7/8] add unit tests for client Signed-off-by: Xudong Liu --- .../client/virtualmachine_client_test.go | 325 ++++++++++++++++++ .../virtualmachineservice_client_test.go | 325 ++++++++++++++++++ 2 files changed, 650 insertions(+) create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go create mode 100644 pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go new file mode 100644 index 000000000..77dde9c24 --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go @@ -0,0 +1,325 @@ +package client + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + clientgotesting "k8s.io/client-go/testing" + + dynamicfake "k8s.io/client-go/dynamic/fake" +) + +func initVMTest() (*virtualMachines, *dynamicfake.FakeDynamicClient) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + vms := newVirtualMachines(NewFakeClient(fc), "test-ns") + return vms, fc +} + +func TestVMCreate(t *testing.T) { + vms, fc := initVMTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachine + createFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachine + expectedErr bool + }{ + { + name: "Create: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachine{ + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + }, + { + name: "Create: when create error", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + createFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + if testCase.createFunc != nil { + fc.PrependReactor("create", "*", testCase.createFunc) + } + actualVM, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + } + }) + } +} + +func TestVMUpdate(t *testing.T) { + vms, fc := initVMTest() + testCases := []struct { + name string + oldVM *vmopv1alpha1.VirtualMachine + newVM *vmopv1alpha1.VirtualMachine + updateFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachine + expectedErr bool + }{ + { + name: "Update: when everything is ok", + oldVM: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + newVM: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image-2", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image-2", + }, + }, + }, + { + name: "Update: when update error", + oldVM: &vmopv1alpha1.VirtualMachine{ + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + newVM: &vmopv1alpha1.VirtualMachine{ + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + updateFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.oldVM, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.updateFunc != nil { + fc.PrependReactor("update", "*", testCase.updateFunc) + } + updatedVM, err := vms.Update(context.Background(), testCase.newVM, metav1.UpdateOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, updatedVM.Spec) + } + }) + } +} + +func TestVMDelete(t *testing.T) { + vms, fc := initVMTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachine + deleteFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedErr bool + }{ + { + name: "Delete: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + }, + { + name: "Create: when delete error", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + deleteFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.deleteFunc != nil { + fc.PrependReactor("delete", "*", testCase.deleteFunc) + } + err = vms.Delete(context.Background(), testCase.virtualMachine.Name, metav1.DeleteOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestVMGet(t *testing.T) { + vms, fc := initVMTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachine + getFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachine + expectedErr bool + }{ + { + name: "Get: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + }, + { + name: "Get: when get error", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-error", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + getFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.getFunc != nil { + fc.PrependReactor("get", "*", testCase.getFunc) + } + actualVM, err := vms.Get(context.Background(), testCase.virtualMachine.Name, metav1.GetOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + } + }) + } +} + +func TestVMList(t *testing.T) { + vms, fc := initVMTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachine + listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMNum int + expectedErr bool + }{ + { + name: "List: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + expectedVMNum: 1, + }, + { + name: "List: when list error", + virtualMachine: &vmopv1alpha1.VirtualMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-error", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + listFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVMNum: 0, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.listFunc != nil { + fc.PrependReactor("list", "*", testCase.listFunc) + } + vmList, err := vms.List(context.Background(), metav1.ListOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVMNum, len(vmList.Items)) + } + }) + } +} diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go new file mode 100644 index 000000000..7b3949e7a --- /dev/null +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go @@ -0,0 +1,325 @@ +package client + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + clientgotesting "k8s.io/client-go/testing" + + dynamicfake "k8s.io/client-go/dynamic/fake" +) + +func initVMServiceTest() (*virtualMachineServices, *dynamicfake.FakeDynamicClient) { + scheme := runtime.NewScheme() + _ = vmopv1alpha1.AddToScheme(scheme) + fc := dynamicfake.NewSimpleDynamicClient(scheme) + vms := newVirtualMachineServices(NewFakeClient(fc), "test-ns") + return vms, fc +} + +func TestVMServiceCreate(t *testing.T) { + vms, fc := initVMServiceTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachineService + createFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachineService + expectedErr bool + }{ + { + name: "Create: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachineService{ + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + }, + { + name: "Create: when create error", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + createFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + if testCase.createFunc != nil { + fc.PrependReactor("create", "*", testCase.createFunc) + } + actualVM, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + } + }) + } +} + +func TestVMServiceUpdate(t *testing.T) { + vms, fc := initVMServiceTest() + testCases := []struct { + name string + oldVM *vmopv1alpha1.VirtualMachineService + newVM *vmopv1alpha1.VirtualMachineService + updateFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachineService + expectedErr bool + }{ + { + name: "Update: when everything is ok", + oldVM: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + newVM: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + }, + { + name: "Update: when update error", + oldVM: &vmopv1alpha1.VirtualMachineService{ + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + newVM: &vmopv1alpha1.VirtualMachineService{ + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + updateFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.oldVM, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.updateFunc != nil { + fc.PrependReactor("update", "*", testCase.updateFunc) + } + updatedVM, err := vms.Update(context.Background(), testCase.newVM, metav1.UpdateOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, updatedVM.Spec) + } + }) + } +} + +func TestVMServiceDelete(t *testing.T) { + vms, fc := initVMServiceTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachineService + deleteFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedErr bool + }{ + { + name: "Delete: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + }, + { + name: "Create: when delete error", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + deleteFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.deleteFunc != nil { + fc.PrependReactor("delete", "*", testCase.deleteFunc) + } + err = vms.Delete(context.Background(), testCase.virtualMachine.Name, metav1.DeleteOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestVMServiceGet(t *testing.T) { + vms, fc := initVMServiceTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachineService + getFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVM *vmopv1alpha1.VirtualMachineService + expectedErr bool + }{ + { + name: "Get: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + expectedVM: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + }, + { + name: "Get: when get error", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-error", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + getFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVM: nil, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.getFunc != nil { + fc.PrependReactor("get", "*", testCase.getFunc) + } + actualVM, err := vms.Get(context.Background(), testCase.virtualMachine.Name, metav1.GetOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + } + }) + } +} + +func TestVMServiceList(t *testing.T) { + vms, fc := initVMServiceTest() + testCases := []struct { + name string + virtualMachine *vmopv1alpha1.VirtualMachineService + listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMNum int + expectedErr bool + }{ + { + name: "List: when everything is ok", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + expectedVMNum: 1, + }, + { + name: "List: when list error", + virtualMachine: &vmopv1alpha1.VirtualMachineService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-error", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + listFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { + return true, nil, fmt.Errorf("test error") + }, + expectedVMNum: 0, + expectedErr: true, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.listFunc != nil { + fc.PrependReactor("list", "*", testCase.listFunc) + } + vmList, err := vms.List(context.Background(), metav1.ListOptions{}) + if testCase.expectedErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, testCase.expectedVMNum, len(vmList.Items)) + } + }) + } +} From 1006123a9e63257c2d526aa0c605db668cd126ae Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Wed, 31 Jan 2024 13:26:27 +0800 Subject: [PATCH 8/8] resolve comment Signed-off-by: Xudong Liu --- .../vsphereparavirtual/instances.go | 2 +- .../vsphereparavirtual/instances_test.go | 4 +- .../vsphereparavirtual/loadbalancer_test.go | 26 +-- .../vsphereparavirtual/vmoperator.go | 8 +- .../vmoperator/client/client.go | 21 +- .../vmoperator/client/fake_client.go | 28 ++- .../client/virtualmachine_client_test.go | 100 ++++++--- .../virtualmachineservice_client_test.go | 206 +++++++++++------- .../vmoperator/interface.go | 5 + .../vsphereparavirtual/vmservice/types.go | 2 +- .../vsphereparavirtual/vmservice/vmservice.go | 12 +- .../vmservice/vmservice_test.go | 2 +- pkg/cloudprovider/vsphereparavirtual/zone.go | 2 +- .../vsphereparavirtual/zone_test.go | 4 +- 14 files changed, 269 insertions(+), 153 deletions(-) diff --git a/pkg/cloudprovider/vsphereparavirtual/instances.go b/pkg/cloudprovider/vsphereparavirtual/instances.go index 4323ff911..694ec777e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances.go @@ -37,7 +37,7 @@ import ( ) type instances struct { - vmClient vmop.V1alpha1Interface + vmClient vmop.Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/instances_test.go b/pkg/cloudprovider/vsphereparavirtual/instances_test.go index 9de735f84..a9f3e0f12 100644 --- a/pkg/cloudprovider/vsphereparavirtual/instances_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/instances_test.go @@ -93,12 +93,12 @@ func initTest(testVM *vmopv1alpha1.VirtualMachine) (*instances, *dynamicfake.Fak scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - fcw := vmopclient.NewFakeClient(fc) + fcw := vmopclient.NewFakeClientSet(fc) instance := &instances{ vmClient: fcw, namespace: testClusterNameSpace, } - _, err := fcw.VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + _, err := fcw.V1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) return instance, fc, err } diff --git a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go index 1c61d8439..ed62da98e 100644 --- a/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/loadbalancer_test.go @@ -53,14 +53,14 @@ var ( } ) -func newTestLoadBalancer() (cloudprovider.LoadBalancer, *vmopclient.FakeClient) { +func newTestLoadBalancer() (cloudprovider.LoadBalancer, *dynamicfake.FakeDynamicClient) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - fcw := vmopclient.NewFakeClient(fc) + fcw := vmopclient.NewFakeClientSet(fc) vms := vmservice.NewVMService(fcw, testClusterNameSpace, &testOwnerReference) - return &loadBalancer{vmService: vms}, fcw + return &loadBalancer{vmService: vms}, fc } func TestNewLoadBalancer(t *testing.T) { @@ -150,7 +150,7 @@ func TestUpdateLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -176,7 +176,7 @@ func TestUpdateLoadBalancer(t *testing.T) { if testCase.expectErr { // Ensure that the client Update call returns an error on update - fcw.DynamicClient.PrependReactor("update", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + fc.PrependReactor("update", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { return true, nil, fmt.Errorf("Some undefined update error") }) err = lb.UpdateLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) @@ -190,7 +190,7 @@ func TestUpdateLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -201,7 +201,7 @@ func TestEnsureLoadBalancer_VMServiceExternalTrafficPolicyLocal(t *testing.T) { }, } - fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { unstructuredObj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(&vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ @@ -247,14 +247,14 @@ func TestEnsureLoadBalancer(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, Namespace: testK8sServiceNameSpace, }, } - fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", testCase.createFunc) + fc.PrependReactor("create", "virtualmachineservices", testCase.createFunc) _, ensureErr := lb.EnsureLoadBalancer(context.Background(), testClustername, testK8sService, []*v1.Node{}) assert.Equal(t, ensureErr.Error(), testCase.expectErr.Error()) @@ -266,7 +266,7 @@ func TestEnsureLoadBalancer(t *testing.T) { } func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -274,7 +274,7 @@ func TestEnsureLoadBalancer_VMServiceCreatedIPFound(t *testing.T) { }, } // Ensure that the client Create call returns a VMService with a valid IP - fcw.DynamicClient.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { + fc.PrependReactor("create", "virtualmachineservices", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { unstructuredObj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(&vmopv1alpha1.VirtualMachineService{ Status: vmopv1alpha1.VirtualMachineServiceStatus{ LoadBalancer: vmopv1alpha1.LoadBalancerStatus{ @@ -342,7 +342,7 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - lb, fcw := newTestLoadBalancer() + lb, fc := newTestLoadBalancer() testK8sService := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: testK8sServiceName, @@ -354,7 +354,7 @@ func TestEnsureLoadBalancer_DeleteLB(t *testing.T) { err := lb.EnsureLoadBalancerDeleted(context.Background(), testClustername, testK8sService) assert.NoError(t, err) - fcw.DynamicClient.PrependReactor("delete", "virtualmachineservices", testCase.deleteFunc) + fc.PrependReactor("delete", "virtualmachineservices", testCase.deleteFunc) err = lb.EnsureLoadBalancerDeleted(context.Background(), "test", testK8sService) if err != nil { diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go index c91a81494..d34ff9a0f 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator.go @@ -14,7 +14,7 @@ import ( // discoverNodeByProviderID takes a ProviderID and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmop.V1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByProviderID(ctx context.Context, providerID string, namespace string, vmClient vmop.Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -24,7 +24,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace checkError, func() error { uuid := GetUUIDFromProviderID(providerID) - vms, err := vmClient.VirtualMachines(namespace).List(ctx, metav1.ListOptions{}) + vms, err := vmClient.V1alpha1().VirtualMachines(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return err } @@ -44,7 +44,7 @@ func discoverNodeByProviderID(ctx context.Context, providerID string, namespace // discoverNodeByName takes a node name and returns a VirtualMachine if one exists, or nil otherwise // VirtualMachine not found is not an error -func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmop.V1alpha1Interface) (*vmopv1alpha1.VirtualMachine, error) { +func discoverNodeByName(ctx context.Context, name types.NodeName, namespace string, vmClient vmop.Interface) (*vmopv1alpha1.VirtualMachine, error) { var discoveredNode *vmopv1alpha1.VirtualMachine = nil // Adding Retry here because there is no retry in caller from node controller @@ -53,7 +53,7 @@ func discoverNodeByName(ctx context.Context, name types.NodeName, namespace stri DiscoverNodeBackoff, checkError, func() error { - vm, err := vmClient.VirtualMachines(namespace).Get(ctx, string(name), metav1.GetOptions{}) + vm, err := vmClient.V1alpha1().VirtualMachines(namespace).Get(ctx, string(name), metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { return nil diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go index 7d7a6b059..9119006b0 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/client.go @@ -26,6 +26,17 @@ var ( } ) +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + vmopv1alpha1 *VmoperatorV1alpha1Client +} + +// V1alpha1 retrieves the VmoperatorV1alpha1Client +func (c *Clientset) V1alpha1() vmoperator.V1alpha1Interface { + return c.vmopv1alpha1 +} + // VmoperatorV1alpha1Client contains the dynamic client for vm operator group type VmoperatorV1alpha1Client struct { dynamicClient *dynamic.DynamicClient @@ -50,7 +61,7 @@ func (c *VmoperatorV1alpha1Client) Client() dynamic.Interface { } // NewForConfig creates a new client for the given config. -func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { +func NewForConfig(c *rest.Config) (*Clientset, error) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) @@ -59,8 +70,10 @@ func NewForConfig(c *rest.Config) (*VmoperatorV1alpha1Client, error) { return nil, err } - client := &VmoperatorV1alpha1Client{ - dynamicClient: dynamicClient, + clientSet := &Clientset{ + vmopv1alpha1: &VmoperatorV1alpha1Client{ + dynamicClient: dynamicClient, + }, } - return client, nil + return clientSet, nil } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go index 608ac95cb..2192ec291 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/fake_client.go @@ -7,18 +7,32 @@ import ( "k8s.io/cloud-provider-vsphere/pkg/cloudprovider/vsphereparavirtual/vmoperator" ) +// FakeClientSet contains the fake clients for groups. Each group has exactly one +// version included in a Clientset. +type FakeClientSet struct { + FakeClient *FakeClient +} + +// V1alpha1 retrieves the fake VmoperatorV1alpha1Client +func (c *FakeClientSet) V1alpha1() vmoperator.V1alpha1Interface { + return c.FakeClient +} + +// NewFakeClientSet creates a FakeClientWrapper +func NewFakeClientSet(fakeClient *dynamicfake.FakeDynamicClient) *FakeClientSet { + fcw := &FakeClientSet{ + FakeClient: &FakeClient{ + DynamicClient: fakeClient, + }, + } + return fcw +} + // FakeClient contains the fake dynamic client for vm operator group type FakeClient struct { DynamicClient *dynamicfake.FakeDynamicClient } -// NewFakeClient creates a FakeClientWrapper -func NewFakeClient(fakeClient *dynamicfake.FakeDynamicClient) *FakeClient { - fcw := FakeClient{} - fcw.DynamicClient = fakeClient - return &fcw -} - // VirtualMachines retrieves the virtualmachine client func (c *FakeClient) VirtualMachines(namespace string) vmoperator.VirtualMachineInterface { return newVirtualMachines(c, namespace) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go index 77dde9c24..029c6d2cc 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachine_client_test.go @@ -18,12 +18,11 @@ func initVMTest() (*virtualMachines, *dynamicfake.FakeDynamicClient) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - vms := newVirtualMachines(NewFakeClient(fc), "test-ns") + vms := newVirtualMachines(NewFakeClientSet(fc).V1alpha1(), "test-ns") return vms, fc } func TestVMCreate(t *testing.T) { - vms, fc := initVMTest() testCases := []struct { name string virtualMachine *vmopv1alpha1.VirtualMachine @@ -61,6 +60,7 @@ func TestVMCreate(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + vms, fc := initVMTest() if testCase.createFunc != nil { fc.PrependReactor("create", "*", testCase.createFunc) } @@ -76,7 +76,6 @@ func TestVMCreate(t *testing.T) { } func TestVMUpdate(t *testing.T) { - vms, fc := initVMTest() testCases := []struct { name string oldVM *vmopv1alpha1.VirtualMachine @@ -134,6 +133,7 @@ func TestVMUpdate(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + vms, fc := initVMTest() _, err := vms.Create(context.Background(), testCase.oldVM, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.updateFunc != nil { @@ -151,7 +151,6 @@ func TestVMUpdate(t *testing.T) { } func TestVMDelete(t *testing.T) { - vms, fc := initVMTest() testCases := []struct { name string virtualMachine *vmopv1alpha1.VirtualMachine @@ -170,7 +169,7 @@ func TestVMDelete(t *testing.T) { }, }, { - name: "Create: when delete error", + name: "Delete: when delete error", virtualMachine: &vmopv1alpha1.VirtualMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", @@ -188,6 +187,7 @@ func TestVMDelete(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + vms, fc := initVMTest() _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.deleteFunc != nil { @@ -204,7 +204,6 @@ func TestVMDelete(t *testing.T) { } func TestVMGet(t *testing.T) { - vms, fc := initVMTest() testCases := []struct { name string virtualMachine *vmopv1alpha1.VirtualMachine @@ -251,6 +250,7 @@ func TestVMGet(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + vms, fc := initVMTest() _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.getFunc != nil { @@ -268,34 +268,72 @@ func TestVMGet(t *testing.T) { } func TestVMList(t *testing.T) { - vms, fc := initVMTest() testCases := []struct { - name string - virtualMachine *vmopv1alpha1.VirtualMachine - listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedVMNum int - expectedErr bool + name string + virtualMachineList *vmopv1alpha1.VirtualMachineList + listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMNum int + expectedErr bool }{ { - name: "List: when everything is ok", - virtualMachine: &vmopv1alpha1.VirtualMachine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-vm", - }, - Spec: vmopv1alpha1.VirtualMachineSpec{ - ImageName: "test-image", + name: "List: when there is one virtual machine, list should be ok", + virtualMachineList: &vmopv1alpha1.VirtualMachineList{ + Items: []vmopv1alpha1.VirtualMachine{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, }, }, expectedVMNum: 1, }, { - name: "List: when list error", - virtualMachine: &vmopv1alpha1.VirtualMachine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-vm-error", + name: "List: when there is 2 virtual machines, list should be ok", + virtualMachineList: &vmopv1alpha1.VirtualMachineList{ + Items: []vmopv1alpha1.VirtualMachine{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-2", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, }, - Spec: vmopv1alpha1.VirtualMachineSpec{ - ImageName: "test-image", + }, + expectedVMNum: 2, + }, + { + name: "List: when there is 0 virtual machine, list should be ok", + virtualMachineList: &vmopv1alpha1.VirtualMachineList{ + Items: []vmopv1alpha1.VirtualMachine{}, + }, + expectedVMNum: 0, + }, + { + name: "List: when list error", + virtualMachineList: &vmopv1alpha1.VirtualMachineList{ + Items: []vmopv1alpha1.VirtualMachine{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineSpec{ + ImageName: "test-image", + }, + }, }, }, listFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { @@ -308,11 +346,15 @@ func TestVMList(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) - assert.NoError(t, err) - if testCase.listFunc != nil { - fc.PrependReactor("list", "*", testCase.listFunc) + vms, fc := initVMTest() + for _, vm := range testCase.virtualMachineList.Items { + _, err := vms.Create(context.Background(), &vm, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.listFunc != nil { + fc.PrependReactor("list", "*", testCase.listFunc) + } } + vmList, err := vms.List(context.Background(), metav1.ListOptions{}) if testCase.expectedErr { assert.Error(t, err) diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go index 7b3949e7a..671633761 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/client/virtualmachineservice_client_test.go @@ -18,27 +18,26 @@ func initVMServiceTest() (*virtualMachineServices, *dynamicfake.FakeDynamicClien scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - vms := newVirtualMachineServices(NewFakeClient(fc), "test-ns") + vms := newVirtualMachineServices(NewFakeClientSet(fc).V1alpha1(), "test-ns") return vms, fc } func TestVMServiceCreate(t *testing.T) { - vms, fc := initVMServiceTest() testCases := []struct { - name string - virtualMachine *vmopv1alpha1.VirtualMachineService - createFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedVM *vmopv1alpha1.VirtualMachineService - expectedErr bool + name string + virtualMachineService *vmopv1alpha1.VirtualMachineService + createFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMService *vmopv1alpha1.VirtualMachineService + expectedErr bool }{ { name: "Create: when everything is ok", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ Spec: vmopv1alpha1.VirtualMachineServiceSpec{ Type: "NodePort", }, }, - expectedVM: &vmopv1alpha1.VirtualMachineService{ + expectedVMService: &vmopv1alpha1.VirtualMachineService{ Spec: vmopv1alpha1.VirtualMachineServiceSpec{ Type: "NodePort", }, @@ -46,7 +45,7 @@ func TestVMServiceCreate(t *testing.T) { }, { name: "Create: when create error", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ Spec: vmopv1alpha1.VirtualMachineServiceSpec{ Type: "NodePort", }, @@ -54,40 +53,40 @@ func TestVMServiceCreate(t *testing.T) { createFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { return true, nil, fmt.Errorf("test error") }, - expectedVM: nil, - expectedErr: true, + expectedVMService: nil, + expectedErr: true, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { + vms, fc := initVMServiceTest() if testCase.createFunc != nil { fc.PrependReactor("create", "*", testCase.createFunc) } - actualVM, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + actualVM, err := vms.Create(context.Background(), testCase.virtualMachineService, metav1.CreateOptions{}) if testCase.expectedErr { assert.Error(t, err) } else { assert.NoError(t, err) - assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + assert.Equal(t, testCase.expectedVMService.Spec, actualVM.Spec) } }) } } func TestVMServiceUpdate(t *testing.T) { - vms, fc := initVMServiceTest() testCases := []struct { - name string - oldVM *vmopv1alpha1.VirtualMachineService - newVM *vmopv1alpha1.VirtualMachineService - updateFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedVM *vmopv1alpha1.VirtualMachineService - expectedErr bool + name string + oldVMService *vmopv1alpha1.VirtualMachineService + newVMService *vmopv1alpha1.VirtualMachineService + updateFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMService *vmopv1alpha1.VirtualMachineService + expectedErr bool }{ { name: "Update: when everything is ok", - oldVM: &vmopv1alpha1.VirtualMachineService{ + oldVMService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -95,7 +94,7 @@ func TestVMServiceUpdate(t *testing.T) { Type: "NodePort", }, }, - newVM: &vmopv1alpha1.VirtualMachineService{ + newVMService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -103,7 +102,7 @@ func TestVMServiceUpdate(t *testing.T) { Type: "NodePort", }, }, - expectedVM: &vmopv1alpha1.VirtualMachineService{ + expectedVMService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -114,12 +113,12 @@ func TestVMServiceUpdate(t *testing.T) { }, { name: "Update: when update error", - oldVM: &vmopv1alpha1.VirtualMachineService{ + oldVMService: &vmopv1alpha1.VirtualMachineService{ Spec: vmopv1alpha1.VirtualMachineServiceSpec{ Type: "NodePort", }, }, - newVM: &vmopv1alpha1.VirtualMachineService{ + newVMService: &vmopv1alpha1.VirtualMachineService{ Spec: vmopv1alpha1.VirtualMachineServiceSpec{ Type: "NodePort", }, @@ -127,40 +126,40 @@ func TestVMServiceUpdate(t *testing.T) { updateFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { return true, nil, fmt.Errorf("test error") }, - expectedVM: nil, - expectedErr: true, + expectedVMService: nil, + expectedErr: true, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - _, err := vms.Create(context.Background(), testCase.oldVM, metav1.CreateOptions{}) + vms, fc := initVMServiceTest() + _, err := vms.Create(context.Background(), testCase.oldVMService, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.updateFunc != nil { fc.PrependReactor("update", "*", testCase.updateFunc) } - updatedVM, err := vms.Update(context.Background(), testCase.newVM, metav1.UpdateOptions{}) + updatedVM, err := vms.Update(context.Background(), testCase.newVMService, metav1.UpdateOptions{}) if testCase.expectedErr { assert.Error(t, err) } else { assert.NoError(t, err) - assert.Equal(t, testCase.expectedVM.Spec, updatedVM.Spec) + assert.Equal(t, testCase.expectedVMService.Spec, updatedVM.Spec) } }) } } func TestVMServiceDelete(t *testing.T) { - vms, fc := initVMServiceTest() testCases := []struct { - name string - virtualMachine *vmopv1alpha1.VirtualMachineService - deleteFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedErr bool + name string + virtualMachineService *vmopv1alpha1.VirtualMachineService + deleteFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedErr bool }{ { name: "Delete: when everything is ok", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -170,8 +169,8 @@ func TestVMServiceDelete(t *testing.T) { }, }, { - name: "Create: when delete error", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + name: "Delete: when delete error", + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -188,12 +187,13 @@ func TestVMServiceDelete(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + vms, fc := initVMServiceTest() + _, err := vms.Create(context.Background(), testCase.virtualMachineService, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.deleteFunc != nil { fc.PrependReactor("delete", "*", testCase.deleteFunc) } - err = vms.Delete(context.Background(), testCase.virtualMachine.Name, metav1.DeleteOptions{}) + err = vms.Delete(context.Background(), testCase.virtualMachineService.Name, metav1.DeleteOptions{}) if testCase.expectedErr { assert.Error(t, err) } else { @@ -204,17 +204,16 @@ func TestVMServiceDelete(t *testing.T) { } func TestVMServiceGet(t *testing.T) { - vms, fc := initVMServiceTest() testCases := []struct { - name string - virtualMachine *vmopv1alpha1.VirtualMachineService - getFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedVM *vmopv1alpha1.VirtualMachineService - expectedErr bool + name string + virtualMachineService *vmopv1alpha1.VirtualMachineService + getFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMService *vmopv1alpha1.VirtualMachineService + expectedErr bool }{ { name: "Get: when everything is ok", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -222,7 +221,7 @@ func TestVMServiceGet(t *testing.T) { Type: "NodePort", }, }, - expectedVM: &vmopv1alpha1.VirtualMachineService{ + expectedVMService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm", }, @@ -233,7 +232,7 @@ func TestVMServiceGet(t *testing.T) { }, { name: "Get: when get error", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ + virtualMachineService: &vmopv1alpha1.VirtualMachineService{ ObjectMeta: metav1.ObjectMeta{ Name: "test-vm-error", }, @@ -244,81 +243,124 @@ func TestVMServiceGet(t *testing.T) { getFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { return true, nil, fmt.Errorf("test error") }, - expectedVM: nil, - expectedErr: true, + expectedVMService: nil, + expectedErr: true, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) + vms, fc := initVMServiceTest() + _, err := vms.Create(context.Background(), testCase.virtualMachineService, metav1.CreateOptions{}) assert.NoError(t, err) if testCase.getFunc != nil { fc.PrependReactor("get", "*", testCase.getFunc) } - actualVM, err := vms.Get(context.Background(), testCase.virtualMachine.Name, metav1.GetOptions{}) + actualVM, err := vms.Get(context.Background(), testCase.virtualMachineService.Name, metav1.GetOptions{}) if testCase.expectedErr { assert.Error(t, err) } else { assert.NoError(t, err) - assert.Equal(t, testCase.expectedVM.Spec, actualVM.Spec) + assert.Equal(t, testCase.expectedVMService.Spec, actualVM.Spec) } }) } } func TestVMServiceList(t *testing.T) { - vms, fc := initVMServiceTest() testCases := []struct { - name string - virtualMachine *vmopv1alpha1.VirtualMachineService - listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) - expectedVMNum int - expectedErr bool + name string + virtualMachineServiceList *vmopv1alpha1.VirtualMachineServiceList + listFunc func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) + expectedVMServiceNum int + expectedErr bool }{ { - name: "List: when everything is ok", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-vm", + name: "List: when there is one virtual machine service, list should be ok", + virtualMachineServiceList: &vmopv1alpha1.VirtualMachineServiceList{ + Items: []vmopv1alpha1.VirtualMachineService{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, }, - Spec: vmopv1alpha1.VirtualMachineServiceSpec{ - Type: "NodePort", + }, + expectedVMServiceNum: 1, + }, + { + name: "List: when there is 2 virtual machine services, list should be ok", + virtualMachineServiceList: &vmopv1alpha1.VirtualMachineServiceList{ + Items: []vmopv1alpha1.VirtualMachineService{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm-2", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, }, }, - expectedVMNum: 1, + expectedVMServiceNum: 2, + }, + { + name: "List: when there is 0 virtual machine service, list should be ok", + virtualMachineServiceList: &vmopv1alpha1.VirtualMachineServiceList{ + Items: []vmopv1alpha1.VirtualMachineService{}, + }, + expectedVMServiceNum: 0, }, { name: "List: when list error", - virtualMachine: &vmopv1alpha1.VirtualMachineService{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-vm-error", - }, - Spec: vmopv1alpha1.VirtualMachineServiceSpec{ - Type: "NodePort", + virtualMachineServiceList: &vmopv1alpha1.VirtualMachineServiceList{ + Items: []vmopv1alpha1.VirtualMachineService{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "test-vm", + }, + Spec: vmopv1alpha1.VirtualMachineServiceSpec{ + Type: "NodePort", + }, + }, }, }, listFunc: func(action clientgotesting.Action) (bool, runtime.Object, error) { return true, nil, fmt.Errorf("test error") }, - expectedVMNum: 0, - expectedErr: true, + expectedVMServiceNum: 0, + expectedErr: true, }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - _, err := vms.Create(context.Background(), testCase.virtualMachine, metav1.CreateOptions{}) - assert.NoError(t, err) - if testCase.listFunc != nil { - fc.PrependReactor("list", "*", testCase.listFunc) + vms, fc := initVMServiceTest() + for _, vmservice := range testCase.virtualMachineServiceList.Items { + _, err := vms.Create(context.Background(), &vmservice, metav1.CreateOptions{}) + assert.NoError(t, err) + if testCase.listFunc != nil { + fc.PrependReactor("list", "*", testCase.listFunc) + } } - vmList, err := vms.List(context.Background(), metav1.ListOptions{}) + + vmServiceList, err := vms.List(context.Background(), metav1.ListOptions{}) if testCase.expectedErr { assert.Error(t, err) } else { assert.NoError(t, err) - assert.Equal(t, testCase.expectedVMNum, len(vmList.Items)) + assert.Equal(t, testCase.expectedVMServiceNum, len(vmServiceList.Items)) } }) } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go index 6e4eaa34e..76421fd35 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmoperator/interface.go @@ -9,6 +9,11 @@ import ( vmopv1alpha1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1" ) +// Interface has methods to work with Vmoperator resources. +type Interface interface { + V1alpha1() V1alpha1Interface +} + // V1alpha1Interface has methods to work with Vmoperator V1alpha1 resources. type V1alpha1Interface interface { Client() dynamic.Interface diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go index 3a477b1e7..ef4cd2342 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/types.go @@ -41,7 +41,7 @@ type VMService interface { // vmService takes care of mapping of LB type of service to VM service in supervisor cluster type vmService struct { - vmClient vmop.V1alpha1Interface + vmClient vmop.Interface namespace string ownerReference *metav1.OwnerReference } diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go index 4b9cd3ffc..bd014a294 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice.go @@ -88,12 +88,12 @@ var ( // GetVmopClient gets a vm-operator-api client // This is separate from NewVMService so that a fake client can be injected for testing -func GetVmopClient(config *rest.Config) (vmop.V1alpha1Interface, error) { +func GetVmopClient(config *rest.Config) (vmop.Interface, error) { return vmopclient.NewForConfig(config) } // NewVMService creates a vmService object -func NewVMService(vmClient vmop.V1alpha1Interface, ns string, ownerRef *metav1.OwnerReference) VMService { +func NewVMService(vmClient vmop.Interface, ns string, ownerRef *metav1.OwnerReference) VMService { return &vmService{ vmClient: vmClient, namespace: ns, @@ -129,7 +129,7 @@ func (s *vmService) Get(ctx context.Context, service *v1.Service, clusterName st logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to get VirtualMachineService") - vmService, err := s.vmClient.VirtualMachineServices(s.namespace).Get(ctx, s.GetVMServiceName(service, clusterName), metav1.GetOptions{}) + vmService, err := s.vmClient.V1alpha1().VirtualMachineServices(s.namespace).Get(ctx, s.GetVMServiceName(service, clusterName), metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { return nil, nil @@ -152,7 +152,7 @@ func (s *vmService) Create(ctx context.Context, service *v1.Service, clusterName return nil, err } - vmService, err = s.vmClient.VirtualMachineServices(s.namespace).Create(ctx, vmService, metav1.CreateOptions{}) + vmService, err = s.vmClient.V1alpha1().VirtualMachineServices(s.namespace).Create(ctx, vmService, metav1.CreateOptions{}) if err != nil { logger.Error(ErrCreateVMService, fmt.Sprintf("%v", err)) return nil, err @@ -250,7 +250,7 @@ func (s *vmService) Update(ctx context.Context, service *v1.Service, clusterName } if needsUpdate { - newVMService, err = s.vmClient.VirtualMachineServices(s.namespace).Update(ctx, newVMService, metav1.UpdateOptions{}) + newVMService, err = s.vmClient.V1alpha1().VirtualMachineServices(s.namespace).Update(ctx, newVMService, metav1.UpdateOptions{}) if err != nil { logger.Error(ErrUpdateVMService, fmt.Sprintf("%v", err)) return nil, err @@ -268,7 +268,7 @@ func (s *vmService) Delete(ctx context.Context, service *v1.Service, clusterName logger := log.WithValues("name", service.Name, "namespace", service.Namespace) logger.V(2).Info("Attempting to delete VirtualMachineService") - err := s.vmClient.VirtualMachineServices(s.namespace).Delete(ctx, s.GetVMServiceName(service, clusterName), metav1.DeleteOptions{}) + err := s.vmClient.V1alpha1().VirtualMachineServices(s.namespace).Delete(ctx, s.GetVMServiceName(service, clusterName), metav1.DeleteOptions{}) if err != nil { logger.Error(ErrDeleteVMService, fmt.Sprintf("%v", err)) return err diff --git a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go index 1f1c35237..2f8c8991b 100644 --- a/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/vmservice/vmservice_test.go @@ -79,7 +79,7 @@ func initTest() (*v1.Service, VMService, *dynamicfake.FakeDynamicClient) { scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - vms = NewVMService(vmopclient.NewFakeClient(fc), testClusterNameSpace, &testOwnerReference) + vms = NewVMService(vmopclient.NewFakeClientSet(fc), testClusterNameSpace, &testOwnerReference) return testK8sService, vms, fc } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone.go b/pkg/cloudprovider/vsphereparavirtual/zone.go index f0033a580..e0756c5ee 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone.go @@ -14,7 +14,7 @@ import ( ) type zones struct { - vmClient vmop.V1alpha1Interface + vmClient vmop.Interface namespace string } diff --git a/pkg/cloudprovider/vsphereparavirtual/zone_test.go b/pkg/cloudprovider/vsphereparavirtual/zone_test.go index 831f99290..ae8b972e7 100644 --- a/pkg/cloudprovider/vsphereparavirtual/zone_test.go +++ b/pkg/cloudprovider/vsphereparavirtual/zone_test.go @@ -135,12 +135,12 @@ func initVMopClient(testVM *vmopv1alpha1.VirtualMachine) (zones, *dynamicfake.Fa scheme := runtime.NewScheme() _ = vmopv1alpha1.AddToScheme(scheme) fc := dynamicfake.NewSimpleDynamicClient(scheme) - fcw := vmopclient.NewFakeClient(fc) + fcw := vmopclient.NewFakeClientSet(fc) zone := zones{ vmClient: fcw, namespace: testClusterNameSpace, } - _, err := fcw.VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) + _, err := fcw.V1alpha1().VirtualMachines(testVM.Namespace).Create(context.TODO(), testVM, metav1.CreateOptions{}) return zone, fc, err }