From 4a95a4d183aae42923ae25b8fc79dfcb5e44455e Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Mon, 3 Jun 2024 11:24:53 +0200 Subject: [PATCH 1/4] vm-operator: migrate to v1alpha2 --- .golangci.yml | 2 +- controllers/vmware/test/controllers_test.go | 20 +++-- controllers/vspheremachine_controller.go | 2 +- go.sum | 2 - .../test/helpers/vmware/unit_test_context.go | 2 +- .../fake/fake_controller_manager_context.go | 2 +- pkg/manager/manager.go | 2 +- pkg/services/interfaces.go | 2 +- pkg/services/network/constants.go | 22 +++-- pkg/services/network/dummy_provider.go | 2 +- pkg/services/network/netop_provider.go | 23 +++-- pkg/services/network/network_test.go | 56 +++++++----- pkg/services/network/nsxt_provider.go | 22 +++-- pkg/services/network/nsxt_vpc_provider.go | 23 +++-- .../vmoperator/control_plane_endpoint.go | 2 +- .../vmoperator/control_plane_endpoint_test.go | 2 +- pkg/services/vmoperator/resource_policy.go | 16 ++-- .../vmoperator/resource_policy_test.go | 2 +- pkg/services/vmoperator/vmopmachine.go | 88 +++++++++++++------ pkg/services/vmoperator/vmopmachine_test.go | 74 ++++++++++------ pkg/util/testutil.go | 2 +- 21 files changed, 241 insertions(+), 127 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 655c4b7fb3..5c34583064 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -120,7 +120,7 @@ linters-settings: - pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1 alias: vmwarev1 # VMware Operator - - pkg: "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + - pkg: "github.com/vmware-tanzu/vm-operator/api/v1alpha2" alias: vmoprv1 # CABPK - pkg: sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1 diff --git a/controllers/vmware/test/controllers_test.go b/controllers/vmware/test/controllers_test.go index 439616d59e..20dbed8600 100644 --- a/controllers/vmware/test/controllers_test.go +++ b/controllers/vmware/test/controllers_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -463,7 +463,7 @@ var _ = Describe("Reconciliation tests", func() { Eventually(func() error { return k8sClient.Get(ctx, rpKey, resourcePolicy) }, time.Second*30).Should(Succeed()) - Expect(len(resourcePolicy.Spec.ClusterModules)).To(BeEquivalentTo(2)) + Expect(len(resourcePolicy.Spec.ClusterModuleGroups)).To(BeEquivalentTo(2)) By("Create the CAPI Machine and wait for it to exist") machineKey, machine := deployCAPIMachine(ns.Name, cluster, k8sClient) @@ -636,7 +636,12 @@ var _ = Describe("Reconciliation tests", func() { } // These two lines must be initialized as requirements of having valid Status newVM.Status.Volumes = []vmoprv1.VirtualMachineVolumeStatus{} - newVM.Status.Phase = vmoprv1.Created + newVM.Status.Conditions = append(newVM.Status.Conditions, metav1.Condition{ + Type: vmoprv1.VirtualMachineConditionCreated, + Status: metav1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now().UTC().Truncate(time.Second)), + Reason: string(metav1.ConditionTrue), + }) return k8sClient.Status().Update(ctx, newVM) }, time.Second*30).Should(Succeed()) @@ -649,7 +654,7 @@ var _ = Describe("Reconciliation tests", func() { if err != nil { return err } - newVM.Status.PowerState = vmoprv1.VirtualMachinePoweredOn + newVM.Status.PowerState = vmoprv1.VirtualMachinePowerStateOn return k8sClient.Status().Update(ctx, newVM) }, time.Second*30).Should(Succeed()) @@ -662,7 +667,10 @@ var _ = Describe("Reconciliation tests", func() { if err != nil { return err } - newVM.Status.VmIp = "1.2.3.4" + if newVM.Status.Network == nil { + newVM.Status.Network = &vmoprv1.VirtualMachineNetworkStatus{} + } + newVM.Status.Network.PrimaryIP4 = "1.2.3.4" newVM.Status.BiosUUID = "test-bios-uuid" return k8sClient.Status().Update(ctx, newVM) }, time.Second*30).Should(Succeed()) @@ -675,7 +683,7 @@ var _ = Describe("Reconciliation tests", func() { // control_plane_endpoint_test.go if !isLB { By("Expect the Cluster to have the IP from the VM as an APIEndpoint") - assertEventuallyControlPlaneEndpoint(infraClusterKey, infraCluster, newVM.Status.VmIp) + assertEventuallyControlPlaneEndpoint(infraClusterKey, infraCluster, newVM.Status.Network.PrimaryIP4) } }, Entry("With no load balancer", dontUseLoadBalancer), diff --git a/controllers/vspheremachine_controller.go b/controllers/vspheremachine_controller.go index 77535d6445..894f15ce35 100644 --- a/controllers/vspheremachine_controller.go +++ b/controllers/vspheremachine_controller.go @@ -23,7 +23,7 @@ import ( "time" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/go.sum b/go.sum index 8397df21f7..ca7f407fc9 100644 --- a/go.sum +++ b/go.sum @@ -556,8 +556,6 @@ github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9 github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9505/go.mod h1:5rqRJ9zGR+KnKbkGx373WgN8xJpvAj99kHnfoDYRO5I= github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 h1:/6vFL20UMHOeTf/mb+dKf5sFG0FBbyrCBY/71QKAIE0= github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505/go.mod h1:dfYrWS8DMRN+XZfhu8M4LVHmeGvYB29Ipd7j4uIq+mU= -github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 h1:LRMZ+zzb944d6r+uYsE+CuJ3zVBE6Hc8vjH7IJX2QY4= -github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505/go.mod h1:M+6bZCS8vSjCN9OOppnAyYxeBxY1U0wG6+j3CvIrOHY= github.com/vmware/govmomi v0.38.0 h1:UvQpLAOjDpO0JUxoPCXnEzOlEa/9kejO6K58qOFr6cM= github.com/vmware/govmomi v0.38.0/go.mod h1:mtGWtM+YhTADHlCgJBiskSRPOZRsN9MSjPzaZLte/oQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= diff --git a/internal/test/helpers/vmware/unit_test_context.go b/internal/test/helpers/vmware/unit_test_context.go index cf38be6c49..63d56de7f7 100644 --- a/internal/test/helpers/vmware/unit_test_context.go +++ b/internal/test/helpers/vmware/unit_test_context.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/context/fake/fake_controller_manager_context.go b/pkg/context/fake/fake_controller_manager_context.go index c93bc0291a..6d4974cef2 100644 --- a/pkg/context/fake/fake_controller_manager_context.go +++ b/pkg/context/fake/fake_controller_manager_context.go @@ -17,7 +17,7 @@ limitations under the License. package fake import ( - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index db690296b7..5085e0a344 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -23,7 +23,7 @@ import ( "github.com/pkg/errors" netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" nsxopv1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1" "gopkg.in/fsnotify.v1" diff --git a/pkg/services/interfaces.go b/pkg/services/interfaces.go index 7b3060caf0..df4685cddb 100644 --- a/pkg/services/interfaces.go +++ b/pkg/services/interfaces.go @@ -19,7 +19,7 @@ package services import ( "context" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" diff --git a/pkg/services/network/constants.go b/pkg/services/network/constants.go index 68eb6b1f1e..902c8d24ce 100644 --- a/pkg/services/network/constants.go +++ b/pkg/services/network/constants.go @@ -17,14 +17,15 @@ limitations under the License. // Package network contains code for configuring network services. package network +import ( + netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" + nsxopv1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1" + ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" +) + const ( - // NSXTTypeNetwork is the name of the NSX-T network type. - NSXTTypeNetwork = "nsx-t" // NSXTVNetSelectorKey is also defined in VM Operator. NSXTVNetSelectorKey = "ncp.vmware.com/virtual-network-name" - // NSXTVPCSubnetSetNetworkType is the name of the NSX VPC network type. Please refer to: - // https://github.com/vmware-tanzu/vm-operator/blob/main/api/v1alpha1/virtualmachine_types.go#L149. - NSXTVPCSubnetSetNetworkType = "nsx-t-subnetset" // CAPVDefaultNetworkLabel is a label used to identify the default network. CAPVDefaultNetworkLabel = "capv.vmware.com/is-default-network" @@ -39,3 +40,14 @@ const ( // Deprecated: legacyDefaultNetworkLabel will be removed in a future release. legacyDefaultNetworkLabel = "capw.vmware.com/is-default-network" ) + +var ( + // NetworkGVKNetOperator is the GVK used for networks in net-operator mode. + NetworkGVKNetOperator = netopv1.SchemeGroupVersion.WithKind("Network") + + // NetworkGVKNSXT is the GVK used for networks in NSX-T mode. + NetworkGVKNSXT = ncpv1.SchemeGroupVersion.WithKind("VirtualNetwork") + + // NetworkGVKNSXTVPC is the GVK used for networks in NSX-T VPC mode. + NetworkGVKNSXTVPC = nsxopv1.SchemeGroupVersion.WithKind("SubnetSet") +) diff --git a/pkg/services/network/dummy_provider.go b/pkg/services/network/dummy_provider.go index 387df7b1f1..ef6578ffc3 100644 --- a/pkg/services/network/dummy_provider.go +++ b/pkg/services/network/dummy_provider.go @@ -19,7 +19,7 @@ package network import ( "context" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context/vmware" diff --git a/pkg/services/network/netop_provider.go b/pkg/services/network/netop_provider.go index 9b8cc40736..f4f6757bf8 100644 --- a/pkg/services/network/netop_provider.go +++ b/pkg/services/network/netop_provider.go @@ -21,7 +21,9 @@ import ( "fmt" netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" + vmoprv1common "github.com/vmware-tanzu/vm-operator/api/v1alpha2/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" @@ -122,16 +124,25 @@ func (np *netopNetworkProvider) ConfigureVirtualMachine(ctx context.Context, clu return err } - for _, vnif := range vm.Spec.NetworkInterfaces { - if vnif.NetworkType == string(network.Spec.Type) && vnif.NetworkName == network.Name { + if vm.Spec.Network == nil { + vm.Spec.Network = &vmoprv1.VirtualMachineNetworkSpec{} + } + for _, vnif := range vm.Spec.Network.Interfaces { + if vnif.Network.TypeMeta.GroupVersionKind() == NetworkGVKNetOperator && vnif.Network.Name == network.Name { // Expected network interface already exists. return nil } } - vm.Spec.NetworkInterfaces = append(vm.Spec.NetworkInterfaces, vmoprv1.VirtualMachineNetworkInterface{ - NetworkName: network.Name, - NetworkType: string(network.Spec.Type), + vm.Spec.Network.Interfaces = append(vm.Spec.Network.Interfaces, vmoprv1.VirtualMachineNetworkInterfaceSpec{ + Name: fmt.Sprintf("eth%d", len(vm.Spec.Network.Interfaces)), + Network: vmoprv1common.PartialObjectRef{ + TypeMeta: metav1.TypeMeta{ + Kind: NetworkGVKNetOperator.Kind, + APIVersion: NetworkGVKNetOperator.GroupVersion().String(), + }, + Name: network.Name, + }, }) return nil diff --git a/pkg/services/network/network_test.go b/pkg/services/network/network_test.go index 817862723e..a9a84813f7 100644 --- a/pkg/services/network/network_test.go +++ b/pkg/services/network/network_test.go @@ -23,9 +23,9 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - netopv1alpha1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" + netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" nsxopv1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -165,23 +165,23 @@ var _ = Describe("Network provider", func() { }) It("should not add network interface", func() { Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces).To(BeNil()) + Expect(vm.Spec.Network).To(BeNil()) }) }) Context("with netop network provider", func() { - var defaultNetwork *netopv1alpha1.Network + var defaultNetwork *netopv1.Network testWithLabelFunc := func(label string) { BeforeEach(func() { - defaultNetwork = &netopv1alpha1.Network{ + defaultNetwork = &netopv1.Network{ ObjectMeta: metav1.ObjectMeta{ Name: "dummy-network", Namespace: dummyNs, Labels: map[string]string{label: "true"}, }, - Spec: netopv1alpha1.NetworkSpec{ - Type: netopv1alpha1.NetworkTypeVDS, + Spec: netopv1.NetworkSpec{ + Type: netopv1.NetworkTypeVDS, }, } }) @@ -189,15 +189,17 @@ var _ = Describe("Network provider", func() { Context("ConfigureVirtualMachine", func() { BeforeEach(func() { scheme := runtime.NewScheme() - Expect(netopv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(netopv1.AddToScheme(scheme)).To(Succeed()) client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(defaultNetwork).Build() np = NetOpNetworkProvider(client) }) AfterEach(func() { Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces).To(HaveLen(1)) - Expect(vm.Spec.NetworkInterfaces[0].NetworkType).To(Equal("vsphere-distributed")) + Expect(vm.Spec.Network).ToNot(BeNil()) + Expect(vm.Spec.Network.Interfaces).To(HaveLen(1)) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.Kind).To(Equal("Network")) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.APIVersion).To(Equal(netopv1.SchemeGroupVersion.String())) }) It("should add vds type network interface", func() { @@ -233,8 +235,11 @@ var _ = Describe("Network provider", func() { }) AfterEach(func() { Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces[0].NetworkName).To(Equal(GetNSXTVirtualNetworkName(vSphereCluster.Name))) - Expect(vm.Spec.NetworkInterfaces[0].NetworkType).To(Equal("nsx-t")) + Expect(vm.Spec.Network).ToNot(BeNil()) + Expect(vm.Spec.Network.Interfaces).To(HaveLen(1)) + Expect(vm.Spec.Network.Interfaces[0].Network.Name).To(Equal(GetNSXTVirtualNetworkName(vSphereCluster.Name))) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.Kind).To(Equal("VirtualNetwork")) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.APIVersion).To(Equal(ncpv1.SchemeGroupVersion.String())) }) }) @@ -249,19 +254,24 @@ var _ = Describe("Network provider", func() { It("should add nsx-t-subnetset type network interface", func() { err = np.ConfigureVirtualMachine(ctx, clusterCtx, vm) Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces).To(HaveLen(1)) + Expect(vm.Spec.Network.Interfaces).To(HaveLen(1)) }) It("nsx-t-subnetset type network interface already exists", func() { err = np.ConfigureVirtualMachine(ctx, clusterCtx, vm) Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces).To(HaveLen(1)) + Expect(vm.Spec.Network).ToNot(BeNil()) + Expect(vm.Spec.Network.Interfaces).To(HaveLen(1)) }) AfterEach(func() { Expect(err).ToNot(HaveOccurred()) - Expect(vm.Spec.NetworkInterfaces[0].NetworkName).To(Equal(vSphereCluster.Name)) - Expect(vm.Spec.NetworkInterfaces[0].NetworkType).To(Equal("nsx-t-subnetset")) + Expect(vm.Spec.Network).ToNot(BeNil()) + Expect(vm.Spec.Network.Interfaces).To(HaveLen(1)) + Expect(vm.Spec.Network.Interfaces[0].Network.Name).To(Equal(vSphereCluster.Name)) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.Kind).To(Equal("SubnetSet")) + Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.APIVersion).To(Equal(nsxopv1.SchemeGroupVersion.String())) + // TODO(chrischdi): also assert group version }) }) }) @@ -348,7 +358,7 @@ var _ = Describe("Network provider", func() { Context("with netop network provider", func() { BeforeEach(func() { scheme := runtime.NewScheme() - Expect(netopv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(netopv1.AddToScheme(scheme)).To(Succeed()) client = fake.NewClientBuilder().WithScheme(scheme).Build() np = NetOpNetworkProvider(client) }) @@ -744,22 +754,22 @@ var _ = Describe("Network provider", func() { Context("GetVMServiceAnnotations", func() { Context("with netop network provider", func() { - var defaultNetwork *netopv1alpha1.Network + var defaultNetwork *netopv1.Network testWithLabelFunc := func(label string) { BeforeEach(func() { - defaultNetwork = &netopv1alpha1.Network{ + defaultNetwork = &netopv1.Network{ ObjectMeta: metav1.ObjectMeta{ Name: "dummy-network", Namespace: dummyNs, Labels: map[string]string{label: "true"}, }, - Spec: netopv1alpha1.NetworkSpec{ - Type: netopv1alpha1.NetworkTypeVDS, + Spec: netopv1.NetworkSpec{ + Type: netopv1.NetworkTypeVDS, }, } scheme := runtime.NewScheme() - Expect(netopv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(netopv1.AddToScheme(scheme)).To(Succeed()) client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(defaultNetwork).Build() np = NetOpNetworkProvider(client) }) @@ -810,7 +820,7 @@ var _ = Describe("Network provider", func() { Context("with netop network provider", func() { BeforeEach(func() { scheme := runtime.NewScheme() - Expect(netopv1alpha1.AddToScheme(scheme)).To(Succeed()) + Expect(netopv1.AddToScheme(scheme)).To(Succeed()) client := fake.NewClientBuilder().WithScheme(scheme).Build() np = NetOpNetworkProvider(client) }) diff --git a/pkg/services/network/nsxt_provider.go b/pkg/services/network/nsxt_provider.go index 7cde4b7dc6..5a15d89605 100644 --- a/pkg/services/network/nsxt_provider.go +++ b/pkg/services/network/nsxt_provider.go @@ -21,7 +21,8 @@ import ( "fmt" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" + vmoprv1common "github.com/vmware-tanzu/vm-operator/api/v1alpha2/common" ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -187,15 +188,24 @@ func (np *nsxtNetworkProvider) GetVMServiceAnnotations(ctx context.Context, clus // ConfigureVirtualMachine configures a VirtualMachine object based on the networking configuration. func (np *nsxtNetworkProvider) ConfigureVirtualMachine(_ context.Context, clusterCtx *vmware.ClusterContext, vm *vmoprv1.VirtualMachine) error { nsxtClusterNetworkName := GetNSXTVirtualNetworkName(clusterCtx.VSphereCluster.Name) - for _, vnif := range vm.Spec.NetworkInterfaces { - if vnif.NetworkType == NSXTTypeNetwork && vnif.NetworkName == nsxtClusterNetworkName { + if vm.Spec.Network == nil { + vm.Spec.Network = &vmoprv1.VirtualMachineNetworkSpec{} + } + for _, vnif := range vm.Spec.Network.Interfaces { + if vnif.Network.TypeMeta.GroupVersionKind() == NetworkGVKNSXT && vnif.Network.Name == nsxtClusterNetworkName { // expected network interface is already found return nil } } - vm.Spec.NetworkInterfaces = append(vm.Spec.NetworkInterfaces, vmoprv1.VirtualMachineNetworkInterface{ - NetworkName: nsxtClusterNetworkName, - NetworkType: NSXTTypeNetwork, + vm.Spec.Network.Interfaces = append(vm.Spec.Network.Interfaces, vmoprv1.VirtualMachineNetworkInterfaceSpec{ + Name: fmt.Sprintf("eth%d", len(vm.Spec.Network.Interfaces)), + Network: vmoprv1common.PartialObjectRef{ + TypeMeta: metav1.TypeMeta{ + Kind: NetworkGVKNSXT.Kind, + APIVersion: NetworkGVKNSXT.GroupVersion().String(), + }, + Name: nsxtClusterNetworkName, + }, }) return nil } diff --git a/pkg/services/network/nsxt_vpc_provider.go b/pkg/services/network/nsxt_vpc_provider.go index 621937691a..b9fd24349d 100644 --- a/pkg/services/network/nsxt_vpc_provider.go +++ b/pkg/services/network/nsxt_vpc_provider.go @@ -22,7 +22,8 @@ import ( "github.com/pkg/errors" nsxopv1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" + vmoprv1common "github.com/vmware-tanzu/vm-operator/api/v1alpha2/common" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -173,15 +174,25 @@ func (vp *nsxtVPCNetworkProvider) GetVMServiceAnnotations(_ context.Context, _ * // ConfigureVirtualMachine configures a VirtualMachine object based on the networking configuration. func (vp *nsxtVPCNetworkProvider) ConfigureVirtualMachine(_ context.Context, clusterCtx *vmware.ClusterContext, vm *vmoprv1.VirtualMachine) error { networkName := clusterCtx.VSphereCluster.Name - for _, vnif := range vm.Spec.NetworkInterfaces { - if vnif.NetworkType == NSXTVPCSubnetSetNetworkType && vnif.NetworkName == networkName { + if vm.Spec.Network == nil { + vm.Spec.Network = &vmoprv1.VirtualMachineNetworkSpec{} + } + for _, vnif := range vm.Spec.Network.Interfaces { + if vnif.Network.TypeMeta.GroupVersionKind() == NetworkGVKNSXTVPC && vnif.Network.Name == networkName { // expected network interface is already found return nil } } - vm.Spec.NetworkInterfaces = append(vm.Spec.NetworkInterfaces, vmoprv1.VirtualMachineNetworkInterface{ - NetworkName: networkName, - NetworkType: NSXTVPCSubnetSetNetworkType, + + vm.Spec.Network.Interfaces = append(vm.Spec.Network.Interfaces, vmoprv1.VirtualMachineNetworkInterfaceSpec{ + Name: fmt.Sprintf("eth%d", len(vm.Spec.Network.Interfaces)), + Network: vmoprv1common.PartialObjectRef{ + TypeMeta: metav1.TypeMeta{ + Kind: NetworkGVKNSXTVPC.Kind, + APIVersion: NetworkGVKNSXTVPC.GroupVersion().String(), + }, + Name: networkName, + }, }) return nil } diff --git a/pkg/services/vmoperator/control_plane_endpoint.go b/pkg/services/vmoperator/control_plane_endpoint.go index 7ad550f0a7..e3ed22b27b 100644 --- a/pkg/services/vmoperator/control_plane_endpoint.go +++ b/pkg/services/vmoperator/control_plane_endpoint.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2" diff --git a/pkg/services/vmoperator/control_plane_endpoint_test.go b/pkg/services/vmoperator/control_plane_endpoint_test.go index cc9583bfd2..d8e3542158 100644 --- a/pkg/services/vmoperator/control_plane_endpoint_test.go +++ b/pkg/services/vmoperator/control_plane_endpoint_test.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/services/vmoperator/resource_policy.go b/pkg/services/vmoperator/resource_policy.go index 3cb87b4141..61fd255e02 100644 --- a/pkg/services/vmoperator/resource_policy.go +++ b/pkg/services/vmoperator/resource_policy.go @@ -20,7 +20,7 @@ import ( "context" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -78,16 +78,10 @@ func (s *RPService) createVirtualMachineSetResourcePolicy(ctx context.Context, c ResourcePool: vmoprv1.ResourcePoolSpec{ Name: clusterCtx.Cluster.Name, }, - Folder: vmoprv1.FolderSpec{ - Name: clusterCtx.Cluster.Name, - }, - ClusterModules: []vmoprv1.ClusterModuleSpec{ - { - GroupName: ControlPlaneVMClusterModuleGroupName, - }, - { - GroupName: getMachineDeploymentNameForCluster(clusterCtx.Cluster), - }, + Folder: clusterCtx.Cluster.Name, + ClusterModuleGroups: []string{ + ControlPlaneVMClusterModuleGroupName, + getMachineDeploymentNameForCluster(clusterCtx.Cluster), }, } // Ensure that the VirtualMachineSetResourcePolicy is owned by the VSphereCluster diff --git a/pkg/services/vmoperator/resource_policy_test.go b/pkg/services/vmoperator/resource_policy_test.go index 25c5f9c95f..b2f0529057 100644 --- a/pkg/services/vmoperator/resource_policy_test.go +++ b/pkg/services/vmoperator/resource_policy_test.go @@ -47,6 +47,6 @@ func TestRPService(t *testing.T) { resourcePolicy, err := rpService.getVirtualMachineSetResourcePolicy(ctx, clusterCtx) g.Expect(err).NotTo(HaveOccurred()) g.Expect(resourcePolicy.Spec.ResourcePool.Name).To(Equal(clusterName)) - g.Expect(resourcePolicy.Spec.Folder.Name).To(Equal(clusterName)) + g.Expect(resourcePolicy.Spec.Folder).To(Equal(clusterName)) }) } diff --git a/pkg/services/vmoperator/vmopmachine.go b/pkg/services/vmoperator/vmopmachine.go index c7effe0ebe..8c756a0a27 100644 --- a/pkg/services/vmoperator/vmopmachine.go +++ b/pkg/services/vmoperator/vmopmachine.go @@ -22,9 +22,11 @@ import ( "fmt" "github.com/pkg/errors" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" + vmoprv1common "github.com/vmware-tanzu/vm-operator/api/v1alpha2/common" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" @@ -201,15 +203,22 @@ func (v *VmopMachineService) ReconcileNormal(ctx context.Context, machineCtx cap // Update the VM's state to Pending supervisorMachineCtx.VSphereMachine.Status.VMStatus = vmwarev1.VirtualMachineStatePending - // Since vm operator only has one condition for now, we can't set vspheremachine's condition fully based on virtualmachine's - // condition. Once vm operator surfaces enough conditions in virtualmachine, we could simply mirror the conditions in vspheremachine. - // For now, we set conditions based on the whole virtualmachine status. - // TODO: vm-operator does not use the cluster-api condition type. so can't use cluster-api util functions to fetch the condition - for _, cond := range vmOperatorVM.Status.Conditions { - if cond.Type == vmoprv1.VirtualMachinePrereqReadyCondition && cond.Severity == vmoprv1.ConditionSeverityError { - conditions.MarkFalse(supervisorMachineCtx.VSphereMachine, infrav1.VMProvisionedCondition, cond.Reason, clusterv1.ConditionSeverityError, cond.Message) - return false, errors.Errorf("vm prerequisites check fails: %s", supervisorMachineCtx) + // VM operator has four conditions which indicate pre-requirements for creation are done. + // If one of them is set to false then it hit an error case and the information bubbles up + // to the VMProvisionedCondition. + for _, condition := range []string{ + vmoprv1.VirtualMachineConditionClassReady, + vmoprv1.VirtualMachineConditionImageReady, + vmoprv1.VirtualMachineConditionVMSetResourcePolicyReady, + vmoprv1.VirtualMachineConditionBootstrapReady, + } { + c := meta.FindStatusCondition(vmOperatorVM.Status.Conditions, condition) + // If the condition is not set to false then VM is still getting provisioned and the condition gets added at a later stage. + if c == nil || c.Status != metav1.ConditionFalse { + continue } + conditions.MarkFalse(supervisorMachineCtx.VSphereMachine, infrav1.VMProvisionedCondition, c.Reason, clusterv1.ConditionSeverityError, c.Message) + return false, errors.Errorf("vm prerequisites check failed for condition %s: %s", condition, supervisorMachineCtx) } // Requeue until the VM Operator VirtualMachine has: @@ -217,7 +226,7 @@ func (v *VmopMachineService) ReconcileNormal(ctx context.Context, machineCtx cap // * Been powered on // * An IP address // * A BIOS UUID - if vmOperatorVM.Status.Phase != vmoprv1.Created { + if !meta.IsStatusConditionTrue(vmOperatorVM.Status.Conditions, vmoprv1.VirtualMachineConditionCreated) { conditions.MarkFalse(supervisorMachineCtx.VSphereMachine, infrav1.VMProvisionedCondition, vmwarev1.VMProvisionStartedReason, clusterv1.ConditionSeverityInfo, "") log.Info(fmt.Sprintf("VM is not yet created: %s", supervisorMachineCtx)) return true, nil @@ -225,7 +234,7 @@ func (v *VmopMachineService) ReconcileNormal(ctx context.Context, machineCtx cap // Mark the VM as created supervisorMachineCtx.VSphereMachine.Status.VMStatus = vmwarev1.VirtualMachineStateCreated - if vmOperatorVM.Status.PowerState != vmoprv1.VirtualMachinePoweredOn { + if vmOperatorVM.Status.PowerState != vmoprv1.VirtualMachinePowerStateOn { conditions.MarkFalse(supervisorMachineCtx.VSphereMachine, infrav1.VMProvisionedCondition, vmwarev1.PoweringOnReason, clusterv1.ConditionSeverityInfo, "") log.Info(fmt.Sprintf("VM is not yet powered on: %s", supervisorMachineCtx)) return true, nil @@ -233,7 +242,7 @@ func (v *VmopMachineService) ReconcileNormal(ctx context.Context, machineCtx cap // Mark the VM as poweredOn supervisorMachineCtx.VSphereMachine.Status.VMStatus = vmwarev1.VirtualMachineStatePoweredOn - if vmOperatorVM.Status.VmIp == "" { + if vmOperatorVM.Status.Network == nil || (vmOperatorVM.Status.Network.PrimaryIP4 == "" && vmOperatorVM.Status.Network.PrimaryIP6 == "") { conditions.MarkFalse(supervisorMachineCtx.VSphereMachine, infrav1.VMProvisionedCondition, vmwarev1.WaitingForNetworkAddressReason, clusterv1.ConditionSeverityInfo, "") log.Info(fmt.Sprintf("VM does not have an IP address: %s", supervisorMachineCtx)) return true, nil @@ -325,15 +334,37 @@ func (v *VmopMachineService) reconcileVMOperatorVM(ctx context.Context, supervis if vmOperatorVM.Spec.StorageClass == "" { vmOperatorVM.Spec.StorageClass = supervisorMachineCtx.VSphereMachine.Spec.StorageClass } - vmOperatorVM.Spec.PowerState = vmoprv1.VirtualMachinePoweredOn - if vmOperatorVM.Spec.ResourcePolicyName == "" { - vmOperatorVM.Spec.ResourcePolicyName = supervisorMachineCtx.VSphereCluster.Status.ResourcePolicyName + vmOperatorVM.Spec.PowerState = vmoprv1.VirtualMachinePowerStateOn + if vmOperatorVM.Spec.Reserved == nil { + vmOperatorVM.Spec.Reserved = &vmoprv1.VirtualMachineReservedSpec{} } - vmOperatorVM.Spec.VmMetadata = &vmoprv1.VirtualMachineMetadata{ - SecretName: dataSecretName, - Transport: vmoprv1.VirtualMachineMetadataCloudInitTransport, + if vmOperatorVM.Spec.Reserved.ResourcePolicyName == "" { + vmOperatorVM.Spec.Reserved.ResourcePolicyName = supervisorMachineCtx.VSphereCluster.Status.ResourcePolicyName } - vmOperatorVM.Spec.PowerOffMode = vmoprv1.VirtualMachinePowerOpMode(supervisorMachineCtx.VSphereMachine.Spec.PowerOffMode) + if vmOperatorVM.Spec.Bootstrap == nil { + vmOperatorVM.Spec.Bootstrap = &vmoprv1.VirtualMachineBootstrapSpec{} + } + vmOperatorVM.Spec.Bootstrap.CloudInit = &vmoprv1.VirtualMachineBootstrapCloudInitSpec{ + RawCloudConfig: &vmoprv1common.SecretKeySelector{ + Name: dataSecretName, + Key: "user-data", + }, + } + if supervisorMachineCtx.VSphereMachine.Spec.PowerOffMode != "" { + var powerOffMode vmoprv1.VirtualMachinePowerOpMode + switch supervisorMachineCtx.VSphereMachine.Spec.PowerOffMode { + case vmwarev1.VirtualMachinePowerOpModeHard: + powerOffMode = vmoprv1.VirtualMachinePowerOpModeHard + case vmwarev1.VirtualMachinePowerOpModeSoft: + powerOffMode = vmoprv1.VirtualMachinePowerOpModeSoft + case vmwarev1.VirtualMachinePowerOpModeTrySoft: + powerOffMode = vmoprv1.VirtualMachinePowerOpModeTrySoft + default: + return fmt.Errorf("unable to map PowerOffMode %q to vm-operator equivalent", supervisorMachineCtx.VSphereMachine.Spec.PowerOffMode) + } + vmOperatorVM.Spec.PowerOffMode = powerOffMode + } + if vmOperatorVM.Spec.MinHardwareVersion == 0 { vmOperatorVM.Spec.MinHardwareVersion = minHardwareVersion } @@ -350,7 +381,7 @@ func (v *VmopMachineService) reconcileVMOperatorVM(ctx context.Context, supervis // readiness probes. The flag PerformsVMReadinessProbe is used to determine // whether a VM readiness probe should be conducted. if v.ConfigureControlPlaneVMReadinessProbe && infrautilv1.IsControlPlaneMachine(supervisorMachineCtx.Machine) && supervisorMachineCtx.Cluster.Status.ControlPlaneReady { - vmOperatorVM.Spec.ReadinessProbe = &vmoprv1.Probe{ + vmOperatorVM.Spec.ReadinessProbe = &vmoprv1.VirtualMachineReadinessProbeSpec{ TCPSocket: &vmoprv1.TCPSocketAction{ Port: intstr.FromInt(defaultAPIBindPort), }, @@ -397,11 +428,14 @@ func (v *VmopMachineService) reconcileVMOperatorVM(ctx context.Context, supervis } func (v *VmopMachineService) reconcileNetwork(supervisorMachineCtx *vmware.SupervisorMachineContext, vm *vmoprv1.VirtualMachine) bool { - if vm.Status.VmIp == "" { + if vm.Status.Network.PrimaryIP4 == "" && vm.Status.Network.PrimaryIP6 == "" { return false } - supervisorMachineCtx.VSphereMachine.Status.IPAddr = vm.Status.VmIp + supervisorMachineCtx.VSphereMachine.Status.IPAddr = vm.Status.Network.PrimaryIP4 + if supervisorMachineCtx.VSphereMachine.Status.IPAddr == "" { + supervisorMachineCtx.VSphereMachine.Status.IPAddr = vm.Status.Network.PrimaryIP6 + } return true } @@ -494,10 +528,12 @@ func addVolume(vm *vmoprv1.VirtualMachine, name string) { vm.Spec.Volumes = append(vm.Spec.Volumes, vmoprv1.VirtualMachineVolume{ Name: name, - PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: name, - ReadOnly: false, + VirtualMachineVolumeSource: vmoprv1.VirtualMachineVolumeSource{ + PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ + PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: name, + ReadOnly: false, + }, }, }, }) diff --git a/pkg/services/vmoperator/vmopmachine_test.go b/pkg/services/vmoperator/vmopmachine_test.go index 063023c441..7e3f5f6437 100644 --- a/pkg/services/vmoperator/vmopmachine_test.go +++ b/pkg/services/vmoperator/vmopmachine_test.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" @@ -147,9 +147,10 @@ var _ = Describe("VirtualMachine tests", func() { Expect(vmopVM.Spec.ImageName).To(Equal(expectedImageName)) Expect(vmopVM.Spec.ClassName).To(Equal(className)) Expect(vmopVM.Spec.StorageClass).To(Equal(storageClass)) - Expect(vmopVM.Spec.ResourcePolicyName).To(Equal(resourcePolicyName)) + Expect(vmopVM.Spec.Reserved).ToNot(BeNil()) + Expect(vmopVM.Spec.Reserved.ResourcePolicyName).To(Equal(resourcePolicyName)) Expect(vmopVM.Spec.MinHardwareVersion).To(Equal(minHardwareVersion)) - Expect(vmopVM.Spec.PowerState).To(Equal(vmoprv1.VirtualMachinePoweredOn)) + Expect(vmopVM.Spec.PowerState).To(Equal(vmoprv1.VirtualMachinePowerStateOn)) Expect(vmopVM.ObjectMeta.Annotations[ClusterModuleNameAnnotationKey]).To(Equal(ControlPlaneVMClusterModuleGroupName)) Expect(vmopVM.ObjectMeta.Annotations[ProviderTagsAnnotationKey]).To(Equal(ControlPlaneVMVMAntiAffinityTagValue)) @@ -229,7 +230,12 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator creating a vSphere VM By("vSphere VM is created") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.Phase = vmoprv1.Created + vmopVM.Status.Conditions = append(vmopVM.Status.Conditions, metav1.Condition{ + Type: vmoprv1.VirtualMachineConditionCreated, + Status: metav1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now().UTC().Truncate(time.Second)), + Reason: string(metav1.ConditionTrue), + }) updateReconciledVMStatus(ctx, vmService, vmopVM) expectedState = vmwarev1.VirtualMachineStateCreated // we expect the reconciliation waiting for VM to be powered on @@ -240,7 +246,7 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator powering on the VM By("VirtualMachine is powered on") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.PowerState = vmoprv1.VirtualMachinePoweredOn + vmopVM.Status.PowerState = vmoprv1.VirtualMachinePowerStateOn updateReconciledVMStatus(ctx, vmService, vmopVM) expectedState = vmwarev1.VirtualMachineStatePoweredOn // we expect the reconciliation waiting for VM to have an IP @@ -251,7 +257,10 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator assigning an IP address By("VirtualMachine has an IP address") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.VmIp = vmIP + if vmopVM.Status.Network == nil { + vmopVM.Status.Network = &vmoprv1.VirtualMachineNetworkStatus{} + } + vmopVM.Status.Network.PrimaryIP4 = vmIP updateReconciledVMStatus(ctx, vmService, vmopVM) // we expect the reconciliation waiting for VM to have a BIOS UUID expectedConditions[0].Reason = vmwarev1.WaitingForBIOSUUIDReason @@ -340,7 +349,12 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator creating a vSphere VM By("vSphere VM is created") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.Phase = vmoprv1.Created + vmopVM.Status.Conditions = append(vmopVM.Status.Conditions, metav1.Condition{ + Type: vmoprv1.VirtualMachineConditionCreated, + Status: metav1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now().UTC().Truncate(time.Second)), + Reason: string(metav1.ConditionTrue), + }) updateReconciledVMStatus(ctx, vmService, vmopVM) expectedState = vmwarev1.VirtualMachineStateCreated expectedConditions[0].Reason = vmwarev1.PoweringOnReason @@ -350,7 +364,7 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator powering on the VM By("VirtualMachine is powered on") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.PowerState = vmoprv1.VirtualMachinePoweredOn + vmopVM.Status.PowerState = vmoprv1.VirtualMachinePowerStateOn updateReconciledVMStatus(ctx, vmService, vmopVM) expectedState = vmwarev1.VirtualMachineStatePoweredOn expectedConditions[0].Reason = vmwarev1.WaitingForNetworkAddressReason @@ -360,7 +374,10 @@ var _ = Describe("VirtualMachine tests", func() { // Simulate VMOperator assigning an IP address By("VirtualMachine has an IP address") vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.VmIp = vmIP + if vmopVM.Status.Network == nil { + vmopVM.Status.Network = &vmoprv1.VirtualMachineNetworkStatus{} + } + vmopVM.Status.Network.PrimaryIP4 = vmIP updateReconciledVMStatus(ctx, vmService, vmopVM) expectedConditions[0].Reason = vmwarev1.WaitingForBIOSUUIDReason requeue, err = vmService.ReconcileNormal(ctx, supervisorMachineContext) @@ -388,7 +405,10 @@ var _ = Describe("VirtualMachine tests", func() { cluster.Status.ControlPlaneReady = true vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) - vmopVM.Status.VmIp = vmIP + if vmopVM.Status.Network == nil { + vmopVM.Status.Network = &vmoprv1.VirtualMachineNetworkStatus{} + } + vmopVM.Status.Network.PrimaryIP4 = vmIP updateReconciledVMStatus(ctx, vmService, vmopVM) requeue, err = vmService.ReconcileNormal(ctx, supervisorMachineContext) verifyOutput(supervisorMachineContext) @@ -430,12 +450,12 @@ var _ = Describe("VirtualMachine tests", func() { requeue, err = vmService.ReconcileNormal(ctx, supervisorMachineContext) vmopVM = getReconciledVM(ctx, vmService, supervisorMachineContext) errMessage := "TestVirtualMachineClassBinding not found" - vmopVM.Status.Conditions = append(vmopVM.Status.Conditions, vmoprv1.Condition{ - Type: vmoprv1.VirtualMachinePrereqReadyCondition, - Status: corev1.ConditionFalse, - Reason: vmoprv1.VirtualMachineClassBindingNotFoundReason, - Severity: vmoprv1.ConditionSeverityError, - Message: errMessage, + vmopVM.Status.Conditions = append(vmopVM.Status.Conditions, metav1.Condition{ + Type: vmoprv1.VirtualMachineConditionClassReady, + Status: metav1.ConditionFalse, + LastTransitionTime: metav1.NewTime(time.Now().UTC().Truncate(time.Second)), + Reason: "NotFound", + Message: errMessage, }) updateReconciledVMStatus(ctx, vmService, vmopVM) @@ -448,7 +468,7 @@ var _ = Describe("VirtualMachine tests", func() { Type: infrav1.VMProvisionedCondition, Status: corev1.ConditionFalse, Severity: clusterv1.ConditionSeverityError, - Reason: vmoprv1.VirtualMachineClassBindingNotFoundReason, + Reason: "NotFound", Message: errMessage, }) verifyOutput(supervisorMachineContext) @@ -479,10 +499,12 @@ var _ = Describe("VirtualMachine tests", func() { vmVolume := vmoprv1.VirtualMachineVolume{ Name: "test", - PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: "test-pvc", - ReadOnly: false, + VirtualMachineVolumeSource: vmoprv1.VirtualMachineVolumeSource{ + PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ + PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: "test-pvc", + ReadOnly: false, + }, }, }, } @@ -536,10 +558,12 @@ var _ = Describe("VirtualMachine tests", func() { name := volumeName(vsphereMachine, volume) vmVolume := vmoprv1.VirtualMachineVolume{ Name: name, - PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: name, - ReadOnly: false, + VirtualMachineVolumeSource: vmoprv1.VirtualMachineVolumeSource{ + PersistentVolumeClaim: &vmoprv1.PersistentVolumeClaimVolumeSource{ + PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: name, + ReadOnly: false, + }, }, }, } diff --git a/pkg/util/testutil.go b/pkg/util/testutil.go index aad3a37f5b..db8c1bf216 100644 --- a/pkg/util/testutil.go +++ b/pkg/util/testutil.go @@ -18,7 +18,7 @@ package util import ( netopv1 "github.com/vmware-tanzu/net-operator-api/api/v1alpha1" - vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" + vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha2" ncpv1 "github.com/vmware-tanzu/vm-operator/external/ncp/api/v1alpha1" topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1" corev1 "k8s.io/api/core/v1" From c6212c4da6325391e7258dcdbfec0b5bc3dc66ed Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Mon, 3 Jun 2024 11:52:34 +0200 Subject: [PATCH 2/4] config: bump vm-operator crds --- ...mware.com_clustervirtualmachineimages.yaml | 446 ++- ...or.vmware.com_contentlibraryproviders.yaml | 30 +- ...ator.vmware.com_contentsourcebindings.yaml | 19 +- .../vmoperator.vmware.com_contentsources.yaml | 25 +- ...mware.com_virtualmachineclassbindings.yaml | 22 +- ...ator.vmware.com_virtualmachineclasses.yaml | 342 +- ...rator.vmware.com_virtualmachineimages.yaml | 451 ++- ...are.com_virtualmachinepublishrequests.yaml | 716 +++- ...vmoperator.vmware.com_virtualmachines.yaml | 2967 +++++++++++++++-- ...tor.vmware.com_virtualmachineservices.yaml | 318 +- ...com_virtualmachinesetresourcepolicies.yaml | 134 +- ....com_virtualmachinewebconsolerequests.yaml | 110 + ...perator.vmware.com_webconsolerequests.yaml | 57 +- .../integration-tests/kustomization.yaml | 3 + 14 files changed, 4936 insertions(+), 704 deletions(-) create mode 100644 config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_clustervirtualmachineimages.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_clustervirtualmachineimages.yaml index 6cf19e4495..7d5e57f572 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_clustervirtualmachineimages.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_clustervirtualmachineimages.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: clustervirtualmachineimages.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -42,19 +42,25 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: ClusterVirtualMachineImage is the schema for the clustervirtualmachineimage - API A ClusterVirtualMachineImage represents the desired specification and - the observed status of a ClusterVirtualMachineImage instance. + description: |- + ClusterVirtualMachineImage is the schema for the clustervirtualmachineimage API + A ClusterVirtualMachineImage represents the desired specification and the observed status of a + ClusterVirtualMachineImage instance. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -71,13 +77,14 @@ spec: of this VirtualMachineImage. type: string imageSourceType: - description: ImageSourceType describes the type of content source - of the VirtualMachineImage. The only Content Source supported currently - is the vSphere Content Library. + description: |- + ImageSourceType describes the type of content source of the VirtualMachineImage. The only Content Source + supported currently is the vSphere Content Library. type: string osInfo: - description: OSInfo describes the attributes of the VirtualMachineImage - relating to the Operating System contained in the image. + description: |- + OSInfo describes the attributes of the VirtualMachineImage relating to the Operating System contained in the + image. properties: type: description: Type typically describes the type of the guest operating @@ -90,24 +97,26 @@ spec: type: object ovfEnv: additionalProperties: - description: OvfProperty describes information related to a user - configurable property element that is supported by VirtualMachineImage - and can be customized during VirtualMachine creation. + description: |- + OvfProperty describes information related to a user configurable property element that is supported by + VirtualMachineImage and can be customized during VirtualMachine creation. properties: default: description: Default describes the default value of the ovf key. type: string description: - description: Description contains the value of the OVF property's - optional "Description" element. + description: |- + Description contains the value of the OVF property's optional + "Description" element. type: string key: description: Key describes the key of the ovf property. type: string label: - description: Label contains the value of the OVF property's - optional "Label" element. + description: |- + Label contains the value of the OVF property's optional + "Label" element. type: string type: description: Type describes the type of the ovf property. @@ -120,8 +129,9 @@ spec: parameters of the VirtualMachineImage. type: object productInfo: - description: ProductInfo describes the attributes of the VirtualMachineImage - relating to the product contained in the image. + description: |- + ProductInfo describes the attributes of the VirtualMachineImage relating to the product contained in the + image. properties: fullVersion: description: FullVersion typically describes a long-form version @@ -174,45 +184,45 @@ spec: description: VirtualMachineImageStatus defines the observed state of VirtualMachineImage. properties: conditions: - description: Conditions describes the current condition information - of the VirtualMachineImage object. e.g. if the OS type is supported - or image is supported by VMService + description: |- + Conditions describes the current condition information of the VirtualMachineImage object. e.g. if the OS type + is supported or image is supported by VMService items: description: Condition defines an observation of a VM Operator API resource operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to disambiguate - is important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to disambiguate is important. type: string required: - status @@ -220,20 +230,20 @@ spec: type: object type: array contentLibraryRef: - description: "ContentLibraryRef is a reference to the source ContentLibrary/ClusterContentLibrary - resource. \n Deprecated: This field is provider specific but the - VirtualMachineImage types are intended to be provider generic. This - field does not exist in later API versions. Instead, the Spec.ProviderRef - field should be used to look up the provider. For images provided - by a Content Library, the ProviderRef will point to either a ContentLibraryItem - or ClusterContentLibraryItem that contains a reference to the Content - Library." + description: |- + ContentLibraryRef is a reference to the source ContentLibrary/ClusterContentLibrary resource. + + + Deprecated: This field is provider specific but the VirtualMachineImage types are intended to be provider generic. + This field does not exist in later API versions. Instead, the Spec.ProviderRef field should be used to look up the + provider. For images provided by a Content Library, the ProviderRef will point to either a ContentLibraryItem or + ClusterContentLibraryItem that contains a reference to the Content Library. properties: apiGroup: - description: APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in - the core API group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -247,21 +257,23 @@ spec: type: object x-kubernetes-map-type: atomic contentVersion: - description: ContentVersion describes the observed content version - of this VirtualMachineImage that was last successfully synced with - the vSphere content library item. + description: |- + ContentVersion describes the observed content version of this VirtualMachineImage that was last successfully + synced with the vSphere content library item. type: string firmware: - description: 'Firmware describe the firmware type used by this VirtualMachineImage. - eg: bios, efi.' + description: |- + Firmware describe the firmware type used by this VirtualMachineImage. + eg: bios, efi. type: string imageName: description: ImageName describes the display name of this image. type: string imageSupported: - description: 'ImageSupported indicates whether the VirtualMachineImage - is supported by VMService. A VirtualMachineImage is supported by - VMService if the following conditions are true: - VirtualMachineImageV1Alpha1CompatibleCondition' + description: |- + ImageSupported indicates whether the VirtualMachineImage is supported by VMService. + A VirtualMachineImage is supported by VMService if the following conditions are true: + - VirtualMachineImageV1Alpha1CompatibleCondition type: boolean internalId: description: Deprecated @@ -275,6 +287,308 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.name + name: Display Name + type: string + - jsonPath: .status.productInfo.version + name: Image Version + type: string + - jsonPath: .status.osInfo.type + name: OS Name + type: string + - jsonPath: .status.osInfo.version + name: OS Version + type: string + - jsonPath: .status.hardwareVersion + name: Hardware Version + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + ClusterVirtualMachineImage is the schema for the clustervirtualmachineimages + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VirtualMachineImageSpec defines the desired state of VirtualMachineImage. + properties: + providerRef: + description: |- + ProviderRef is a reference to the resource that contains the source of + this image's information. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an + object. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object + represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name refers to a unique resource in the current namespace. + More info: http://kubernetes.io/docs/user-guide/identifiers#names + type: string + required: + - apiVersion + - kind + - name + type: object + type: object + status: + description: VirtualMachineImageStatus defines the observed state of VirtualMachineImage. + properties: + capabilities: + description: |- + Capabilities describes the image's observed capabilities. + + + The capabilities are discerned when VM Operator reconciles an image. + If the source of an image is an OVF in Content Library, then the + capabilities are parsed from the OVF property + capabilities.image.vmoperator.vmware.com as a comma-separated list of + values. Well-known capabilities include: + + + * cloud-init + * nvidia-gpu + * sriov-net + + + Every capability is also added to the resource's labels as + VirtualMachineImageCapabilityLabel + Value. For example, if the + capability is "cloud-init" then the following label will be added to the + resource: capability.image.vmoperator.vmware.com/cloud-init. + items: + type: string + type: array + x-kubernetes-list-type: set + conditions: + description: Conditions describes the observed conditions for this + image. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + firmware: + description: Firmware describe the firmware type used by this image, + ex. BIOS, EFI. + type: string + hardwareVersion: + description: HardwareVersion describes the observed hardware version + of this image. + format: int32 + type: integer + name: + description: Name describes the display name of this image. + type: string + osInfo: + description: |- + OSInfo describes the observed operating system information for this + image. + + + The OS information is also added to the image resource's labels. Please + refer to VirtualMachineImageOSInfo for more information. + properties: + id: + description: |- + ID describes the operating system ID. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSIDLabel. + type: string + type: + description: |- + Type describes the operating system type. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSTypeLabel. + type: string + version: + description: |- + Version describes the operating system version. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSVersionLabel. + type: string + type: object + ovfProperties: + description: |- + OVFProperties describes the observed user configurable OVF properties defined for this + image. + items: + description: |- + OVFProperty describes an OVF property associated with an image. + OVF properties may be used in conjunction with the vAppConfig bootstrap + provider to customize a VM during its creation. + properties: + default: + description: Default describes the OVF property's default value. + type: string + key: + description: Key describes the OVF property's key. + type: string + type: + description: Type describes the OVF property's type. + type: string + required: + - key + - type + type: object + type: array + productInfo: + description: ProductInfo describes the observed product information + for this image. + properties: + fullVersion: + description: FullVersion describes the long-form version of the + image. + type: string + product: + description: Product is a general descriptor for the image. + type: string + vendor: + description: Vendor describes the organization/user that produced + the image. + type: string + version: + description: Version describes the short-form version of the image. + type: string + type: object + providerContentVersion: + description: |- + ProviderContentVersion describes the content version from the provider item + that this image corresponds to. If the provider of this image is a Content + Library, this will be the version of the corresponding Content Library item. + type: string + providerItemID: + description: |- + ProviderItemID describes the ID of the provider item that this image corresponds to. + If the provider of this image is a Content Library, this ID will be that of the + corresponding Content Library item. + type: string + vmwareSystemProperties: + description: |- + VMwareSystemProperties describes the observed VMware system properties defined for + this image. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the key/value pair. + type: string + value: + description: Value is the optional value part of the key/value + pair. + type: string + required: + - key + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentlibraryproviders.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentlibraryproviders.yaml index 5879c338b5..c1b976ccf1 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentlibraryproviders.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentlibraryproviders.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: contentlibraryproviders.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -26,14 +26,19 @@ spec: API. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -41,14 +46,15 @@ spec: description: ContentLibraryProviderSpec defines the desired state of ContentLibraryProvider. properties: uuid: - description: UUID describes the UUID of a vSphere content library. - It is the unique identifier for a vSphere content library. + description: |- + UUID describes the UUID of a vSphere content library. It is the unique identifier for a + vSphere content library. type: string type: object status: - description: ContentLibraryProviderStatus defines the observed state of - ContentLibraryProvider Can include fields indicating when was the last - time VM images were updated from a library. + description: |- + ContentLibraryProviderStatus defines the observed state of ContentLibraryProvider + Can include fields indicating when was the last time VM images were updated from a library. type: object type: object served: true diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsourcebindings.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsourcebindings.yaml index 6e4a721b7c..e157dccea0 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsourcebindings.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsourcebindings.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: contentsourcebindings.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -21,9 +21,11 @@ spec: to Namespace mapping. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string contentSourceRef: description: ContentSourceRef is a reference to a ContentSource object. @@ -41,9 +43,12 @@ spec: - name type: object kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsources.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsources.yaml index 0d4f517e5d..a0b446dd5f 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsources.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_contentsources.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: contentsources.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -17,19 +17,24 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: ContentSource is the Schema for the contentsources API. A ContentSource - represents the desired specification and the observed status of a ContentSource - instance. + description: |- + ContentSource is the Schema for the contentsources API. + A ContentSource represents the desired specification and the observed status of a ContentSource instance. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclassbindings.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclassbindings.yaml index 7a6f691059..13fc691cc8 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclassbindings.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclassbindings.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachineclassbindings.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -23,13 +23,16 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachineClassBinding is a binding object responsible for + description: |- + VirtualMachineClassBinding is a binding object responsible for defining a VirtualMachineClass and a Namespace associated with it. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string classRef: description: ClassReference is a reference to a VirtualMachineClass object @@ -47,9 +50,12 @@ spec: - name type: object kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclasses.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclasses.yaml index 6a937db60c..6a8a2e9009 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclasses.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineclasses.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachineclasses.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -37,22 +37,27 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachineClass is the Schema for the virtualmachineclasses - API. A VirtualMachineClass represents the desired specification and the - observed status of a VirtualMachineClass instance. A VirtualMachineClass - represents a policy and configuration resource which defines a set of attributes - to be used in the configuration of a VirtualMachine instance. A VirtualMachine - resource references a VirtualMachineClass as a required input. + description: |- + VirtualMachineClass is the Schema for the virtualmachineclasses API. + A VirtualMachineClass represents the desired specification and the observed status of a VirtualMachineClass + instance. A VirtualMachineClass represents a policy and configuration resource which defines a set of attributes to + be used in the configuration of a VirtualMachine instance. A VirtualMachine resource references a + VirtualMachineClass as a required input. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -60,32 +65,40 @@ spec: description: VirtualMachineClassSpec defines the desired state of VirtualMachineClass. properties: configSpec: - description: ConfigSpec describes additional configuration information - for a VirtualMachine. The contents of this field are the VirtualMachineConfigSpec - data object (https://bit.ly/3HDtiRu) marshaled to JSON using the - discriminator field "_typeName" to preserve type information. + description: |- + ConfigSpec describes additional configuration information for a + VirtualMachine. + The contents of this field are the VirtualMachineConfigSpec data object + (https://bit.ly/3HDtiRu) marshaled to JSON using the discriminator + field "_typeName" to preserve type information. type: object x-kubernetes-preserve-unknown-fields: true controllerName: - description: "ControllerName describes the name of the controller - responsible for reconciling VirtualMachine resources that are realized - from this VirtualMachineClass. \n When omitted, controllers reconciling - VirtualMachine resources determine the default controller name from - the environment variable DEFAULT_VM_CLASS_CONTROLLER_NAME. If this - environment variable is not defined or empty, it defaults to vmoperator.vmware.com/vsphere. - \n Once a non-empty value is assigned to this field, attempts to - set this field to an empty value will be silently ignored." + description: |- + ControllerName describes the name of the controller responsible for + reconciling VirtualMachine resources that are realized from this + VirtualMachineClass. + + + When omitted, controllers reconciling VirtualMachine resources determine + the default controller name from the environment variable + DEFAULT_VM_CLASS_CONTROLLER_NAME. If this environment variable is not + defined or empty, it defaults to vmoperator.vmware.com/vsphere. + + + Once a non-empty value is assigned to this field, attempts to set this + field to an empty value will be silently ignored. type: string description: - description: Description describes the configuration of the VirtualMachineClass - which is not related to virtual hardware or infrastructure policy. - This field is used to address remaining specs about this VirtualMachineClass. + description: |- + Description describes the configuration of the VirtualMachineClass which is not related to virtual hardware + or infrastructure policy. This field is used to address remaining specs about this VirtualMachineClass. type: string hardware: - description: Hardware describes the configuration of the VirtualMachineClass - attributes related to virtual hardware. The configuration specified - in this field is used to customize the virtual hardware characteristics - of any VirtualMachine associated with this VirtualMachineClass. + description: |- + Hardware describes the configuration of the VirtualMachineClass attributes related to virtual hardware. The + configuration specified in this field is used to customize the virtual hardware characteristics of any VirtualMachine + associated with this VirtualMachineClass. properties: cpus: format: int64 @@ -123,24 +136,27 @@ spec: type: array type: object instanceStorage: - description: InstanceStorage provides information used to configure - instance storage volumes for a VirtualMachine. + description: |- + InstanceStorage provides information used to configure instance + storage volumes for a VirtualMachine. properties: storageClass: - description: StorageClass refers to the name of a StorageClass - resource used to provide the storage for the configured - instance storage volumes. The value of this field has no - relationship to or bearing on the field virtualMachine.spec.storageClass. - Please note the referred StorageClass must be available - in the same namespace as the VirtualMachineClass that uses - it for configuring instance storage. + description: |- + StorageClass refers to the name of a StorageClass resource used to + provide the storage for the configured instance storage volumes. + The value of this field has no relationship to or bearing on the field + virtualMachine.spec.storageClass. Please note the referred StorageClass + must be available in the same namespace as the VirtualMachineClass that + uses it for configuring instance storage. type: string volumes: - description: Volumes describes instance storage volumes created - for a VirtualMachine instance that use this VirtualMachineClass. + description: |- + Volumes describes instance storage volumes created for a VirtualMachine + instance that use this VirtualMachineClass. items: - description: InstanceStorageVolume contains information - required to create an instance storage volume on a VirtualMachine. + description: |- + InstanceStorageVolume contains information required to create an + instance storage volume on a VirtualMachine. properties: size: anyOf: @@ -161,15 +177,15 @@ spec: x-kubernetes-int-or-string: true type: object policies: - description: Policies describes the configuration of the VirtualMachineClass - attributes related to virtual infrastructure policy. The configuration - specified in this field is used to customize various policies related - to infrastructure resource consumption. + description: |- + Policies describes the configuration of the VirtualMachineClass attributes related to virtual infrastructure + policy. The configuration specified in this field is used to customize various policies related to + infrastructure resource consumption. properties: resources: - description: VirtualMachineClassResources describes the virtual - hardware resource reservations and limits configuration to be - used by a VirtualMachineClass. + description: |- + VirtualMachineClassResources describes the virtual hardware resource reservations and limits configuration to be used + by a VirtualMachineClass. properties: limits: description: VirtualMachineResourceSpec describes a virtual @@ -209,8 +225,226 @@ spec: type: object type: object status: - description: VirtualMachineClassStatus defines the observed state of VirtualMachineClass. VirtualMachineClasses - are immutable, non-dynamic resources, so this status is currently unused. + description: |- + VirtualMachineClassStatus defines the observed state of VirtualMachineClass. VirtualMachineClasses are immutable, + non-dynamic resources, so this status is currently unused. + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.hardware.cpus + name: CPU + type: string + - jsonPath: .spec.hardware.memory + name: Memory + type: string + - jsonPath: .status.capabilities + name: Capabilities + priority: 1 + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + VirtualMachineClass is the schema for the virtualmachineclasses API and + represents the desired state and observed status of a virtualmachineclasses + resource. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VirtualMachineClassSpec defines the desired state of VirtualMachineClass. + properties: + configSpec: + description: |- + ConfigSpec describes additional configuration information for a + VirtualMachine. + The contents of this field are the VirtualMachineConfigSpec data object + (https://bit.ly/3HDtiRu) marshaled to JSON using the discriminator + field "_typeName" to preserve type information. + type: object + x-kubernetes-preserve-unknown-fields: true + controllerName: + description: |- + ControllerName describes the name of the controller responsible for + reconciling VirtualMachine resources that are realized from this + VirtualMachineClass. + + + When omitted, controllers reconciling VirtualMachine resources determine + the default controller name from the environment variable + DEFAULT_VM_CLASS_CONTROLLER_NAME. If this environment variable is not + defined or empty, it defaults to vmoperator.vmware.com/vsphere. + + + Once a non-empty value is assigned to this field, attempts to set this + field to an empty value will be silently ignored. + type: string + description: + description: |- + Description describes the configuration of the VirtualMachineClass which + is not related to virtual hardware or infrastructure policy. This field + is used to address remaining specs about this VirtualMachineClass. + type: string + hardware: + description: |- + Hardware describes the configuration of the VirtualMachineClass + attributes related to virtual hardware. The configuration specified in + this field is used to customize the virtual hardware characteristics of + any VirtualMachine associated with this VirtualMachineClass. + properties: + cpus: + format: int64 + type: integer + devices: + description: |- + VirtualDevices contains information about the virtual devices associated + with a VirtualMachineClass. + properties: + dynamicDirectPathIODevices: + items: + description: |- + DynamicDirectPathIODevice contains the configuration corresponding to a + Dynamic DirectPath I/O device. + properties: + customLabel: + type: string + deviceID: + format: int64 + type: integer + vendorID: + format: int64 + type: integer + required: + - deviceID + - vendorID + type: object + type: array + vgpuDevices: + items: + description: VGPUDevice contains the configuration corresponding + to a vGPU device. + properties: + profileName: + type: string + required: + - profileName + type: object + type: array + x-kubernetes-list-map-keys: + - profileName + x-kubernetes-list-type: map + type: object + instanceStorage: + description: |- + InstanceStorage provides information used to configure instance + storage volumes for a VirtualMachine. + properties: + storageClass: + description: |- + StorageClass refers to the name of a StorageClass resource used to + provide the storage for the configured instance storage volumes. + The value of this field has no relationship to or bearing on the field + virtualMachine.spec.storageClass. Please note the referred StorageClass + must be available in the same namespace as the VirtualMachineClass that + uses it for configuring instance storage. + type: string + volumes: + description: |- + Volumes describes instance storage volumes created for a VirtualMachine + instance that use this VirtualMachineClass. + items: + description: |- + InstanceStorageVolume contains information required to create an + instance storage volume on a VirtualMachine. + properties: + size: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + required: + - size + type: object + type: array + type: object + memory: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + policies: + description: |- + Policies describes the configuration of the VirtualMachineClass + attributes related to virtual infrastructure policy. The configuration + specified in this field is used to customize various policies related to + infrastructure resource consumption. + properties: + resources: + description: |- + VirtualMachineClassResources describes the virtual hardware resource + reservations and limits configuration to be used by a VirtualMachineClass. + properties: + limits: + description: VirtualMachineResourceSpec describes a virtual + hardware policy specification. + properties: + cpu: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + memory: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + description: VirtualMachineResourceSpec describes a virtual + hardware policy specification. + properties: + cpu: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + memory: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + type: object + type: object + status: + description: VirtualMachineClassStatus defines the observed state of VirtualMachineClass. type: object type: object served: true diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineimages.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineimages.yaml index aea270e127..d802eb55af 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineimages.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineimages.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachineimages.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -40,21 +40,26 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachineImage is the Schema for the virtualmachineimages - API A VirtualMachineImage represents a VirtualMachine image (e.g. VM template) - that can be used as the base image for creating a VirtualMachine instance. The - VirtualMachineImage is a required field of the VirtualMachine spec. Currently, - VirtualMachineImages are immutable to end users. + description: |- + VirtualMachineImage is the Schema for the virtualmachineimages API + A VirtualMachineImage represents a VirtualMachine image (e.g. VM template) that can be used as the base image + for creating a VirtualMachine instance. The VirtualMachineImage is a required field of the VirtualMachine + spec. Currently, VirtualMachineImages are immutable to end users. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -71,13 +76,14 @@ spec: of this VirtualMachineImage. type: string imageSourceType: - description: ImageSourceType describes the type of content source - of the VirtualMachineImage. The only Content Source supported currently - is the vSphere Content Library. + description: |- + ImageSourceType describes the type of content source of the VirtualMachineImage. The only Content Source + supported currently is the vSphere Content Library. type: string osInfo: - description: OSInfo describes the attributes of the VirtualMachineImage - relating to the Operating System contained in the image. + description: |- + OSInfo describes the attributes of the VirtualMachineImage relating to the Operating System contained in the + image. properties: type: description: Type typically describes the type of the guest operating @@ -90,24 +96,26 @@ spec: type: object ovfEnv: additionalProperties: - description: OvfProperty describes information related to a user - configurable property element that is supported by VirtualMachineImage - and can be customized during VirtualMachine creation. + description: |- + OvfProperty describes information related to a user configurable property element that is supported by + VirtualMachineImage and can be customized during VirtualMachine creation. properties: default: description: Default describes the default value of the ovf key. type: string description: - description: Description contains the value of the OVF property's - optional "Description" element. + description: |- + Description contains the value of the OVF property's optional + "Description" element. type: string key: description: Key describes the key of the ovf property. type: string label: - description: Label contains the value of the OVF property's - optional "Label" element. + description: |- + Label contains the value of the OVF property's optional + "Label" element. type: string type: description: Type describes the type of the ovf property. @@ -120,8 +128,9 @@ spec: parameters of the VirtualMachineImage. type: object productInfo: - description: ProductInfo describes the attributes of the VirtualMachineImage - relating to the product contained in the image. + description: |- + ProductInfo describes the attributes of the VirtualMachineImage relating to the product contained in the + image. properties: fullVersion: description: FullVersion typically describes a long-form version @@ -174,45 +183,45 @@ spec: description: VirtualMachineImageStatus defines the observed state of VirtualMachineImage. properties: conditions: - description: Conditions describes the current condition information - of the VirtualMachineImage object. e.g. if the OS type is supported - or image is supported by VMService + description: |- + Conditions describes the current condition information of the VirtualMachineImage object. e.g. if the OS type + is supported or image is supported by VMService items: description: Condition defines an observation of a VM Operator API resource operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to disambiguate - is important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to disambiguate is important. type: string required: - status @@ -220,20 +229,20 @@ spec: type: object type: array contentLibraryRef: - description: "ContentLibraryRef is a reference to the source ContentLibrary/ClusterContentLibrary - resource. \n Deprecated: This field is provider specific but the - VirtualMachineImage types are intended to be provider generic. This - field does not exist in later API versions. Instead, the Spec.ProviderRef - field should be used to look up the provider. For images provided - by a Content Library, the ProviderRef will point to either a ContentLibraryItem - or ClusterContentLibraryItem that contains a reference to the Content - Library." + description: |- + ContentLibraryRef is a reference to the source ContentLibrary/ClusterContentLibrary resource. + + + Deprecated: This field is provider specific but the VirtualMachineImage types are intended to be provider generic. + This field does not exist in later API versions. Instead, the Spec.ProviderRef field should be used to look up the + provider. For images provided by a Content Library, the ProviderRef will point to either a ContentLibraryItem or + ClusterContentLibraryItem that contains a reference to the Content Library. properties: apiGroup: - description: APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in - the core API group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -247,21 +256,23 @@ spec: type: object x-kubernetes-map-type: atomic contentVersion: - description: ContentVersion describes the observed content version - of this VirtualMachineImage that was last successfully synced with - the vSphere content library item. + description: |- + ContentVersion describes the observed content version of this VirtualMachineImage that was last successfully + synced with the vSphere content library item. type: string firmware: - description: 'Firmware describe the firmware type used by this VirtualMachineImage. - eg: bios, efi.' + description: |- + Firmware describe the firmware type used by this VirtualMachineImage. + eg: bios, efi. type: string imageName: description: ImageName describes the display name of this image. type: string imageSupported: - description: 'ImageSupported indicates whether the VirtualMachineImage - is supported by VMService. A VirtualMachineImage is supported by - VMService if the following conditions are true: - VirtualMachineImageV1Alpha1CompatibleCondition' + description: |- + ImageSupported indicates whether the VirtualMachineImage is supported by VMService. + A VirtualMachineImage is supported by VMService if the following conditions are true: + - VirtualMachineImageV1Alpha1CompatibleCondition type: boolean internalId: description: Deprecated @@ -275,6 +286,310 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.name + name: Display Name + type: string + - jsonPath: .status.productInfo.version + name: Image Version + type: string + - jsonPath: .status.osInfo.type + name: OS Name + type: string + - jsonPath: .status.osInfo.version + name: OS Version + type: string + - jsonPath: .status.hardwareVersion + name: Hardware Version + type: string + - jsonPath: .status.capabilities + name: Capabilities + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: VirtualMachineImage is the schema for the virtualmachineimages + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VirtualMachineImageSpec defines the desired state of VirtualMachineImage. + properties: + providerRef: + description: |- + ProviderRef is a reference to the resource that contains the source of + this image's information. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an + object. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object + represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name refers to a unique resource in the current namespace. + More info: http://kubernetes.io/docs/user-guide/identifiers#names + type: string + required: + - apiVersion + - kind + - name + type: object + type: object + status: + description: VirtualMachineImageStatus defines the observed state of VirtualMachineImage. + properties: + capabilities: + description: |- + Capabilities describes the image's observed capabilities. + + + The capabilities are discerned when VM Operator reconciles an image. + If the source of an image is an OVF in Content Library, then the + capabilities are parsed from the OVF property + capabilities.image.vmoperator.vmware.com as a comma-separated list of + values. Well-known capabilities include: + + + * cloud-init + * nvidia-gpu + * sriov-net + + + Every capability is also added to the resource's labels as + VirtualMachineImageCapabilityLabel + Value. For example, if the + capability is "cloud-init" then the following label will be added to the + resource: capability.image.vmoperator.vmware.com/cloud-init. + items: + type: string + type: array + x-kubernetes-list-type: set + conditions: + description: Conditions describes the observed conditions for this + image. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + firmware: + description: Firmware describe the firmware type used by this image, + ex. BIOS, EFI. + type: string + hardwareVersion: + description: HardwareVersion describes the observed hardware version + of this image. + format: int32 + type: integer + name: + description: Name describes the display name of this image. + type: string + osInfo: + description: |- + OSInfo describes the observed operating system information for this + image. + + + The OS information is also added to the image resource's labels. Please + refer to VirtualMachineImageOSInfo for more information. + properties: + id: + description: |- + ID describes the operating system ID. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSIDLabel. + type: string + type: + description: |- + Type describes the operating system type. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSTypeLabel. + type: string + version: + description: |- + Version describes the operating system version. + + + This value is also added to the image resource's labels as + VirtualMachineImageOSVersionLabel. + type: string + type: object + ovfProperties: + description: |- + OVFProperties describes the observed user configurable OVF properties defined for this + image. + items: + description: |- + OVFProperty describes an OVF property associated with an image. + OVF properties may be used in conjunction with the vAppConfig bootstrap + provider to customize a VM during its creation. + properties: + default: + description: Default describes the OVF property's default value. + type: string + key: + description: Key describes the OVF property's key. + type: string + type: + description: Type describes the OVF property's type. + type: string + required: + - key + - type + type: object + type: array + productInfo: + description: ProductInfo describes the observed product information + for this image. + properties: + fullVersion: + description: FullVersion describes the long-form version of the + image. + type: string + product: + description: Product is a general descriptor for the image. + type: string + vendor: + description: Vendor describes the organization/user that produced + the image. + type: string + version: + description: Version describes the short-form version of the image. + type: string + type: object + providerContentVersion: + description: |- + ProviderContentVersion describes the content version from the provider item + that this image corresponds to. If the provider of this image is a Content + Library, this will be the version of the corresponding Content Library item. + type: string + providerItemID: + description: |- + ProviderItemID describes the ID of the provider item that this image corresponds to. + If the provider of this image is a Content Library, this ID will be that of the + corresponding Content Library item. + type: string + vmwareSystemProperties: + description: |- + VMwareSystemProperties describes the observed VMware system properties defined for + this image. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the key/value pair. + type: string + value: + description: Value is the optional value part of the key/value + pair. + type: string + required: + - key + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinepublishrequests.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinepublishrequests.yaml index 4ce064b10c..d8e5424fd5 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinepublishrequests.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinepublishrequests.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachinepublishrequests.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -19,37 +19,49 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachinePublishRequest defines the information necessary - to publish a VirtualMachine as a VirtualMachineImage to an image registry. + description: |- + VirtualMachinePublishRequest defines the information necessary to publish a + VirtualMachine as a VirtualMachineImage to an image registry. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object spec: - description: "VirtualMachinePublishRequestSpec defines the desired state - of a VirtualMachinePublishRequest. \n All the fields in this spec are - optional. This is especially useful when a DevOps persona wants to publish - a VM without doing anything more than applying a VirtualMachinePublishRequest - resource that has the same name as said VM in the same namespace as - said VM." + description: |- + VirtualMachinePublishRequestSpec defines the desired state of a + VirtualMachinePublishRequest. + + + All the fields in this spec are optional. This is especially useful when a + DevOps persona wants to publish a VM without doing anything more than + applying a VirtualMachinePublishRequest resource that has the same name + as said VM in the same namespace as said VM. properties: source: - description: "Source is the source of the publication request, ex. - a VirtualMachine resource. \n If this value is omitted then the - publication controller checks to see if there is a resource with - the same name as this VirtualMachinePublishRequest resource, an - API version equal to spec.source.apiVersion, and a kind equal to - spec.source.kind. If such a resource exists, then it is the source - of the publication." + description: |- + Source is the source of the publication request, ex. a VirtualMachine + resource. + + + If this value is omitted then the publication controller checks to + see if there is a resource with the same name as this + VirtualMachinePublishRequest resource, an API version equal to + spec.source.apiVersion, and a kind equal to spec.source.kind. If such + a resource exists, then it is the source of the publication. properties: apiVersion: default: vmoperator.vmware.com/v1alpha1 @@ -60,47 +72,66 @@ spec: description: Kind is the kind of referenced object. type: string name: - description: "Name is the name of the referenced object. \n If - omitted this value defaults to the name of the VirtualMachinePublishRequest - resource." + description: |- + Name is the name of the referenced object. + + + If omitted this value defaults to the name of the + VirtualMachinePublishRequest resource. type: string type: object target: - description: "Target is the target of the publication request, ex. - item information and a ContentLibrary resource. \n If this value - is omitted, the controller uses spec.source.name + \"-image\" as - the name of the published item. Additionally, when omitted the controller - attempts to identify the target location by matching a resource - with an API version equal to spec.target.location.apiVersion, a - kind equal to spec.target.location.kind, w/ the label \"imageregistry.vmware.com/default\". - \n Please note that while optional, if a VirtualMachinePublishRequest - sans target information is applied to a namespace without a default + description: |- + Target is the target of the publication request, ex. item + information and a ContentLibrary resource. + + + If this value is omitted, the controller uses spec.source.name + "-image" + as the name of the published item. Additionally, when omitted the + controller attempts to identify the target location by matching a + resource with an API version equal to spec.target.location.apiVersion, a + kind equal to spec.target.location.kind, w/ the label + "imageregistry.vmware.com/default". + + + Please note that while optional, if a VirtualMachinePublishRequest sans + target information is applied to a namespace without a default publication target, then the VirtualMachinePublishRequest resource - will be marked in error." + will be marked in error. properties: item: - description: "Item contains information about the name of the - object to which the VM is published. \n Please note this value - is optional and if omitted, the controller will use spec.source.name - + \"-image\" as the name of the published item." + description: |- + Item contains information about the name of the object to which + the VM is published. + + + Please note this value is optional and if omitted, the controller + will use spec.source.name + "-image" as the name of the published + item. properties: description: description: Description is the description to assign to the published object. type: string name: - description: "Name is the display name of the published object. - \n If the spec.target.location.apiVersion equals imageregistry.vmware.com/v1alpha1 - and the spec.target.location.kind equals ContentLibrary, - then this should be the name that will show up in vCenter - Content Library, not the custom resource name in the namespace. - \n If omitted then the controller will use spec.source.name - + \"-image\"." + description: |- + Name is the display name of the published object. + + + If the spec.target.location.apiVersion equals + imageregistry.vmware.com/v1alpha1 and the spec.target.location.kind + equals ContentLibrary, then this should be the name that will + show up in vCenter Content Library, not the custom resource name + in the namespace. + + + If omitted then the controller will use spec.source.name + "-image". type: string type: object location: - description: Location contains information about the location - to which to publish the VM. + description: |- + Location contains information about the location to which to publish + the VM. properties: apiVersion: default: imageregistry.vmware.com/v1alpha1 @@ -112,84 +143,98 @@ spec: description: Kind is the kind of referenced object. type: string name: - description: "Name is the name of the referenced object. \n + description: |- + Name is the name of the referenced object. + + Please note an error will be returned if this field is not set in a namespace that lacks a default publication target. - \n A default publication target is a resource with an API - version equal to spec.target.location.apiVersion, a kind - equal to spec.target.location.kind, and has the label \"imageregistry.vmware.com/default\"." + + + A default publication target is a resource with an API version + equal to spec.target.location.apiVersion, a kind equal to + spec.target.location.kind, and has the label + "imageregistry.vmware.com/default". type: string type: object type: object ttlSecondsAfterFinished: - description: "TTLSecondsAfterFinished is the time-to-live duration - for how long this resource will be allowed to exist once the publication - operation completes. After the TTL expires, the resource will be - automatically deleted without the user having to take any direct - action. \n If this field is unset then the request resource will - not be automatically deleted. If this field is set to zero then - the request resource is eligible for deletion immediately after - it finishes." + description: |- + TTLSecondsAfterFinished is the time-to-live duration for how long this + resource will be allowed to exist once the publication operation + completes. After the TTL expires, the resource will be automatically + deleted without the user having to take any direct action. + + + If this field is unset then the request resource will not be + automatically deleted. If this field is set to zero then the request + resource is eligible for deletion immediately after it finishes. format: int64 minimum: 0 type: integer type: object status: - description: VirtualMachinePublishRequestStatus defines the observed state - of a VirtualMachinePublishRequest. + description: |- + VirtualMachinePublishRequestStatus defines the observed state of a + VirtualMachinePublishRequest. properties: attempts: - description: Attempts represents the number of times the request to - publish the VM has been attempted. + description: |- + Attempts represents the number of times the request to publish the VM + has been attempted. format: int64 type: integer completionTime: - description: "CompletionTime represents time when the request was - completed. It is not guaranteed to be set in happens-before order - across separate operations. It is represented in RFC3339 form and - is in UTC. \n The value of this field should be equal to the value - of the LastTransitionTime for the status condition Type=Complete." + description: |- + CompletionTime represents time when the request was completed. It is not + guaranteed to be set in happens-before order across separate operations. + It is represented in RFC3339 form and is in UTC. + + + The value of this field should be equal to the value of the + LastTransitionTime for the status condition Type=Complete. format: date-time type: string conditions: - description: Conditions is a list of the latest, available observations - of the request's current state. + description: |- + Conditions is a list of the latest, available observations of the + request's current state. items: description: Condition defines an observation of a VM Operator API resource operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to disambiguate - is important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to disambiguate is important. type: string required: - status @@ -197,11 +242,14 @@ spec: type: object type: array imageName: - description: "ImageName is the name of the VirtualMachineImage resource - that is eventually realized in the same namespace as the VM and - publication request after the publication operation completes. \n + description: |- + ImageName is the name of the VirtualMachineImage resource that is + eventually realized in the same namespace as the VM and publication + request after the publication operation completes. + + This field will not be set until the VirtualMachineImage resource - is realized." + is realized. type: string lastAttemptTime: description: LastAttemptTime represents the time when the latest request @@ -209,16 +257,26 @@ spec: format: date-time type: string ready: - description: "Ready is set to true only when the VM has been published - successfully and the new VirtualMachineImage resource is ready. - \n Readiness is determined by waiting until there is status condition + description: |- + Ready is set to true only when the VM has been published successfully + and the new VirtualMachineImage resource is ready. + + + Readiness is determined by waiting until there is status condition Type=Complete and ensuring it and all other status conditions present - have a Status=True. The conditions present will be: \n * SourceValid - * TargetValid * Uploaded * ImageAvailable * Complete" + have a Status=True. The conditions present will be: + + + * SourceValid + * TargetValid + * Uploaded + * ImageAvailable + * Complete type: boolean sourceRef: - description: SourceRef is the reference to the source of the publication - request, ex. a VirtualMachine resource. + description: |- + SourceRef is the reference to the source of the publication request, + ex. a VirtualMachine resource. properties: apiVersion: default: vmoperator.vmware.com/v1alpha1 @@ -229,45 +287,60 @@ spec: description: Kind is the kind of referenced object. type: string name: - description: "Name is the name of the referenced object. \n If - omitted this value defaults to the name of the VirtualMachinePublishRequest - resource." + description: |- + Name is the name of the referenced object. + + + If omitted this value defaults to the name of the + VirtualMachinePublishRequest resource. type: string type: object startTime: - description: StartTime represents time when the request was acknowledged - by the controller. It is not guaranteed to be set in happens-before - order across separate operations. It is represented in RFC3339 form - and is in UTC. + description: |- + StartTime represents time when the request was acknowledged by the + controller. It is not guaranteed to be set in happens-before order + across separate operations. It is represented in RFC3339 form and is + in UTC. format: date-time type: string targetRef: - description: TargetRef is the reference to the target of the publication - request, ex. item information and a ContentLibrary resource. + description: |- + TargetRef is the reference to the target of the publication request, + ex. item information and a ContentLibrary resource. properties: item: - description: "Item contains information about the name of the - object to which the VM is published. \n Please note this value - is optional and if omitted, the controller will use spec.source.name - + \"-image\" as the name of the published item." + description: |- + Item contains information about the name of the object to which + the VM is published. + + + Please note this value is optional and if omitted, the controller + will use spec.source.name + "-image" as the name of the published + item. properties: description: description: Description is the description to assign to the published object. type: string name: - description: "Name is the display name of the published object. - \n If the spec.target.location.apiVersion equals imageregistry.vmware.com/v1alpha1 - and the spec.target.location.kind equals ContentLibrary, - then this should be the name that will show up in vCenter - Content Library, not the custom resource name in the namespace. - \n If omitted then the controller will use spec.source.name - + \"-image\"." + description: |- + Name is the display name of the published object. + + + If the spec.target.location.apiVersion equals + imageregistry.vmware.com/v1alpha1 and the spec.target.location.kind + equals ContentLibrary, then this should be the name that will + show up in vCenter Content Library, not the custom resource name + in the namespace. + + + If omitted then the controller will use spec.source.name + "-image". type: string type: object location: - description: Location contains information about the location - to which to publish the VM. + description: |- + Location contains information about the location to which to publish + the VM. properties: apiVersion: default: imageregistry.vmware.com/v1alpha1 @@ -279,12 +352,401 @@ spec: description: Kind is the kind of referenced object. type: string name: - description: "Name is the name of the referenced object. \n + description: |- + Name is the name of the referenced object. + + Please note an error will be returned if this field is not set in a namespace that lacks a default publication target. - \n A default publication target is a resource with an API - version equal to spec.target.location.apiVersion, a kind - equal to spec.target.location.kind, and has the label \"imageregistry.vmware.com/default\"." + + + A default publication target is a resource with an API version + equal to spec.target.location.apiVersion, a kind equal to + spec.target.location.kind, and has the label + "imageregistry.vmware.com/default". + type: string + type: object + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + VirtualMachinePublishRequest defines the information necessary to publish a + VirtualMachine as a VirtualMachineImage to an image registry. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + VirtualMachinePublishRequestSpec defines the desired state of a + VirtualMachinePublishRequest. + + + All the fields in this spec are optional. This is especially useful when a + DevOps persona wants to publish a VM without doing anything more than + applying a VirtualMachinePublishRequest resource that has the same name + as said VM in the same namespace as said VM. + properties: + source: + description: |- + Source is the source of the publication request, ex. a VirtualMachine + resource. + + + If this value is omitted then the publication controller checks to + see if there is a resource with the same name as this + VirtualMachinePublishRequest resource, an API version equal to + spec.source.apiVersion, and a kind equal to spec.source.kind. If such + a resource exists, then it is the source of the publication. + properties: + apiVersion: + default: vmoperator.vmware.com/v1alpha1 + description: APIVersion is the API version of the referenced object. + type: string + kind: + default: VirtualMachine + description: Kind is the kind of referenced object. + type: string + name: + description: |- + Name is the name of the referenced object. + + + If omitted this value defaults to the name of the + VirtualMachinePublishRequest resource. + type: string + type: object + target: + description: |- + Target is the target of the publication request, ex. item + information and a ContentLibrary resource. + + + If this value is omitted, the controller uses spec.source.name + "-image" + as the name of the published item. Additionally, when omitted the + controller attempts to identify the target location by matching a + resource with an API version equal to spec.target.location.apiVersion, a + kind equal to spec.target.location.kind, w/ the label + "imageregistry.vmware.com/default". + + + Please note that while optional, if a VirtualMachinePublishRequest sans + target information is applied to a namespace without a default + publication target, then the VirtualMachinePublishRequest resource + will be marked in error. + properties: + item: + description: |- + Item contains information about the name of the object to which + the VM is published. + + + Please note this value is optional and if omitted, the controller + will use spec.source.name + "-image" as the name of the published + item. + properties: + description: + description: Description is the description to assign to the + published object. + type: string + name: + description: |- + Name is the name of the published object. + + + If the spec.target.location.apiVersion equals + imageregistry.vmware.com/v1alpha1 and the spec.target.location.kind + equals ContentLibrary, then this should be the name that will + show up in vCenter Content Library, not the custom resource name + in the namespace. + + + If omitted then the controller will use spec.source.name + "-image". + type: string + type: object + location: + description: |- + Location contains information about the location to which to publish + the VM. + properties: + apiVersion: + default: imageregistry.vmware.com/v1alpha1 + description: APIVersion is the API version of the referenced + object. + type: string + kind: + default: ContentLibrary + description: Kind is the kind of referenced object. + type: string + name: + description: |- + Name is the name of the referenced object. + + + Please note an error will be returned if this field is not + set in a namespace that lacks a default publication target. + + + A default publication target is a resource with an API version + equal to spec.target.location.apiVersion, a kind equal to + spec.target.location.kind, and has the label + "imageregistry.vmware.com/default". + type: string + type: object + type: object + ttlSecondsAfterFinished: + description: |- + TTLSecondsAfterFinished is the time-to-live duration for how long this + resource will be allowed to exist once the publication operation + completes. After the TTL expires, the resource will be automatically + deleted without the user having to take any direct action. + + + If this field is unset then the request resource will not be + automatically deleted. If this field is set to zero then the request + resource is eligible for deletion immediately after it finishes. + format: int64 + minimum: 0 + type: integer + type: object + status: + description: |- + VirtualMachinePublishRequestStatus defines the observed state of a + VirtualMachinePublishRequest. + properties: + attempts: + description: |- + Attempts represents the number of times the request to publish the VM + has been attempted. + format: int64 + type: integer + completionTime: + description: |- + CompletionTime represents time when the request was completed. It is not + guaranteed to be set in happens-before order across separate operations. + It is represented in RFC3339 form and is in UTC. + + + The value of this field should be equal to the value of the + LastTransitionTime for the status condition Type=Complete. + format: date-time + type: string + conditions: + description: |- + Conditions is a list of the latest, available observations of the + request's current state. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + imageName: + description: |- + ImageName is the name of the VirtualMachineImage resource that is + eventually realized in the same namespace as the VM and publication + request after the publication operation completes. + + + This field will not be set until the VirtualMachineImage resource + is realized. + type: string + lastAttemptTime: + description: LastAttemptTime represents the time when the latest request + was sent. + format: date-time + type: string + ready: + description: |- + Ready is set to true only when the VM has been published successfully + and the new VirtualMachineImage resource is ready. + + + Readiness is determined by waiting until there is status condition + Type=Complete and ensuring it and all other status conditions present + have a Status=True. The conditions present will be: + + + * SourceValid + * TargetValid + * Uploaded + * ImageAvailable + * Complete + type: boolean + sourceRef: + description: |- + SourceRef is the reference to the source of the publication request, + ex. a VirtualMachine resource. + properties: + apiVersion: + default: vmoperator.vmware.com/v1alpha1 + description: APIVersion is the API version of the referenced object. + type: string + kind: + default: VirtualMachine + description: Kind is the kind of referenced object. + type: string + name: + description: |- + Name is the name of the referenced object. + + + If omitted this value defaults to the name of the + VirtualMachinePublishRequest resource. + type: string + type: object + startTime: + description: |- + StartTime represents time when the request was acknowledged by the + controller. It is not guaranteed to be set in happens-before order + across separate operations. It is represented in RFC3339 form and is + in UTC. + format: date-time + type: string + targetRef: + description: |- + TargetRef is the reference to the target of the publication request, + ex. item information and a ContentLibrary resource. + properties: + item: + description: |- + Item contains information about the name of the object to which + the VM is published. + + + Please note this value is optional and if omitted, the controller + will use spec.source.name + "-image" as the name of the published + item. + properties: + description: + description: Description is the description to assign to the + published object. + type: string + name: + description: |- + Name is the name of the published object. + + + If the spec.target.location.apiVersion equals + imageregistry.vmware.com/v1alpha1 and the spec.target.location.kind + equals ContentLibrary, then this should be the name that will + show up in vCenter Content Library, not the custom resource name + in the namespace. + + + If omitted then the controller will use spec.source.name + "-image". + type: string + type: object + location: + description: |- + Location contains information about the location to which to publish + the VM. + properties: + apiVersion: + default: imageregistry.vmware.com/v1alpha1 + description: APIVersion is the API version of the referenced + object. + type: string + kind: + default: ContentLibrary + description: Kind is the kind of referenced object. + type: string + name: + description: |- + Name is the name of the referenced object. + + + Please note an error will be returned if this field is not + set in a namespace that lacks a default publication target. + + + A default publication target is a resource with an API version + equal to spec.target.location.apiVersion, a kind equal to + spec.target.location.kind, and has the label + "imageregistry.vmware.com/default". type: string type: object type: object diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachines.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachines.yaml index 63dc346c7a..4630d057aa 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachines.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachines.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachines.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -38,20 +38,26 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachine is the Schema for the virtualmachines API. A VirtualMachine - represents the desired specification and the observed status of a VirtualMachine - instance. A VirtualMachine is realized by the VirtualMachine controller - on a backing Virtual Infrastructure provider such as vSphere. + description: |- + VirtualMachine is the Schema for the virtualmachines API. + A VirtualMachine represents the desired specification and the observed status of a VirtualMachine instance. A + VirtualMachine is realized by the VirtualMachine controller on a backing Virtual Infrastructure provider such as + vSphere. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -63,123 +69,140 @@ spec: options for configuring a VirtualMachine properties: changeBlockTracking: - description: ChangeBlockTracking specifies the enablement of incremental - backup support for this VirtualMachine, which can be utilized + description: |- + ChangeBlockTracking specifies the enablement of incremental backup support for this VirtualMachine, which can be utilized by external backup systems such as VMware Data Recovery. type: boolean defaultVolumeProvisioningOptions: - description: DefaultProvisioningOptions specifies the provisioning - type to be used by default for VirtualMachine volumes exclusively - owned by this VirtualMachine. This does not apply to PersistentVolumeClaim - volumes that are created and managed externally. + description: |- + DefaultProvisioningOptions specifies the provisioning type to be used by default for VirtualMachine volumes exclusively + owned by this VirtualMachine. This does not apply to PersistentVolumeClaim volumes that are created and managed externally. properties: eagerZeroed: - description: EagerZeroed specifies whether to use eager zero - provisioning for the VirtualMachineVolume. An eager zeroed - thick disk has all space allocated and wiped clean of any - previous contents on the physical media at creation time. - Such disks may take longer time during creation compared - to other disk formats. EagerZeroed is only applicable if - ThinProvisioned is false. This is validated by the webhook. + description: |- + EagerZeroed specifies whether to use eager zero provisioning for the VirtualMachineVolume. + An eager zeroed thick disk has all space allocated and wiped clean of any previous contents + on the physical media at creation time. Such disks may take longer time during creation + compared to other disk formats. + EagerZeroed is only applicable if ThinProvisioned is false. This is validated by the webhook. type: boolean thinProvisioned: - description: ThinProvisioned specifies whether to use thin - provisioning for the VirtualMachineVolume. This means a - sparse (allocate on demand) format with additional space - optimizations. + description: |- + ThinProvisioned specifies whether to use thin provisioning for the VirtualMachineVolume. + This means a sparse (allocate on demand) format with additional space optimizations. type: boolean type: object type: object className: - description: ClassName describes the name of a VirtualMachineClass - that is to be used as the overlaid resource configuration of VirtualMachine. A - VirtualMachineClass is used to further customize the attributes - of the VirtualMachine instance. See VirtualMachineClass for more - description. + description: |- + ClassName describes the name of a VirtualMachineClass that is to be used as the overlaid resource configuration + of VirtualMachine. A VirtualMachineClass is used to further customize the attributes of the VirtualMachine + instance. See VirtualMachineClass for more description. type: string imageName: - description: "ImageName describes the name of the image resource used - to deploy this VM. \n This field may be used to specify the name - of a VirtualMachineImage or ClusterVirtualMachineImage resource. - The resolver first checks to see if there is a VirtualMachineImage - with the specified name. If no such resource exists, the resolver - then checks to see if there is a ClusterVirtualMachineImage resource - with the specified name in the same Namespace as the VM being deployed. - \n This field may also be used to specify the display name (vSphere - name) of a VirtualMachineImage or ClusterVirtualMachineImage resource. - If the display name unambiguously resolves to a distinct VM image - (among all existing VirtualMachineImages in the VM's namespace and - all existing ClusterVirtualMachineImages), then a mutation webhook - updates this field with the VM image resource name. If the display - name resolves to multiple or no VM images, then the mutation webhook - denies the request and outputs an error message accordingly." + description: |- + ImageName describes the name of the image resource used to deploy this + VM. + + + This field may be used to specify the name of a VirtualMachineImage + or ClusterVirtualMachineImage resource. The resolver first checks to see + if there is a VirtualMachineImage with the specified name. If no + such resource exists, the resolver then checks to see if there is a + ClusterVirtualMachineImage resource with the specified name in the same + Namespace as the VM being deployed. + + + This field may also be used to specify the display name (vSphere name) of + a VirtualMachineImage or ClusterVirtualMachineImage resource. If the + display name unambiguously resolves to a distinct VM image (among all + existing VirtualMachineImages in the VM's namespace and all existing + ClusterVirtualMachineImages), then a mutation webhook updates this field + with the VM image resource name. If the display name resolves to multiple + or no VM images, then the mutation webhook denies the request and outputs + an error message accordingly. type: string minHardwareVersion: - description: "MinHardwareVersion specifies the desired minimum hardware - version for this VM. \n Usually the VM's hardware version is derived - from: 1. the VirtualMachineClass used to deploy the VM provided - by the ClassName field 2. the datacenter/cluster/host default hardware - version Setting this field will ensure that the hardware version - of the VM is at least set to the specified value. To enforce this, - it will override the value from the VirtualMachineClass. \n This - field is never updated to reflect the derived hardware version. - Instead, VirtualMachineStatus.HardwareVersion surfaces the observed - hardware version. \n Please note, setting this field's value to - N ensures a VM's hardware version is equal to or greater than N. - For example, if a VM's observed hardware version is 10 and this - field's value is 13, then the VM will be upgraded to hardware version - 13. However, if the observed hardware version is 17 and this field's - value is 13, no change will occur. \n Several features are hardware - version dependent, for example: \n * NVMe Controllers >= - 14 * Dynamic Direct Path I/O devices >= 17 \n Please refer to https://kb.vmware.com/s/article/1003746 - for a list of VM hardware versions. \n It is important to remember - that a VM's hardware version may not be downgraded and upgrading - a VM deployed from an image based on an older hardware version to - a more recent one may result in unpredictable behavior. In other - words, please be careful when choosing to upgrade a VM to a newer - hardware version." + description: |- + MinHardwareVersion specifies the desired minimum hardware version + for this VM. + + + Usually the VM's hardware version is derived from: + 1. the VirtualMachineClass used to deploy the VM provided by the ClassName field + 2. the datacenter/cluster/host default hardware version + Setting this field will ensure that the hardware version of the VM + is at least set to the specified value. To enforce this, it will override + the value from the VirtualMachineClass. + + + This field is never updated to reflect the derived hardware version. + Instead, VirtualMachineStatus.HardwareVersion surfaces + the observed hardware version. + + + Please note, setting this field's value to N ensures a VM's hardware + version is equal to or greater than N. For example, if a VM's observed + hardware version is 10 and this field's value is 13, then the VM will be + upgraded to hardware version 13. However, if the observed hardware + version is 17 and this field's value is 13, no change will occur. + + + Several features are hardware version dependent, for example: + + + * NVMe Controllers >= 14 + * Dynamic Direct Path I/O devices >= 17 + + + Please refer to https://kb.vmware.com/s/article/1003746 for a list of VM + hardware versions. + + + It is important to remember that a VM's hardware version may not be + downgraded and upgrading a VM deployed from an image based on an older + hardware version to a more recent one may result in unpredictable + behavior. In other words, please be careful when choosing to upgrade a + VM to a newer hardware version. format: int32 minimum: 13 type: integer networkInterfaces: - description: "NetworkInterfaces describes a list of VirtualMachineNetworkInterfaces - to be configured on the VirtualMachine instance. Each of these VirtualMachineNetworkInterfaces - describes external network integration configurations that are to - be used by the VirtualMachine controller when integrating the VirtualMachine - into one or more external networks. \n The maximum number of network - interface allowed is 10 because of the limit built into vSphere." + description: |- + NetworkInterfaces describes a list of VirtualMachineNetworkInterfaces to be configured on the VirtualMachine instance. + Each of these VirtualMachineNetworkInterfaces describes external network integration configurations that are to be + used by the VirtualMachine controller when integrating the VirtualMachine into one or more external networks. + + + The maximum number of network interface allowed is 10 because of the limit built into vSphere. items: - description: VirtualMachineNetworkInterface defines the properties - of a network interface to attach to a VirtualMachine instance. A - VirtualMachineNetworkInterface describes network interface configuration - that is used by the VirtualMachine controller when integrating - the VirtualMachine into a VirtualNetwork. Currently, only NSX-T - and vSphere Distributed Switch (VDS) type network integrations - are supported using this VirtualMachineNetworkInterface structure. + description: |- + VirtualMachineNetworkInterface defines the properties of a network interface to attach to a VirtualMachine + instance. A VirtualMachineNetworkInterface describes network interface configuration that is used by the + VirtualMachine controller when integrating the VirtualMachine into a VirtualNetwork. Currently, only NSX-T + and vSphere Distributed Switch (VDS) type network integrations are supported using this VirtualMachineNetworkInterface + structure. properties: ethernetCardType: - description: EthernetCardType describes an optional ethernet - card that should be used by the VirtualNetworkInterface (vNIC) - associated with this network integration. The default is - "vmxnet3". + description: |- + EthernetCardType describes an optional ethernet card that should be used by the VirtualNetworkInterface (vNIC) + associated with this network integration. The default is "vmxnet3". type: string networkName: - description: NetworkName describes the name of an existing virtual - network that this interface should be added to. For "nsx-t" - NetworkType, this is the name of a pre-existing NSX-T VirtualNetwork. - If unspecified, the default network for the namespace will - be used. For "vsphere-distributed" NetworkType, the NetworkName - must be specified. + description: |- + NetworkName describes the name of an existing virtual network that this interface should be added to. + For "nsx-t" NetworkType, this is the name of a pre-existing NSX-T VirtualNetwork. If unspecified, + the default network for the namespace will be used. For "vsphere-distributed" NetworkType, the + NetworkName must be specified. type: string networkType: - description: NetworkType describes the type of VirtualNetwork - that is referenced by the NetworkName. Currently, the supported - NetworkTypes are "nsx-t", "nsx-t-subnet", "nsx-t-subnetset" - and "vsphere-distributed". + description: |- + NetworkType describes the type of VirtualNetwork that is referenced by the NetworkName. Currently, the supported + NetworkTypes are "nsx-t", "nsx-t-subnet", "nsx-t-subnetset" and "vsphere-distributed". type: string providerRef: - description: ProviderRef is reference to a network interface - provider object that specifies the network interface configuration. + description: |- + ProviderRef is reference to a network interface provider object that specifies the network interface configuration. If unset, default configuration is assumed. properties: apiGroup: @@ -204,14 +227,21 @@ spec: maxItems: 10 type: array nextRestartTime: - description: "NextRestartTime may be used to restart the VM, in accordance - with RestartMode, by setting the value of this field to \"now\" - (case-insensitive). \n A mutating webhook changes this value to - the current time (UTC), which the VM controller then uses to determine - the VM should be restarted by comparing the value to the timestamp - of the last time the VM was restarted. \n Please note it is not - possible to schedule future restarts using this field. The only - value that users may set is the string \"now\" (case-insensitive)." + description: |- + NextRestartTime may be used to restart the VM, in accordance with + RestartMode, by setting the value of this field to "now" + (case-insensitive). + + + A mutating webhook changes this value to the current time (UTC), which + the VM controller then uses to determine the VM should be restarted by + comparing the value to the timestamp of the last time the VM was + restarted. + + + Please note it is not possible to schedule future restarts using this + field. The only value that users may set is the string "now" + (case-insensitive). type: string ports: description: Ports is currently unused and can be considered deprecated. @@ -237,38 +267,48 @@ spec: type: array powerOffMode: default: hard - description: "PowerOffMode describes the desired behavior when powering - off a VM. \n There are three, supported power off modes: hard, soft, - and trySoft. The first mode, hard, is the equivalent of a physical - system's power cord being ripped from the wall. The soft mode requires - the VM's guest to have VM Tools installed and attempts to gracefully - shutdown the VM. Its variant, trySoft, first attempts a graceful - shutdown, and if that fails or the VM is not in a powered off state - after five minutes, the VM is halted. \n If omitted, the mode defaults - to hard." + description: |- + PowerOffMode describes the desired behavior when powering off a VM. + + + There are three, supported power off modes: hard, soft, and + trySoft. The first mode, hard, is the equivalent of a physical + system's power cord being ripped from the wall. The soft mode + requires the VM's guest to have VM Tools installed and attempts to + gracefully shutdown the VM. Its variant, trySoft, first attempts + a graceful shutdown, and if that fails or the VM is not in a powered off + state after five minutes, the VM is halted. + + + If omitted, the mode defaults to hard. enum: - hard - soft - trySoft type: string powerState: - description: "PowerState describes the desired power state of a VirtualMachine. - \n Please note this field may be omitted when creating a new VM - and will default to \"poweredOn.\" However, once the field is set - to a non-empty value, it may no longer be set to an empty value. - \n Additionally, setting this value to \"suspended\" is not supported - when creating a new VM. The valid values when creating a new VM - are \"poweredOn\" and \"poweredOff.\" An empty value is also allowed - on create since this value defaults to \"poweredOn\" for new VMs." + description: |- + PowerState describes the desired power state of a VirtualMachine. + + + Please note this field may be omitted when creating a new VM and will + default to "poweredOn." However, once the field is set to a non-empty + value, it may no longer be set to an empty value. + + + Additionally, setting this value to "suspended" is not supported when + creating a new VM. The valid values when creating a new VM are + "poweredOn" and "poweredOff." An empty value is also allowed on create + since this value defaults to "poweredOn" for new VMs. enum: - poweredOn - poweredOff - suspended type: string readinessProbe: - description: ReadinessProbe describes a network probe that can be - used to determine if the VirtualMachine is available and responding - to the probe. + description: |- + ReadinessProbe describes a network probe that can be used to determine if the VirtualMachine is available and + responding to the probe. properties: guestHeartbeat: description: GuestHeartbeat specifies an action involving the @@ -276,25 +316,28 @@ spec: properties: thresholdStatus: default: green - description: ThresholdStatus is the value that the guest heartbeat - status must be at or above to be considered successful. + description: |- + ThresholdStatus is the value that the guest heartbeat status must be at or above to be + considered successful. enum: - yellow - green type: string type: object periodSeconds: - description: PeriodSeconds specifics how often (in seconds) to - perform the probe. Defaults to 10 seconds. Minimum value is - 1. + description: |- + PeriodSeconds specifics how often (in seconds) to perform the probe. + Defaults to 10 seconds. Minimum value is 1. format: int32 minimum: 1 type: integer tcpSocket: - description: "TCPSocket specifies an action involving a TCP port. - \n Deprecated: The TCPSocket action requires network connectivity - that is not supported in all environments. This field will be - removed in a later API version." + description: |- + TCPSocket specifies an action involving a TCP port. + + + Deprecated: The TCPSocket action requires network connectivity that is not supported in all environments. + This field will be removed in a later API version. properties: host: description: Host is an optional host name to connect to. Host @@ -304,59 +347,70 @@ spec: anyOf: - type: integer - type: string - description: Port specifies a number or name of the port to - access on the VirtualMachine. If the format of port is a - number, it must be in the range 1 to 65535. If the format - of name is a string, it must be an IANA_SVC_NAME. + description: |- + Port specifies a number or name of the port to access on the VirtualMachine. + If the format of port is a number, it must be in the range 1 to 65535. + If the format of name is a string, it must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object timeoutSeconds: - description: TimeoutSeconds specifies a number of seconds after - which the probe times out. Defaults to 10 seconds. Minimum value - is 1. + description: |- + TimeoutSeconds specifies a number of seconds after which the probe times out. + Defaults to 10 seconds. Minimum value is 1. format: int32 maximum: 60 minimum: 1 type: integer type: object resourcePolicyName: - description: ResourcePolicyName describes the name of a VirtualMachineSetResourcePolicy - to be used when creating the VirtualMachine instance. + description: |- + ResourcePolicyName describes the name of a VirtualMachineSetResourcePolicy to be used when creating the + VirtualMachine instance. type: string restartMode: default: hard - description: "RestartMode describes the desired behavior for restarting - a VM when spec.nextRestartTime is set to \"now\" (case-insensitive). - \n There are three, supported suspend modes: hard, soft, and trySoft. - The first mode, hard, is where vSphere resets the VM without any - interaction inside of the guest. The soft mode requires the VM's - guest to have VM Tools installed and asks the guest to restart the - VM. Its variant, trySoft, first attempts a soft restart, and if - that fails or does not complete within five minutes, the VM is hard - reset. \n If omitted, the mode defaults to hard." + description: |- + RestartMode describes the desired behavior for restarting a VM when + spec.nextRestartTime is set to "now" (case-insensitive). + + + There are three, supported suspend modes: hard, soft, and + trySoft. The first mode, hard, is where vSphere resets the VM without any + interaction inside of the guest. The soft mode requires the VM's guest to + have VM Tools installed and asks the guest to restart the VM. Its + variant, trySoft, first attempts a soft restart, and if that fails or + does not complete within five minutes, the VM is hard reset. + + + If omitted, the mode defaults to hard. enum: - hard - soft - trySoft type: string storageClass: - description: StorageClass describes the name of a StorageClass that - should be used to configure storage-related attributes of the VirtualMachine + description: |- + StorageClass describes the name of a StorageClass that should be used to configure storage-related attributes of the VirtualMachine instance. type: string suspendMode: default: hard - description: "SuspendMode describes the desired behavior when suspending - a VM. \n There are three, supported suspend modes: hard, soft, and - trySoft. The first mode, hard, is where vSphere suspends the VM - to disk without any interaction inside of the guest. The soft mode - requires the VM's guest to have VM Tools installed and attempts - to gracefully suspend the VM. Its variant, trySoft, first attempts - a graceful suspend, and if that fails or the VM is not in a put - into standby by the guest after five minutes, the VM is suspended. - \n If omitted, the mode defaults to hard." + description: |- + SuspendMode describes the desired behavior when suspending a VM. + + + There are three, supported suspend modes: hard, soft, and + trySoft. The first mode, hard, is where vSphere suspends the VM to + disk without any interaction inside of the guest. The soft mode + requires the VM's guest to have VM Tools installed and attempts to + gracefully suspend the VM. Its variant, trySoft, first attempts + a graceful suspend, and if that fails or the VM is not in a put into + standby by the guest after five minutes, the VM is suspended. + + + If omitted, the mode defaults to hard. enum: - hard - soft @@ -367,27 +421,23 @@ spec: be passed to the Guest OS. properties: configMapName: - description: ConfigMapName describes the name of the ConfigMap, - in the same Namespace as the VirtualMachine, that should be - used for VirtualMachine metadata. The contents of the Data - field of the ConfigMap is used as the VM Metadata. The format - of the contents of the VM Metadata are not parsed or interpreted - by the VirtualMachine controller. Please note, this field and - SecretName are mutually exclusive. + description: |- + ConfigMapName describes the name of the ConfigMap, in the same Namespace as the VirtualMachine, that should be + used for VirtualMachine metadata. The contents of the Data field of the ConfigMap is used as the VM Metadata. + The format of the contents of the VM Metadata are not parsed or interpreted by the VirtualMachine controller. + Please note, this field and SecretName are mutually exclusive. type: string secretName: - description: SecretName describes the name of the Secret, in the - same Namespace as the VirtualMachine, that should be used for - VirtualMachine metadata. The contents of the Data field of the - Secret is used as the VM Metadata. The format of the contents - of the VM Metadata are not parsed or interpreted by the VirtualMachine - controller. Please note, this field and ConfigMapName are mutually - exclusive. + description: |- + SecretName describes the name of the Secret, in the same Namespace as the VirtualMachine, that should be used + for VirtualMachine metadata. The contents of the Data field of the Secret is used as the VM Metadata. + The format of the contents of the VM Metadata are not parsed or interpreted by the VirtualMachine controller. + Please note, this field and ConfigMapName are mutually exclusive. type: string transport: - description: Transport describes the name of a supported VirtualMachineMetadata - transport protocol. Currently, the only supported transport - protocols are "ExtraConfig", "OvfEnv" and "CloudInit". + description: |- + Transport describes the name of a supported VirtualMachineMetadata transport protocol. Currently, the only supported + transport protocols are "ExtraConfig", "OvfEnv" and "CloudInit". enum: - ExtraConfig - OvfEnv @@ -397,32 +447,37 @@ spec: type: string type: object volumes: - description: Volumes describes the list of VirtualMachineVolumes that - are desired to be attached to the VirtualMachine. Each of these - volumes specifies a volume identity that the VirtualMachine controller - will attempt to satisfy, potentially with an external Volume Management - service. + description: |- + Volumes describes the list of VirtualMachineVolumes that are desired to be attached to the VirtualMachine. Each of + these volumes specifies a volume identity that the VirtualMachine controller will attempt to satisfy, potentially + with an external Volume Management service. items: - description: VirtualMachineVolume describes a Volume that should - be attached to a specific VirtualMachine. Only one of PersistentVolumeClaim, - VsphereVolume should be specified. + description: |- + VirtualMachineVolume describes a Volume that should be attached to a specific VirtualMachine. + Only one of PersistentVolumeClaim, VsphereVolume should be specified. properties: name: - description: Name specifies the name of the VirtualMachineVolume. Each - volume within the scope of a VirtualMachine must have a unique - name. + description: |- + Name specifies the name of the VirtualMachineVolume. Each volume within the scope of a VirtualMachine must + have a unique name. type: string persistentVolumeClaim: - description: "PersistentVolumeClaim represents a reference to - a PersistentVolumeClaim in the same namespace. The PersistentVolumeClaim - must match one of the following: \n * A volume provisioned - (either statically or dynamically) by the cluster's CSI provider. - \n * An instance volume with a lifecycle coupled to the VM." + description: |- + PersistentVolumeClaim represents a reference to a PersistentVolumeClaim + in the same namespace. The PersistentVolumeClaim must match one of the + following: + + + * A volume provisioned (either statically or dynamically) by the + cluster's CSI provider. + + + * An instance volume with a lifecycle coupled to the VM. properties: claimName: - description: 'claimName is the name of a PersistentVolumeClaim - in the same namespace as the pod using this volume. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims type: string instanceVolumeClaim: description: InstanceVolumeClaim is set if the PVC is backed @@ -437,24 +492,25 @@ spec: pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true storageClass: - description: StorageClass is the name of the Kubernetes - StorageClass that provides the backing storage for - this instance storage volume. + description: |- + StorageClass is the name of the Kubernetes StorageClass that provides + the backing storage for this instance storage volume. type: string required: - size - storageClass type: object readOnly: - description: readOnly Will force the ReadOnly setting in - VolumeMounts. Default false. + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. type: boolean required: - claimName type: object vSphereVolume: - description: VsphereVolume represents a reference to a VsphereVolumeSource - in the same namespace. Only one of PersistentVolumeClaim or + description: |- + VsphereVolume represents a reference to a VsphereVolumeSource in the same namespace. Only one of PersistentVolumeClaim or VsphereVolume can be specified. This is enforced via a webhook properties: capacity: @@ -484,9 +540,9 @@ spec: instance. properties: biosUUID: - description: BiosUUID describes a unique identifier provided by the - underlying infrastructure provider that is exposed to the Guest - OS BIOS as a unique hardware identifier. + description: |- + BiosUUID describes a unique identifier provided by the underlying infrastructure provider that is exposed to the + Guest OS BIOS as a unique hardware identifier. type: string changeBlockTracking: description: ChangeBlockTracking describes the CBT enablement status @@ -500,37 +556,37 @@ spec: resource operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to disambiguate - is important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to disambiguate is important. type: string required: - status @@ -538,9 +594,13 @@ spec: type: object type: array hardwareVersion: - description: "HardwareVersion describes the VirtualMachine resource's - observed hardware version. \n Please refer to VirtualMachineSpec.MinHardwareVersion - for more information on the topic of a VM's hardware version." + description: |- + HardwareVersion describes the VirtualMachine resource's observed + hardware version. + + + Please refer to VirtualMachineSpec.MinHardwareVersion for more + information on the topic of a VM's hardware version. format: int32 type: integer host: @@ -556,22 +616,22 @@ spec: format: date-time type: string networkInterfaces: - description: NetworkInterfaces describes a list of current status - information for each network interface that is desired to be attached - to the VirtualMachine. + description: |- + NetworkInterfaces describes a list of current status information for each network interface that is desired to + be attached to the VirtualMachine. items: - description: NetworkInterfaceStatus defines the observed state of - network interfaces attached to the VirtualMachine as seen by the - Guest OS and VMware tools. + description: |- + NetworkInterfaceStatus defines the observed state of network interfaces attached to the VirtualMachine + as seen by the Guest OS and VMware tools. properties: connected: description: Connected represents whether the network interface is connected or not. type: boolean ipAddresses: - description: IpAddresses represents zero, one or more IP addresses - assigned to the network interface in CIDR notation. For eg, - "192.0.2.1/16". + description: |- + IpAddresses represents zero, one or more IP addresses assigned to the network interface in CIDR notation. + For eg, "192.0.2.1/16". items: type: string type: array @@ -594,18 +654,20 @@ spec: - suspended type: string uniqueID: - description: UniqueID describes a unique identifier that is provided - by the underlying infrastructure provider, such as vSphere. + description: |- + UniqueID describes a unique identifier that is provided by the underlying infrastructure provider, such as + vSphere. type: string vmIp: - description: VmIp describes the Primary IP address assigned to the - guest operating system, if known. Multiple IPs can be available - for the VirtualMachine. Refer to networkInterfaces in the VirtualMachine + description: |- + VmIp describes the Primary IP address assigned to the guest operating system, if known. + Multiple IPs can be available for the VirtualMachine. Refer to networkInterfaces in the VirtualMachine status for additional IPs type: string volumes: - description: Volumes describes a list of current status information - for each Volume that is desired to be attached to the VirtualMachine. + description: |- + Volumes describes a list of current status information for each Volume that is desired to be attached to the + VirtualMachine. items: description: VirtualMachineVolumeStatus defines the observed state of a VirtualMachineVolume instance. @@ -634,9 +696,2408 @@ spec: type: object type: array zone: - description: Zone describes the availability zone where the VirtualMachine - has been scheduled. Please note this field may be empty when the - cluster is not zone-aware. + description: |- + Zone describes the availability zone where the VirtualMachine has been scheduled. + Please note this field may be empty when the cluster is not zone-aware. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.powerState + name: Power-State + type: string + - jsonPath: .spec.className + name: Class + priority: 1 + type: string + - jsonPath: .spec.imageName + name: Image + priority: 1 + type: string + - jsonPath: .status.network.primaryIP4 + name: Primary-IP4 + priority: 1 + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + VirtualMachine is the schema for the virtualmachines API and represents the + desired state and observed status of a virtualmachines resource. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VirtualMachineSpec defines the desired state of a VirtualMachine. + properties: + advanced: + description: Advanced describes a set of optional, advanced VM configuration + options. + properties: + bootDiskCapacity: + anyOf: + - type: integer + - type: string + description: |- + BootDiskCapacity is the capacity of the VM's boot disk -- the first disk + from the VirtualMachineImage from which the VM was deployed. + + + Please note it is not advised to change this value while the VM is + running. Also, resizing the VM's boot disk may require actions inside of + the guest to take advantage of the additional capacity. Finally, changing + the size of the VM's boot disk, even increasing it, could adversely + affect the VM. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + changeBlockTracking: + description: |- + ChangeBlockTracking is a flag that enables incremental backup support + for this VM, a feature utilized by external backup systems such as + VMware Data Recovery. + type: boolean + defaultVolumeProvisioningMode: + description: |- + DefaultVolumeProvisioningMode specifies the default provisioning mode for + persistent volumes managed by this VM. + enum: + - Thin + - Thick + - ThickEagerZero + type: string + type: object + bootstrap: + description: |- + Bootstrap describes the desired state of the guest's bootstrap + configuration. + + + If omitted, a default bootstrap method may be selected based on the + guest OS identifier. If Linux, then the LinuxPrep method is used. + properties: + cloudInit: + description: |- + CloudInit may be used to bootstrap Linux guests with Cloud-Init or + Windows guests that support Cloudbase-Init. + + + The guest's networking stack is configured by Cloud-Init on Linux guests + and Cloudbase-Init on Windows guests. + + + Please note this bootstrap provider may not be used in conjunction with + the other bootstrap providers. + properties: + cloudConfig: + description: |- + CloudConfig describes a subset of a Cloud-Init CloudConfig, used to + bootstrap the VM. + + + Please note this field and RawCloudConfig are mutually exclusive. + properties: + defaultUserEnabled: + description: |- + DefaultUserEnabled may be set to true to ensure even if the Users field + is not empty, the default user is still created on systems that have one + defined. By default, Cloud-Init ignores the default user if the + CloudConfig provides one or more non-default users via the Users field. + type: boolean + runcmd: + description: |- + RunCmd allows running one or more commands on the guest. + The entries in this list can adhere to two, different formats: + + + Format 1 -- a string that contains the command and its arguments, ex. + + + runcmd: + - "ls -al" + + + Format 2 -- a list of the command and its arguments, ex. + + + runcmd: + - - echo + - "Hello, world." + x-kubernetes-preserve-unknown-fields: true + ssh_pwauth: + description: |- + SSHPwdAuth sets whether or not to accept password authentication. ``true`` will enable password + auth. ``false`` will disable. Default: leave the value unchanged. In order for this + config to be applied, SSH may need to be restarted. On systemd systems, this restart will + only happen if the SSH service has already been started. On non-systemd systems, a + restart will be attempted regardless of the service state. + type: boolean + timezone: + description: Timezone describes the timezone represented + in /usr/share/zoneinfo. + type: string + users: + description: Users allows adding/configuring one or more + users on the guest. + items: + description: User is a CloudConfig user data structure. + properties: + create_groups: + description: |- + CreateGroups is a flag that may be set to false to disable creation of + specified user groups. + + + Defaults to true when Name is not "default". + type: boolean + expiredate: + description: ExpireData is the date on which the + user's account will be disabled. + type: string + gecos: + description: |- + Gecos is an optional comment about the user, usually a comma-separated + string of the user's real name and contact information. + type: string + groups: + description: Groups is an optional list of groups + to add to the user. + items: + type: string + type: array + hashed_passwd: + description: |- + HashedPasswd is a hash of the user's password that will be applied even + if the specified user already exists. + properties: + key: + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + homedir: + description: |- + Homedir is the optional home directory for the user. + + + Defaults to "/home/" when Name is not "default". + type: string + inactive: + description: |- + Inactive optionally represents the number of days until the user is + disabled. + format: int32 + type: integer + lock_passwd: + description: |- + LockPasswd disables password login. + + + Defaults to true when Name is not "default". + type: boolean + name: + description: |- + Name is the user's login name. + + + Please note this field may be set to the special value of "default" when + this User is the first element in the Users list from the CloudConfig. + When set to "default", all other fields from this User must be nil. + type: string + no_create_home: + description: |- + NoCreateHome prevents the creation of the home directory. + + + Defaults to false when Name is not "default". + type: boolean + no_log_init: + description: |- + NoLogInit prevents the initialization of lastlog and faillog for the + user. + + + Defaults to false when Name is not "default". + type: boolean + no_user_group: + description: |- + NoUserGroup prevents the creation of the group named after the user. + + + Defaults to false when Name is not "default". + type: boolean + passwd: + description: |- + Passwd is a hash of the user's password that will be applied only to + a newly created user. To apply a new, hashed password to an existing user + please use HashedPasswd instead. + properties: + key: + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + primary_group: + description: |- + PrimaryGroup is the primary group for the user. + + + Defaults to the value of the Name field when it is not "default". + type: string + selinux_user: + description: SELinuxUser is the SELinux user for + the user's login. + type: string + shell: + description: |- + Shell is the path to the user's login shell. + + + Please note the default is to set no shell, which results in a + system-specific default being used. + type: string + snapuser: + description: |- + SnapUser specifies an e-mail address to create the user as a Snappy user + through "snap create-user". + + + If an Ubuntu SSO account is associated with the address, the username and + SSH keys will be requested from there. + type: string + ssh_authorized_keys: + description: |- + SSHAuthorizedKeys is a list of SSH keys to add to the user's authorized + keys file. + + + Please note this field may not be combined with SSHRedirectUser. + items: + type: string + type: array + ssh_import_id: + description: |- + SSHImportID is a list of SSH IDs to import for the user. + + + Please note this field may not be combined with SSHRedirectUser. + items: + type: string + type: array + ssh_redirect_user: + description: |- + SSHRedirectUser may be set to true to disable SSH logins for this user. + + + Please note that when specified, all SSH keys from cloud meta-data will + be configured in a disabled state for this user. Any SSH login as this + user will timeout with a message to login instead as the default user. + + + This field may not be combined with SSHAuthorizedKeys or SSHImportID. + + + Defaults to false when Name is not "default". + type: boolean + sudo: + description: |- + Sudo is a sudo rule to apply to the user. + + + When omitted, no sudo rules will be applied to the user. + type: string + system: + description: |- + System is an optional flag that indicates the user should be created as + a system user with no home directory. + + + Defaults to false when Name is not "default". + type: boolean + uid: + description: |- + UID is the user's ID. + + + When omitted the guest will default to the next available number. + format: int64 + type: integer + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + write_files: + description: WriteFiles + items: + description: |- + WriteFile is a CloudConfig + write_file data structure. + properties: + append: + description: |- + Append specifies whether or not to append the content to an existing file + if the file specified by Path already exists. + type: boolean + content: + description: |- + Content is the optional content to write to the provided Path. + + + When omitted an empty file will be created or existing file will be + modified. + + + The value for this field can adhere to two, different formats: + + + Format 1 -- a string that contains the command and its arguments, ex. + + + content: Hello, world. + + + Please note that format 1 supports all of the manners of specifying a + YAML string. + + + Format 2 -- a secret reference with the name of the key that contains + the content for the file, ex. + + + content: + name: my-bootstrap-secret + key: my-file-content + x-kubernetes-preserve-unknown-fields: true + defer: + description: |- + Defer indicates to defer writing the file until Cloud-Init's "final" + stage, after users are created and packages are installed. + type: boolean + encoding: + default: text/plain + description: Encoding is an optional encoding type + of the content. + enum: + - b64 + - base64 + - gz + - gzip + - gz+b64 + - gz+base64 + - gzip+b64 + - gzip+base64 + - text/plain + type: string + owner: + default: root:root + description: Owner is an optional "owner:group" + to chown the file. + type: string + path: + description: Path is the path of the file to which + the content is decoded and written. + type: string + permissions: + default: "0644" + description: |- + Permissions an optional set of file permissions to set. + + + Please note the permissions should be specified as an octal string, ex. + "0###". + + + When omitted the guest will default this value to "0644". + type: string + required: + - path + type: object + type: array + x-kubernetes-list-map-keys: + - path + x-kubernetes-list-type: map + type: object + rawCloudConfig: + description: |- + RawCloudConfig describes a key in a Secret resource that contains the + CloudConfig data used to bootstrap the VM. + + + The CloudConfig data specified by the key may be plain-text, + base64-encoded, or gzipped and base64-encoded. + + + Please note this field and CloudConfig are mutually exclusive. + properties: + key: + description: Key is the key in the secret that specifies + the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + sshAuthorizedKeys: + description: |- + SSHAuthorizedKeys is a list of public keys that CloudInit will apply to + the guest's default user. + items: + type: string + type: array + type: object + linuxPrep: + description: |- + LinuxPrep may be used to bootstrap Linux guests. + + + The guest's networking stack is configured by Guest OS Customization + (GOSC). + + + Please note this bootstrap provider may be used in conjunction with the + VAppConfig bootstrap provider when wanting to configure the guest's + network with GOSC but also send vApp/OVF properties into the guest. + + + This bootstrap provider may not be used in conjunction with the CloudInit + or Sysprep bootstrap providers. + properties: + hardwareClockIsUTC: + description: |- + HardwareClockIsUTC specifies whether the hardware clock is in UTC or + local time. + type: boolean + timeZone: + description: |- + TimeZone is a case-sensitive timezone, such as Europe/Sofia. + + + Valid values are based on the tz (timezone) database used by Linux and + other Unix systems. The values are strings in the form of + "Area/Location," in which Area is a continent or ocean name, and + Location is the city, island, or other regional designation. + + + Please see https://kb.vmware.com/s/article/2145518 for a list of valid + time zones for Linux systems. + type: string + type: object + sysprep: + description: |- + Sysprep may be used to bootstrap Windows guests. + + + The guest's networking stack is configured by Guest OS Customization + (GOSC). + + + Please note this bootstrap provider may be used in conjunction with the + VAppConfig bootstrap provider when wanting to configure the guest's + network with GOSC but also send vApp/OVF properties into the guest. + + + This bootstrap provider may not be used in conjunction with the CloudInit + or LinuxPrep bootstrap providers. + properties: + rawSysprep: + description: |- + RawSysprep describes a key in a Secret resource that contains an XML + string of the Sysprep text used to bootstrap the VM. + + + The data specified by the Secret key may be plain-text, base64-encoded, + or gzipped and base64-encoded. + + + Please note this field and Sysprep are mutually exclusive. + properties: + key: + description: Key is the key in the secret that specifies + the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + sysprep: + description: |- + Sysprep is an object representation of a Windows sysprep.xml answer file. + + + This field encloses all the individual keys listed in a sysprep.xml file. + + + For more detailed information please see + https://technet.microsoft.com/en-us/library/cc771830(v=ws.10).aspx. + + + Please note this field and RawSysprep are mutually exclusive. + properties: + guiRunOnce: + description: GUIRunOnce is a representation of the Sysprep + GuiRunOnce key. + properties: + commands: + description: |- + Commands is a list of commands to run at first user logon, after guest + customization. + items: + type: string + type: array + type: object + guiUnattended: + description: GUIUnattended is a representation of the + Sysprep GUIUnattended key. + properties: + autoLogon: + description: |- + AutoLogon determine whether the machine automatically logs on as + Administrator. + + + Please note if AutoLogon is true, then Password must be set or guest + customization will fail. + type: boolean + autoLogonCount: + description: |- + AutoLogonCount specifies the number of times the machine should + automatically log on as Administrator. + + + Generally it should be 1, but if your setup requires a number of reboots, + you may want to increase it. This number may be determined by the list of + commands executed by the GuiRunOnce command. + + + Please note this field must be specified with a non-zero positive integer if AutoLogon is true. + format: int32 + type: integer + password: + description: |- + Password is the new administrator password for the machine. + + + To specify that the password should be set to blank (that is, no + password), set the password value to NULL. Because of encryption, "" is + NOT a valid value. + + + Please note if the password is set to blank and AutoLogon is true, the + guest customization will fail. + + + If the XML file is generated by the VirtualCenter Customization Wizard, + then the password is encrypted. Otherwise, the client should set the + plainText attribute to true, so that the customization process does not + attempt to decrypt the string. + + + When not explicitly specified, the Key field for the selector defaults to + `password`. + properties: + key: + default: password + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + timeZone: + description: |- + TimeZone is the time zone index for the virtual machine. + + + Please note that numbers correspond to time zones listed at + https://bit.ly/3Rzv8oL. + format: int32 + type: integer + type: object + identification: + description: Identification is a representation of the + Sysprep Identification key. + properties: + domainAdmin: + description: |- + DomainAdmin is the domain user account used for authentication if the + virtual machine is joining a domain. The user does not need to be a + domain administrator, but the account must have the privileges required + to add computers to the domain. + type: string + domainAdminPassword: + description: |- + DomainAdminPassword is the password for the domain user account used for + authentication if the virtual machine is joining a domain. + + + When not explicitly specified, the Key field for the selector defaults to + `domain_admin_password`. + properties: + key: + default: domain_admin_password + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + joinDomain: + description: |- + JoinDomain is the domain that the virtual machine should join. If this + value is supplied, then DomainAdmin and DomainAdminPassword must also be + supplied, and the JoinWorkgroup name must be empty. + type: string + joinWorkgroup: + description: |- + JoinWorkgroup is the workgroup that the virtual machine should join. If + this value is supplied, then the JoinDomain and the authentication fields + (DomainAdmin and DomainAdminPassword) must be empty. + type: string + type: object + licenseFilePrintData: + description: |- + LicenseFilePrintData is a representation of the Sysprep + LicenseFilePrintData key. + + + Please note this is required only for Windows 2000 Server and Windows + Server 2003. + properties: + autoMode: + description: AutoMode specifies the server licensing + mode. + enum: + - perSeat + - perServer + type: string + autoUsers: + description: |- + AutoUsers indicates the number of client licenses purchased for the + VirtualCenter server being installed. + + + Please note this value is ignored unless AutoMode is PerServer. + format: int32 + type: integer + required: + - autoMode + type: object + userData: + description: UserData is a representation of the Sysprep + UserData key. + properties: + fullName: + description: FullName is the user's full name. + type: string + orgName: + description: OrgName is the name of the user's organization. + type: string + productID: + description: |- + ProductID is a valid serial number. + + + Please note unless the VirtualMachineImage was installed with a volume + license key, ProductID must be set or guest customization will fail. + + + When not explicitly specified, the Key field for the selector defaults to + `domain_admin_password`. + properties: + key: + default: product_id + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + required: + - fullName + - orgName + type: object + required: + - userData + type: object + type: object + vAppConfig: + description: |- + VAppConfig may be used to bootstrap guests that rely on vApp properties + (how VMware surfaces OVF properties on guests) to transport data into the + guest. + + + The guest's networking stack may be configured using either vApp + properties or GOSC. + + + Many OVFs define one or more properties that are used by the guest to + bootstrap its networking stack. If the VirtualMachineImage defines one or + more properties like this, then they can be configured to use the network + data provided for this VM at runtime by setting these properties to Go + template strings. + + + It is also possible to use GOSC to bootstrap this VM's network stack by + configuring either the LinuxPrep or Sysprep bootstrap providers. + + + Please note the VAppConfig bootstrap provider in conjunction with the + LinuxPrep bootstrap provider is the equivalent of setting the v1alpha1 + VM metadata transport to "OvfEnv". + + + This bootstrap provider may not be used in conjunction with the CloudInit + bootstrap provider. + properties: + properties: + description: |- + Properties is a list of vApp/OVF property key/value pairs. + + + Please note this field and RawProperties are mutually exclusive. + items: + description: |- + KeyValueOrSecretKeySelectorPair is useful when wanting to realize a map as a + list of key/value pairs where each value could also reference data stored in + a Secret resource. + properties: + key: + description: Key is the key part of the key/value pair. + type: string + value: + description: Value is the optional value part of the + key/value pair. + properties: + from: + description: |- + From is specified to reference a value from a Secret resource. + + + Please note this field is mutually exclusive with the Value field. + properties: + key: + description: Key is the key in the secret that + specifies the requested data. + type: string + name: + description: Name is the name of the secret. + type: string + required: + - key + - name + type: object + value: + description: |- + Value is used to directly specify a value. + + + Please note this field is mutually exclusive with the From field. + type: string + type: object + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + rawProperties: + description: |- + RawProperties is the name of a Secret resource in the same Namespace as + this VM where each key/value pair from the Secret is used as a vApp + key/value pair. + + + Please note this field and Properties are mutually exclusive. + type: string + type: object + type: object + className: + description: |- + ClassName describes the name of the VirtualMachineClass resource used to + deploy this VM. + type: string + imageName: + description: |- + ImageName describes the name of the image resource used to deploy this + VM. + + + This field may be used to specify the name of a VirtualMachineImage + or ClusterVirtualMachineImage resource. The resolver first checks to see + if there is a VirtualMachineImage with the specified name. If no + such resource exists, the resolver then checks to see if there is a + ClusterVirtualMachineImage resource with the specified name in the same + Namespace as the VM being deployed. + + + This field may also be used to specify the display name (vSphere name) of + a VirtualMachineImage or ClusterVirtualMachineImage resource. If the + display name unambiguously resolves to a distinct VM image (among all + existing VirtualMachineImages in the VM's namespace and all existing + ClusterVirtualMachineImages), then a mutation webhook updates this field + with the VM image resource name. If the display name resolves to multiple + or no VM images, then the mutation webhook denies the request and outputs + an error message accordingly. + type: string + minHardwareVersion: + description: |- + MinHardwareVersion describes the desired, minimum hardware version. + + + The logic that determines the hardware version is as follows: + + + 1. If this field is set, then its value is used. + 2. Otherwise, if the VirtualMachineClass used to deploy the VM contains a + non-empty hardware version, then it is used. + 3. Finally, if the hardware version is still undetermined, the value is + set to the default hardware version for the Datacenter/Cluster/Host + where the VM is provisioned. + + + This field is never updated to reflect the derived hardware version. + Instead, VirtualMachineStatus.HardwareVersion surfaces + the observed hardware version. + + + Please note, setting this field's value to N ensures a VM's hardware + version is equal to or greater than N. For example, if a VM's observed + hardware version is 10 and this field's value is 13, then the VM will be + upgraded to hardware version 13. However, if the observed hardware + version is 17 and this field's value is 13, no change will occur. + + + Several features are hardware version dependent, for example: + + + * NVMe Controllers >= 14 + * Dynamic Direct Path I/O devices >= 17 + + + Please refer to https://kb.vmware.com/s/article/1003746 for a list of VM + hardware versions. + + + It is important to remember that a VM's hardware version may not be + downgraded and upgrading a VM deployed from an image based on an older + hardware version to a more recent one may result in unpredictable + behavior. In other words, please be careful when choosing to upgrade a + VM to a newer hardware version. + format: int32 + minimum: 13 + type: integer + network: + description: |- + Network describes the desired network configuration for the VM. + + + Please note this value may be omitted entirely and the VM will be + assigned a single, virtual network interface that is connected to the + Namespace's default network. + properties: + disabled: + description: |- + Disabled is a flag that indicates whether or not to disable networking + for this VM. + + + When set to true, the VM is not configured with a default interface nor + any specified from the Interfaces field. + type: boolean + hostName: + description: |- + HostName is the value the guest uses as its host name. + If omitted then the name of the VM will be used. + + + Please note this feature is available only with the following bootstrap + providers: CloudInit, LinuxPrep, and Sysprep (except for RawSysprep). + + + When the bootstrap provider is Sysprep (except for RawSysprep) this is + used as the Computer Name. + type: string + interfaces: + description: |- + Interfaces is the list of network interfaces used by this VM. + + + If the Interfaces field is empty and the Disabled field is false, then + a default interface with the name eth0 will be created. + + + The maximum number of network interface allowed is 10 because of the limit + built into vSphere. + items: + description: |- + VirtualMachineNetworkInterfaceSpec describes the desired state of a VM's + network interface. + properties: + addresses: + description: |- + Addresses is an optional list of IP4 or IP6 addresses to assign to this + interface. + + + Please note this field is only supported if the connected network + supports manual IP allocation. + + + Please note IP4 and IP6 addresses must include the network prefix length, + ex. 192.168.0.10/24 or 2001:db8:101::a/64. + + + Please note this field may not contain IP4 addresses if DHCP4 is set + to true or IP6 addresses if DHCP6 is set to true. + + + Please note if the Interfaces field is non-empty then this field is + ignored and should be specified on the elements in the Interfaces list. + items: + type: string + type: array + dhcp4: + description: |- + DHCP4 indicates whether or not this interface uses DHCP for IP4 + networking. + + + Please note this field is only supported if the network connection + supports DHCP. + + + Please note this field is mutually exclusive with IP4 addresses in the + Addresses field and the Gateway4 field. + type: boolean + dhcp6: + description: |- + DHCP6 indicates whether or not this interface uses DHCP for IP6 + networking. + + + Please note this field is only supported if the network connection + supports DHCP. + + + Please note this field is mutually exclusive with IP6 addresses in the + Addresses field and the Gateway6 field. + type: boolean + gateway4: + description: |- + Gateway4 is the default, IP4 gateway for this interface. + + + Please note this field is only supported if the network connection + supports manual IP allocation. + + + If the network connection supports manual IP allocation and the + Addresses field includes at least one IP4 address, then this field + is required. + + + Please note the IP address must include the network prefix length, ex. + 192.168.0.1/24. + + + Please note this field is mutually exclusive with DHCP4. + type: string + gateway6: + description: |- + Gateway6 is the primary IP6 gateway for this interface. + + + Please note this field is only supported if the network connection + supports manual IP allocation. + + + If the network connection supports manual IP allocation and the + Addresses field includes at least one IP6 address, then this field + is required. + + + Please note the IP address must include the network prefix length, ex. + 2001:db8:101::1/64. + + + Please note this field is mutually exclusive with DHCP6. + type: string + guestDeviceName: + description: |- + GuestDeviceName is used to rename the device inside the guest when the + bootstrap provider is Cloud-Init. Please note it is up to the user to + ensure the provided device name does not conflict with any other devices + inside the guest, ex. dvd, cdrom, sda, etc. + pattern: ^\w\w+$ + type: string + mtu: + description: |- + MTU is the Maximum Transmission Unit size in bytes. + + + Please note this feature is available only with the following bootstrap + providers: CloudInit. + format: int64 + type: integer + name: + description: |- + Name describes the unique name of this network interface, used to + distinguish it from other network interfaces attached to this VM. + + + When the bootstrap provider is Cloud-Init and GuestDeviceName is not + specified, the device inside the guest will be renamed to this value. + Please note it is up to the user to ensure the provided name does not + conflict with any other devices inside the guest, ex. dvd, cdrom, sda, etc. + pattern: ^[a-z0-9]{2,}$ + type: string + nameservers: + description: |- + Nameservers is a list of IP4 and/or IP6 addresses used as DNS + nameservers. + + + Please note this feature is available only with the following bootstrap + providers: CloudInit and Sysprep. + + + Please note that Linux allows only three nameservers + (https://linux.die.net/man/5/resolv.conf). + items: + type: string + type: array + network: + description: |- + Network is the name of the network resource to which this interface is + connected. + + + If no network is provided, then this interface will be connected to the + Namespace's default network. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name refers to a unique resource in the current namespace. + More info: http://kubernetes.io/docs/user-guide/identifiers#names + type: string + required: + - name + type: object + routes: + description: |- + Routes is a list of optional, static routes. + + + Please note this feature is available only with the following bootstrap + providers: CloudInit. + items: + description: VirtualMachineNetworkRouteSpec defines a + static route for a guest. + properties: + metric: + description: Metric is the weight/priority of the + route. + format: int32 + type: integer + to: + description: To is an IP4 or IP6 address. + type: string + via: + description: Via is an IP4 or IP6 address. + type: string + required: + - metric + - to + - via + type: object + type: array + searchDomains: + description: |- + SearchDomains is a list of search domains used when resolving IP + addresses with DNS. + + + Please note this feature is available only with the following bootstrap + providers: CloudInit. + items: + type: string + type: array + required: + - name + type: object + maxItems: 10 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + nameservers: + description: |- + Nameservers is a list of IP4 and/or IP6 addresses used as DNS + nameservers. These are applied globally. + + + Please note global nameservers are only available with the following + bootstrap providers: LinuxPrep and Sysprep. The Cloud-Init bootstrap + provider supports per-interface nameservers. + + + Please note that Linux allows only three nameservers + (https://linux.die.net/man/5/resolv.conf). + items: + type: string + type: array + searchDomains: + description: |- + SearchDomains is a list of search domains used when resolving IP + addresses with DNS. These are applied globally. + + + Please note global search domains are only available with the following + bootstrap providers: LinuxPrep and Sysprep. The Cloud-Init bootstrap + provider supports per-interface search domains. + items: + type: string + type: array + type: object + nextRestartTime: + description: |- + NextRestartTime may be used to restart the VM, in accordance with + RestartMode, by setting the value of this field to "now" + (case-insensitive). + + + A mutating webhook changes this value to the current time (UTC), which + the VM controller then uses to determine the VM should be restarted by + comparing the value to the timestamp of the last time the VM was + restarted. + + + Please note it is not possible to schedule future restarts using this + field. The only value that users may set is the string "now" + (case-insensitive). + type: string + powerOffMode: + default: TrySoft + description: |- + PowerOffMode describes the desired behavior when powering off a VM. + + + There are three, supported power off modes: Hard, Soft, and + TrySoft. The first mode, Hard, is the equivalent of a physical + system's power cord being ripped from the wall. The Soft mode + requires the VM's guest to have VM Tools installed and attempts to + gracefully shutdown the VM. Its variant, TrySoft, first attempts + a graceful shutdown, and if that fails or the VM is not in a powered off + state after five minutes, the VM is halted. + + + If omitted, the mode defaults to TrySoft. + enum: + - Hard + - Soft + - TrySoft + type: string + powerState: + description: |- + PowerState describes the desired power state of a VirtualMachine. + + + Please note this field may be omitted when creating a new VM and will + default to "PoweredOn." However, once the field is set to a non-empty + value, it may no longer be set to an empty value. + + + Additionally, setting this value to "Suspended" is not supported when + creating a new VM. The valid values when creating a new VM are + "PoweredOn" and "PoweredOff." An empty value is also allowed on create + since this value defaults to "PoweredOn" for new VMs. + enum: + - PoweredOff + - PoweredOn + - Suspended + type: string + readinessProbe: + description: ReadinessProbe describes a probe used to determine the + VM's ready state. + properties: + guestHeartbeat: + description: GuestHeartbeat specifies an action involving the + guest heartbeat status. + properties: + thresholdStatus: + default: green + description: |- + ThresholdStatus is the value that the guest heartbeat status must be at or above to be + considered successful. + enum: + - yellow + - green + type: string + type: object + guestInfo: + description: |- + GuestInfo specifies an action involving key/value pairs from GuestInfo. + + + The elements are evaluated with the logical AND operator, meaning + all expressions must evaluate as true for the probe to succeed. + + + For example, a VM resource's probe definition could be specified as the + following: + + + guestInfo: + - key: ready + value: true + + + With the above configuration in place, the VM would not be considered + ready until the GuestInfo key "ready" was set to the value "true". + + + From within the guest operating system it is possible to set GuestInfo + key/value pairs using the program "vmware-rpctool," which is included + with VM Tools. For example, the following command will set the key + "guestinfo.ready" to the value "true": + + + vmware-rpctool "info-set guestinfo.ready true" + + + Once executed, the VM's readiness probe will be signaled and the + VM resource will be marked as ready. + items: + description: |- + GuestInfoAction describes a key from GuestInfo that must match the associated + value expression. + properties: + key: + description: |- + Key is the name of the GuestInfo key. + + + The key is automatically prefixed with "guestinfo." before being + evaluated. Thus if the key "guestinfo.mykey" is provided, it will be + evaluated as "guestinfo.guestinfo.mykey". + type: string + value: + description: |- + Value is a regular expression that is matched against the value of the + specified key. + + + An empty value is the equivalent of "match any" or ".*". + + + All values must adhere to the RE2 regular expression syntax as documented + at https://golang.org/s/re2syntax. Invalid values may be rejected or + ignored depending on the implementation of this API. Either way, invalid + values will not be considered when evaluating the ready state of a VM. + type: string + required: + - key + type: object + type: array + periodSeconds: + description: |- + PeriodSeconds specifics how often (in seconds) to perform the probe. + Defaults to 10 seconds. Minimum value is 1. + format: int32 + minimum: 1 + type: integer + tcpSocket: + description: |- + TCPSocket specifies an action involving a TCP port. + + + Deprecated: The TCPSocket action requires network connectivity that is not supported in all environments. + This field will be removed in a later API version. + properties: + host: + description: Host is an optional host name to connect to. + Host defaults to the VM IP. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Port specifies a number or name of the port to access on the VM. + If the format of port is a number, it must be in the range 1 to 65535. + If the format of name is a string, it must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + timeoutSeconds: + description: |- + TimeoutSeconds specifies a number of seconds after which the probe times out. + Defaults to 10 seconds. Minimum value is 1. + format: int32 + maximum: 60 + minimum: 1 + type: integer + type: object + reserved: + description: |- + Reserved describes a set of VM configuration options reserved for system + use. + + + Please note attempts to modify the value of this field by a DevOps user + will result in a validation error. + properties: + resourcePolicyName: + description: |- + ResourcePolicyName describes the name of a + VirtualMachineSetResourcePolicy resource used to configure the VM's + resource policy. + type: string + type: object + restartMode: + default: TrySoft + description: |- + RestartMode describes the desired behavior for restarting a VM when + spec.nextRestartTime is set to "now" (case-insensitive). + + + There are three, supported suspend modes: Hard, Soft, and + TrySoft. The first mode, Hard, is where vSphere resets the VM without any + interaction inside of the guest. The Soft mode requires the VM's guest to + have VM Tools installed and asks the guest to restart the VM. Its + variant, TrySoft, first attempts a soft restart, and if that fails or + does not complete within five minutes, the VM is hard reset. + + + If omitted, the mode defaults to TrySoft. + enum: + - Hard + - Soft + - TrySoft + type: string + storageClass: + description: |- + StorageClass describes the name of a Kubernetes StorageClass resource + used to configure this VM's storage-related attributes. + + + Please see https://kubernetes.io/docs/concepts/storage/storage-classes/ + for more information on Kubernetes storage classes. + type: string + suspendMode: + default: TrySoft + description: |- + SuspendMode describes the desired behavior when suspending a VM. + + + There are three, supported suspend modes: Hard, Soft, and + TrySoft. The first mode, Hard, is where vSphere suspends the VM to + disk without any interaction inside of the guest. The Soft mode + requires the VM's guest to have VM Tools installed and attempts to + gracefully suspend the VM. Its variant, TrySoft, first attempts + a graceful suspend, and if that fails or the VM is not in a put into + standby by the guest after five minutes, the VM is suspended. + + + If omitted, the mode defaults to TrySoft. + enum: + - Hard + - Soft + - TrySoft + type: string + volumes: + description: Volumes describes a list of volumes that can be mounted + to the VM. + items: + description: VirtualMachineVolume represents a named volume in a + VM. + properties: + name: + description: |- + Name represents the volume's name. Must be a DNS_LABEL and unique within + the VM. + type: string + persistentVolumeClaim: + description: |- + PersistentVolumeClaim represents a reference to a PersistentVolumeClaim + in the same namespace. + + + More information is available at + https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims. + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + instanceVolumeClaim: + description: InstanceVolumeClaim is set if the PVC is backed + by instance storage. + properties: + size: + anyOf: + - type: integer + - type: string + description: Size is the size of the requested instance + storage volume. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + storageClass: + description: |- + StorageClass is the name of the Kubernetes StorageClass that provides + the backing storage for this instance storage volume. + type: string + required: + - size + - storageClass + type: object + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + status: + description: VirtualMachineStatus defines the observed state of a VirtualMachine + instance. + properties: + biosUUID: + description: |- + BiosUUID describes a unique identifier provided by the underlying + infrastructure provider that is exposed to the Guest OS BIOS as a unique + hardware identifier. + type: string + changeBlockTracking: + description: ChangeBlockTracking describes the CBT enablement status + on the VM. + type: boolean + class: + description: |- + Class is a reference to the VirtualMachineClass resource used to deploy + this VM. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an + object. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object + represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name refers to a unique resource in the current namespace. + More info: http://kubernetes.io/docs/user-guide/identifiers#names + type: string + required: + - apiVersion + - kind + - name + type: object + conditions: + description: Conditions describes the observed conditions of the VirtualMachine. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + hardwareVersion: + description: |- + HardwareVersion describes the VirtualMachine resource's observed + hardware version. + + + Please refer to VirtualMachineSpec.MinHardwareVersion for more + information on the topic of a VM's hardware version. + format: int32 + type: integer + host: + description: |- + Host describes the hostname or IP address of the infrastructure host + where the VM is executed. + type: string + image: + description: |- + Image is a reference to the VirtualMachineImage resource used to deploy + this VM. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an + object. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object + represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name refers to a unique resource in the current namespace. + More info: http://kubernetes.io/docs/user-guide/identifiers#names + type: string + required: + - apiVersion + - kind + - name + type: object + instanceUUID: + description: |- + InstanceUUID describes the unique instance UUID provided by the + underlying infrastructure provider, such as vSphere. + type: string + lastRestartTime: + description: LastRestartTime describes the last time the VM was restarted. + format: date-time + type: string + network: + description: |- + Network describes the observed state of the VM's network configuration. + Please note much of the network status information is only available if + the guest has VM Tools installed. + properties: + config: + description: |- + Config describes the resolved, configured network settings for the VM, + such as an interface's IP address obtained from IPAM, or global DNS + settings. + + + Please note this information does *not* represent the *observed* network + state of the VM, but is intended for situations where someone boots a VM + with no appropriate bootstrap engine and needs to know the network config + valid for the deployed VM. + properties: + dns: + description: DNS describes the configured state of client-side + DNS. + properties: + hostName: + description: |- + HostName is the host name portion of the DNS name. For example, + the "my-vm" part of "my-vm.domain.local". + type: string + nameservers: + description: |- + Nameservers is a list of the IP addresses for the DNS servers to use. + + + IP4 addresses are specified using dotted decimal notation. For example, + "192.0.2.1". + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the + symbol '::' to represent multiple 16-bit groups of contiguous 0's only + once in an address as described in RFC 2373. + items: + type: string + type: array + searchDomains: + description: |- + SearchDomains is a list of domains in which to search for hosts, in the + order of preference. + items: + type: string + type: array + type: object + interfaces: + description: Interfaces describes the configured state of + the network interfaces. + items: + description: |- + VirtualMachineNetworkConfigInterfaceStatus describes the configured state of + network interface. + properties: + dns: + description: DNS describes the interface's configured + DNS information. + properties: + hostName: + description: |- + HostName is the host name portion of the DNS name. For example, + the "my-vm" part of "my-vm.domain.local". + type: string + nameservers: + description: |- + Nameservers is a list of the IP addresses for the DNS servers to use. + + + IP4 addresses are specified using dotted decimal notation. For example, + "192.0.2.1". + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the + symbol '::' to represent multiple 16-bit groups of contiguous 0's only + once in an address as described in RFC 2373. + items: + type: string + type: array + searchDomains: + description: |- + SearchDomains is a list of domains in which to search for hosts, in the + order of preference. + items: + type: string + type: array + type: object + ip: + description: IP describes the interface's configured + IP information. + properties: + addresses: + description: |- + Addresses describes configured IP addresses for this interface. + Addresses include the network's prefix length, ex. 192.168.0.0/24 or + 2001:DB8:101::230:6eff:fe04:d9ff::/64. + items: + type: string + type: array + dhcp: + description: DHCP describes the interface's configured + DHCP options. + properties: + ip4: + description: IP4 describes the configured state + of the IP4 DHCP settings. + properties: + enabled: + description: Enabled describes whether DHCP + is enabled. + type: boolean + type: object + ip6: + description: IP6 describes the configured state + of the IP6 DHCP settings. + properties: + enabled: + description: Enabled describes whether DHCP + is enabled. + type: boolean + type: object + type: object + gateway4: + description: |- + Gateway4 describes the interface's configured, default, IP4 gateway. + + + Please note the IP address include the network prefix length, ex. + 192.168.0.1/24. + type: string + gateway6: + description: |- + Gateway6 describes the interface's configured, default, IP6 gateway. + + + Please note the IP address includes the network prefix length, ex. + 2001:db8:101::1/64. + type: string + type: object + name: + description: |- + Name describes the corresponding network interface with the same name + in the VM's desired network interface list. + + + Please note this name is not necessarily related to the name of the + device as it is surfaced inside of the guest. + type: string + required: + - name + type: object + type: array + type: object + interfaces: + description: Interfaces describes the status of the VM's network + interfaces. + items: + description: |- + VirtualMachineNetworkInterfaceStatus describes the observed state of a + VM's network interface. + properties: + deviceKey: + description: |- + DeviceKey describes the unique hardware device key of this network + interface. + format: int32 + type: integer + dns: + description: DNS describes the observed state of the interface's + DNS configuration. + properties: + dhcp: + description: |- + DHCP indicates whether or not dynamic host control protocol (DHCP) was + used to configure DNS configuration. + type: boolean + domainName: + description: |- + DomainName is the domain name portion of the DNS name. For example, + the "domain.local" part of "my-vm.domain.local". + type: string + hostName: + description: |- + HostName is the host name portion of the DNS name. For example, + the "my-vm" part of "my-vm.domain.local". + type: string + nameservers: + description: |- + Nameservers is a list of the IP addresses for the DNS servers to use. + + + IP4 addresses are specified using dotted decimal notation. For example, + "192.0.2.1". + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the + symbol '::' to represent multiple 16-bit groups of contiguous 0's only + once in an address as described in RFC 2373. + items: + type: string + type: array + searchDomains: + description: |- + SearchDomains is a list of domains in which to search for hosts, in the + order of preference. + items: + type: string + type: array + type: object + ip: + description: IP describes the observed state of the interface's + IP configuration. + properties: + addresses: + description: Addresses describes observed IP addresses + for this interface. + items: + description: |- + VirtualMachineNetworkInterfaceIPAddrStatus describes information about a + specific IP address. + properties: + address: + description: |- + Address is an IP4 or IP6 address and their network prefix length. + + + An IP4 address is specified using dotted decimal notation. For example, + "192.0.2.1". + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the + symbol '::' to represent multiple 16-bit groups of contiguous 0's only + once in an address as described in RFC 2373. + type: string + lifetime: + description: Lifetime describes when this address + will expire. + format: date-time + type: string + origin: + description: Origin describes how this address + was configured. + enum: + - dhcp + - linklayer + - manual + - other + - random + type: string + state: + description: State describes the state of this + IP address. + enum: + - deprecated + - duplicate + - inaccessible + - invalid + - preferred + - tentative + - unknown + type: string + required: + - address + type: object + type: array + autoConfigurationEnabled: + description: |- + AutoConfigurationEnabled describes whether or not ICMPv6 router + solicitation requests are enabled or disabled from a given interface. + + + These requests acquire an IP6 address and default gateway route from + zero-to-many routers on the connected network. + + + If not set then ICMPv6 is not available on this VM. + type: boolean + dhcp: + description: |- + DHCP describes the VM's observed, client-side, interface-specific DHCP + options. + properties: + ip4: + description: IP4 describes the observed state of + the IP4 DHCP client settings. + properties: + config: + description: |- + Config describes platform-dependent settings for the DHCP client. + + + The key part is a unique number while the value part is the platform + specific configuration command. For example on Linux and BSD systems + using the file dhclient.conf output would be reported at system scope: + key='1', value='timeout 60;' key='2', value='reboot 10;'. The output + reported per interface would be: + key='1', value='prepend domain-name-servers 192.0.2.1;' + key='2', value='require subnet-mask, domain-name-servers;'. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the + key/value pair. + type: string + value: + description: Value is the optional value + part of the key/value pair. + type: string + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + enabled: + description: Enabled reports the status of the + DHCP client services. + type: boolean + type: object + ip6: + description: IP6 describes the observed state of + the IP6 DHCP client settings. + properties: + config: + description: |- + Config describes platform-dependent settings for the DHCP client. + + + The key part is a unique number while the value part is the platform + specific configuration command. For example on Linux and BSD systems + using the file dhclient.conf output would be reported at system scope: + key='1', value='timeout 60;' key='2', value='reboot 10;'. The output + reported per interface would be: + key='1', value='prepend domain-name-servers 192.0.2.1;' + key='2', value='require subnet-mask, domain-name-servers;'. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the + key/value pair. + type: string + value: + description: Value is the optional value + part of the key/value pair. + type: string + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + enabled: + description: Enabled reports the status of the + DHCP client services. + type: boolean + type: object + type: object + macAddr: + description: MACAddr describes the observed MAC address + for this interface. + type: string + type: object + name: + description: |- + Name describes the corresponding network interface with the same name + in the VM's desired network interface list. If unset, then there is no + corresponding entry for this interface. + + + Please note this name is not necessarily related to the name of the + device as it is surfaced inside of the guest. + type: string + type: object + type: array + ipStacks: + description: |- + IPStacks describes information about the guest's configured IP networking + stacks. + items: + description: |- + VirtualMachineNetworkIPStackStatus describes the observed state of a + VM's IP stack. + properties: + dhcp: + description: DHCP describes the VM's observed, client-side, + system-wide DHCP options. + properties: + ip4: + description: IP4 describes the observed state of the + IP4 DHCP client settings. + properties: + config: + description: |- + Config describes platform-dependent settings for the DHCP client. + + + The key part is a unique number while the value part is the platform + specific configuration command. For example on Linux and BSD systems + using the file dhclient.conf output would be reported at system scope: + key='1', value='timeout 60;' key='2', value='reboot 10;'. The output + reported per interface would be: + key='1', value='prepend domain-name-servers 192.0.2.1;' + key='2', value='require subnet-mask, domain-name-servers;'. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the key/value + pair. + type: string + value: + description: Value is the optional value part + of the key/value pair. + type: string + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + enabled: + description: Enabled reports the status of the DHCP + client services. + type: boolean + type: object + ip6: + description: IP6 describes the observed state of the + IP6 DHCP client settings. + properties: + config: + description: |- + Config describes platform-dependent settings for the DHCP client. + + + The key part is a unique number while the value part is the platform + specific configuration command. For example on Linux and BSD systems + using the file dhclient.conf output would be reported at system scope: + key='1', value='timeout 60;' key='2', value='reboot 10;'. The output + reported per interface would be: + key='1', value='prepend domain-name-servers 192.0.2.1;' + key='2', value='require subnet-mask, domain-name-servers;'. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the key/value + pair. + type: string + value: + description: Value is the optional value part + of the key/value pair. + type: string + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + enabled: + description: Enabled reports the status of the DHCP + client services. + type: boolean + type: object + type: object + dns: + description: DNS describes the VM's observed, client-side + DNS configuration. + properties: + dhcp: + description: |- + DHCP indicates whether or not dynamic host control protocol (DHCP) was + used to configure DNS configuration. + type: boolean + domainName: + description: |- + DomainName is the domain name portion of the DNS name. For example, + the "domain.local" part of "my-vm.domain.local". + type: string + hostName: + description: |- + HostName is the host name portion of the DNS name. For example, + the "my-vm" part of "my-vm.domain.local". + type: string + nameservers: + description: |- + Nameservers is a list of the IP addresses for the DNS servers to use. + + + IP4 addresses are specified using dotted decimal notation. For example, + "192.0.2.1". + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the + symbol '::' to represent multiple 16-bit groups of contiguous 0's only + once in an address as described in RFC 2373. + items: + type: string + type: array + searchDomains: + description: |- + SearchDomains is a list of domains in which to search for hosts, in the + order of preference. + items: + type: string + type: array + type: object + ipRoutes: + description: IPRoutes contain the VM's routing tables for + all address families. + items: + description: |- + VirtualMachineNetworkIPRouteStatus describes the observed state of a + guest network's IP routes. + properties: + gateway: + description: Gateway describes where to send the packets + to next. + properties: + address: + description: Address is the IP4 or IP6 address + of the gateway. + type: string + device: + description: |- + Device is the name of the device in the guest for which this gateway + applies. + type: string + type: object + networkAddress: + description: |- + NetworkAddress is the IP4 or IP6 address of the destination network. + + + Addresses include the network's prefix length, ex. 192.168.0.0/24 or + 2001:DB8:101::230:6eff:fe04:d9ff::/64. + + + IP6 addresses are 128-bit addresses represented as eight fields of up to + four hexadecimal digits. A colon separates each field (:). For example, + 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of symbol + '::' to represent multiple 16-bit groups of contiguous 0's only once in + an address as described in RFC 2373. + type: string + required: + - gateway + - networkAddress + type: object + type: array + kernelConfig: + description: |- + KernelConfig describes the observed state of the VM's kernel IP + configuration settings. + + + The key part contains a unique number while the value part contains the + 'key=value' as provided by the underlying provider. For example, on + Linux and/or BSD, the systcl -a output would be reported as: + key='5', value='net.ipv4.tcp_keepalive_time = 7200'. + items: + description: |- + KeyValuePair is useful when wanting to realize a map as a list of key/value + pairs. + properties: + key: + description: Key is the key part of the key/value + pair. + type: string + value: + description: Value is the optional value part of the + key/value pair. + type: string + required: + - key + type: object + type: array + x-kubernetes-list-map-keys: + - key + x-kubernetes-list-type: map + type: object + type: array + primaryIP4: + description: |- + PrimaryIP4 describes the VM's primary IP4 address. + + + If the bootstrap provider is CloudInit then this value is set to the + value of the VM's "guestinfo.local-ipv4" property. Please see + https://bit.ly/3NJB534 for more information on how this value is + calculated. + + + If the bootstrap provider is anything else then this field is set to the + value of the infrastructure VM's "guest.ipAddress" field. Please see + https://bit.ly/3Au0jM4 for more information. + type: string + primaryIP6: + description: |- + PrimaryIP6 describes the VM's primary IP6 address. + + + If the bootstrap provider is CloudInit then this value is set to the + value of the VM's "guestinfo.local-ipv6" property. Please see + https://bit.ly/3NJB534 for more information on how this value is + calculated. + + + If the bootstrap provider is anything else then this field is set to the + value of the infrastructure VM's "guest.ipAddress" field. Please see + https://bit.ly/3Au0jM4 for more information. + type: string + type: object + powerState: + description: PowerState describes the observed power state of the + VirtualMachine. + enum: + - PoweredOff + - PoweredOn + - Suspended + type: string + uniqueID: + description: |- + UniqueID describes a unique identifier that is provided by the underlying + infrastructure provider, such as vSphere. + type: string + volumes: + description: |- + Volumes describes a list of current status information for each Volume + that is desired to be attached to the VM. + items: + description: |- + VirtualMachineVolumeStatus defines the observed state of a + VirtualMachineVolume instance. + properties: + attached: + description: |- + Attached represents whether a volume has been successfully attached to + the VirtualMachine or not. + type: boolean + diskUUID: + description: |- + DiskUUID represents the underlying virtual disk UUID and is present when + attachment succeeds. + type: string + error: + description: |- + Error represents the last error seen when attaching or detaching a + volume. Error will be empty if attachment succeeds. + type: string + name: + description: Name is the name of the attached volume. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + zone: + description: |- + Zone describes the availability zone where the VirtualMachine has been + scheduled. + + + Please note this field may be empty when the cluster is not zone-aware. type: string type: object type: object diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineservices.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineservices.yaml index d0cb5f73a3..be6503fbd5 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineservices.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachineservices.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachineservices.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -26,83 +26,87 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: VirtualMachineService is the Schema for the virtualmachineservices - API. A VirtualMachineService represents the desired specification and the - observed status of a VirtualMachineService instance. A VirtualMachineService - represents a network service, provided by one or more VirtualMachines, that - is desired to be exposed to other workloads both internal and external to - the cluster. + description: |- + VirtualMachineService is the Schema for the virtualmachineservices API. + A VirtualMachineService represents the desired specification and the observed status of a VirtualMachineService + instance. A VirtualMachineService represents a network service, provided by one or more VirtualMachines, that is + desired to be exposed to other workloads both internal and external to the cluster. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object spec: - description: VirtualMachineServiceSpec defines the desired state of VirtualMachineService. - Each VirtualMachineService exposes a set of TargetPorts on a set of - VirtualMachine instances as a network endpoint within or outside of - the Kubernetes cluster. The VirtualMachineService is loosely coupled - to the VirtualMachines that are backing it through the use of a Label - Selector. In Kubernetes, a Label Selector enables matching of a resource - using a set of key-value pairs, aka Labels. By using a Label Selector, - the VirtualMachineService can be generically defined to apply to any - VirtualMachine in the same namespace that has the appropriate set of - labels. + description: |- + VirtualMachineServiceSpec defines the desired state of VirtualMachineService. Each VirtualMachineService exposes + a set of TargetPorts on a set of VirtualMachine instances as a network endpoint within or outside of the + Kubernetes cluster. The VirtualMachineService is loosely coupled to the VirtualMachines that are backing it through + the use of a Label Selector. In Kubernetes, a Label Selector enables matching of a resource using a set of + key-value pairs, aka Labels. By using a Label Selector, the VirtualMachineService can be generically defined to apply + to any VirtualMachine in the same namespace that has the appropriate set of labels. properties: clusterIp: - description: 'clusterIP is the IP address of the service and is usually - assigned randomly by the master. If an address is specified manually - and is not in use by others, it will be allocated to the service; - otherwise, creation of the service will fail. This field can not - be changed through updates. Valid values are "None", empty string - (""), or a valid IP address. "None" can be specified for headless - services when proxying is not required. Only applies to types ClusterIP - and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies' + description: |- + clusterIP is the IP address of the service and is usually assigned + randomly by the master. If an address is specified manually and is not in + use by others, it will be allocated to the service; otherwise, creation + of the service will fail. This field can not be changed through updates. + Valid values are "None", empty string (""), or a valid IP address. "None" + can be specified for headless services when proxying is not required. + Only applies to types ClusterIP and LoadBalancer. + Ignored if type is ExternalName. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies type: string externalName: - description: externalName is the external reference that kubedns or - equivalent will return as a CNAME record for this service. No proxying - will be involved. Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + description: |- + externalName is the external reference that kubedns or equivalent will + return as a CNAME record for this service. No proxying will be involved. + Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires Type to be ExternalName. type: string loadBalancerIP: - description: 'Only applies to VirtualMachineService Type: LoadBalancer + description: |- + Only applies to VirtualMachineService Type: LoadBalancer LoadBalancer will get created with the IP specified in this field. - This feature depends on whether the underlying load balancer provider - supports specifying the loadBalancerIP when a load balancer is created. - This field will be ignored if the provider does not support the - feature. Deprecated: This field was under-specified and its meaning - varies across implementations. Using it is non-portable and it may - not support dual-stack. Users are encouraged to use implementation-specific - annotations when available.' + This feature depends on whether the underlying load balancer provider supports specifying + the loadBalancerIP when a load balancer is created. + This field will be ignored if the provider does not support the feature. + Deprecated: This field was under-specified and its meaning varies across implementations. + Using it is non-portable and it may not support dual-stack. + Users are encouraged to use implementation-specific annotations when available. type: string loadBalancerSourceRanges: - description: 'LoadBalancerSourceRanges is an array of IP addresses - in the format of CIDRs, for example: 103.21.244.0/22 and 10.0.0.0/24. - If specified and supported by the load balancer provider, this will - restrict ingress traffic to the specified client IPs. This field - will be ignored if the provider does not support the feature.' + description: |- + LoadBalancerSourceRanges is an array of IP addresses in the format of + CIDRs, for example: 103.21.244.0/22 and 10.0.0.0/24. + If specified and supported by the load balancer provider, this will restrict + ingress traffic to the specified client IPs. This field will be ignored if the + provider does not support the feature. items: type: string type: array ports: - description: Ports specifies a list of VirtualMachineServicePort to - expose with this VirtualMachineService. Each of these ports will - be an accessible network entry point to access this service by. + description: |- + Ports specifies a list of VirtualMachineServicePort to expose with this VirtualMachineService. Each of these ports + will be an accessible network entry point to access this service by. items: - description: VirtualMachineServicePort describes the specification - of a service port to be exposed by a VirtualMachineService. This - VirtualMachineServicePort specification includes attributes that - define the external and internal representation of the service - port. + description: |- + VirtualMachineServicePort describes the specification of a service port to be exposed by a VirtualMachineService. + This VirtualMachineServicePort specification includes attributes that define the external and internal + representation of the service port. properties: name: description: Name describes the name to be used to identify @@ -132,14 +136,14 @@ spec: selector: additionalProperties: type: string - description: Selector specifies a map of key-value pairs, also known - as a Label Selector, that is used to match this VirtualMachineService - with the set of VirtualMachines that should back this VirtualMachineService. + description: |- + Selector specifies a map of key-value pairs, also known as a Label Selector, that is used to match this + VirtualMachineService with the set of VirtualMachines that should back this VirtualMachineService. type: object type: - description: Type specifies a desired VirtualMachineServiceType for - this VirtualMachineService. Supported types are ClusterIP, LoadBalancer, - ExternalName. + description: |- + Type specifies a desired VirtualMachineServiceType for this VirtualMachineService. Supported types + are ClusterIP, LoadBalancer, ExternalName. type: string required: - type @@ -149,19 +153,20 @@ spec: VirtualMachineService. properties: loadBalancer: - description: LoadBalancer contains the current status of the load - balancer, if one is present. + description: |- + LoadBalancer contains the current status of the load balancer, + if one is present. properties: ingress: - description: Ingress is a list containing ingress addresses for - the load balancer. Traffic intended for the service should be - sent to any of these ingress points. + description: |- + Ingress is a list containing ingress addresses for the load balancer. + Traffic intended for the service should be sent to any of these ingress points. items: - description: 'LoadBalancerIngress represents the status of a - load balancer ingress point: traffic intended for the service - should be sent to an ingress point. IP or Hostname may both - be set in this structure. It is up to the consumer to determine - which field should be used when accessing this LoadBalancer.' + description: |- + LoadBalancerIngress represents the status of a load balancer ingress point: + traffic intended for the service should be sent to an ingress point. + IP or Hostname may both be set in this structure. It is up to the consumer to determine which + field should be used when accessing this LoadBalancer. properties: hostname: description: Hostname is set for load balancer ingress points @@ -177,6 +182,177 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.type + name: Type + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: VirtualMachineService is the Schema for the virtualmachineservices + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VirtualMachineServiceSpec defines the desired state of VirtualMachineService. + properties: + clusterIp: + description: |- + clusterIP is the IP address of the service and is usually assigned + randomly by the master. If an address is specified manually and is not in + use by others, it will be allocated to the service; otherwise, creation + of the service will fail. This field can not be changed through updates. + Valid values are "None", empty string (""), or a valid IP address. "None" + can be specified for headless services when proxying is not required. + Only applies to types ClusterIP and LoadBalancer. + Ignored if type is ExternalName. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + type: string + externalName: + description: |- + externalName is the external reference that kubedns or equivalent will + return as a CNAME record for this service. No proxying will be involved. + Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + and requires Type to be ExternalName. + type: string + loadBalancerIP: + description: |- + Only applies to VirtualMachineService Type: LoadBalancer + LoadBalancer will get created with the IP specified in this field. + This feature depends on whether the underlying load balancer provider + supports specifying the loadBalancerIP when a load balancer is created. + This field will be ignored if the provider does not support the feature. + Deprecated: This field was under-specified and its meaning varies across implementations. + Using it is non-portable and it may not support dual-stack. + Users are encouraged to use implementation-specific annotations when available. + type: string + loadBalancerSourceRanges: + description: |- + LoadBalancerSourceRanges is an array of IP addresses in the format of + CIDRs, for example: 103.21.244.0/22 and 10.0.0.0/24. + If specified and supported by the load balancer provider, this will + restrict ingress traffic to the specified client IPs. This field will be + ignored if the provider does not support the feature. + items: + type: string + type: array + ports: + description: |- + Ports specifies a list of VirtualMachineServicePort to expose with this + VirtualMachineService. Each of these ports will be an accessible network + entry point to access this service by. + items: + description: |- + VirtualMachineServicePort describes the specification of a service port to + be exposed by a VirtualMachineService. This VirtualMachineServicePort + specification includes attributes that define the external and internal + representation of the service port. + properties: + name: + description: |- + Name describes the name to be used to identify this + VirtualMachineServicePort. + type: string + port: + description: Port describes the external port that will be exposed + by the service. + format: int32 + type: integer + protocol: + description: |- + Protocol describes the Layer 4 transport protocol for this port. + Supports "TCP", "UDP", and "SCTP". + type: string + targetPort: + description: |- + TargetPort describes the internal port open on a VirtualMachine that + should be mapped to the external Port. + format: int32 + type: integer + required: + - name + - port + - protocol + - targetPort + type: object + type: array + selector: + additionalProperties: + type: string + description: |- + Selector specifies a map of key-value pairs, also known as a Label + Selector, that is used to match this VirtualMachineService with the set + of VirtualMachines that should back this VirtualMachineService. + type: object + type: + description: |- + Type specifies a desired VirtualMachineServiceType for this + VirtualMachineService. Supported types are ClusterIP, LoadBalancer, + ExternalName. + type: string + required: + - type + type: object + status: + description: |- + VirtualMachineServiceStatus defines the observed state of + VirtualMachineService. + properties: + loadBalancer: + description: |- + LoadBalancer contains the current status of the load balancer, + if one is present. + properties: + ingress: + description: |- + Ingress is a list containing ingress addresses for the load balancer. + Traffic intended for the service should be sent to any of these ingress + points. + items: + description: |- + LoadBalancerIngress represents the status of a load balancer ingress point: + traffic intended for the service should be sent to an ingress point. + IP or Hostname may both be set in this structure. It is up to the consumer to + determine which field should be used when accessing this LoadBalancer. + properties: + hostname: + description: |- + Hostname is set for load balancer ingress points that are specified by a + DNS address. + type: string + ip: + description: |- + IP is set for load balancer ingress points that are specified by an IP + address. + type: string + type: object + type: array + type: object + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml index 1d444ca0d0..d8ad38d16b 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: virtualmachinesetresourcepolicies.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -21,14 +21,19 @@ spec: API. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -38,10 +43,9 @@ spec: properties: clustermodules: items: - description: ClusterModuleSpec defines a grouping of VirtualMachines - that are to be grouped together as a logical unit by the infrastructure - provider. Within vSphere, the ClusterModuleSpec maps directly - to a vSphere ClusterModule. + description: |- + ClusterModuleSpec defines a grouping of VirtualMachines that are to be grouped together as a logical unit by + the infrastructure provider. Within vSphere, the ClusterModuleSpec maps directly to a vSphere ClusterModule. properties: groupname: description: GroupName describes the name of the ClusterModule @@ -123,6 +127,114 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: VirtualMachineSetResourcePolicy is the Schema for the virtualmachinesetresourcepolicies + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + VirtualMachineSetResourcePolicySpec defines the desired state of + VirtualMachineSetResourcePolicy. + properties: + clusterModuleGroups: + items: + type: string + type: array + folder: + type: string + resourcePool: + description: |- + ResourcePoolSpec defines a Logical Grouping of workloads that share resource + policies. + properties: + limits: + description: Limits describes the limit to resources available + to the ResourcePool. + properties: + cpu: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + memory: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + name: + description: Name describes the name of the ResourcePool grouping. + type: string + reservations: + description: |- + Reservations describes the guaranteed resources reserved for the + ResourcePool. + properties: + cpu: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + memory: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + type: object + status: + description: |- + VirtualMachineSetResourcePolicyStatus defines the observed state of + VirtualMachineSetResourcePolicy. + properties: + clustermodules: + items: + description: |- + VSphereClusterModuleStatus describes the observed state of a vSphere + cluster module. + properties: + clusterMoID: + type: string + groupName: + type: string + moduleUUID: + type: string + required: + - clusterMoID + - groupName + - moduleUUID + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml new file mode 100644 index 0000000000..24d853b100 --- /dev/null +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml @@ -0,0 +1,110 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: virtualmachinewebconsolerequests.vmoperator.vmware.com +spec: + group: vmoperator.vmware.com + names: + kind: VirtualMachineWebConsoleRequest + listKind: VirtualMachineWebConsoleRequestList + plural: virtualmachinewebconsolerequests + singular: virtualmachinewebconsolerequest + scope: Namespaced + versions: + - name: v1alpha2 + schema: + openAPIV3Schema: + description: |- + VirtualMachineWebConsoleRequest allows the creation of a one-time, web + console connection to a VM. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + VirtualMachineWebConsoleRequestSpec describes the desired state for a web + console request to a VM. + properties: + name: + description: |- + Name is the name of a VM in the same Namespace as this web console + request. + type: string + publicKey: + description: PublicKey is used to encrypt the status.response. This + is expected to be a RSA OAEP public key in X.509 PEM format. + type: string + required: + - name + - publicKey + type: object + status: + description: |- + VirtualMachineWebConsoleRequestStatus describes the observed state of the + request. + properties: + expiryTime: + description: ExpiryTime is the time at which access via this request + will expire. + format: date-time + type: string + proxyAddr: + description: |- + ProxyAddr describes the host address and optional port used to access + the VM's web console. + + + The value could be a DNS entry, IPv4, or IPv6 address, followed by an + optional port. For example, valid values include: + + + DNS + * host.com + * host.com:6443 + + + IPv4 + * 1.2.3.4 + * 1.2.3.4:6443 + + + IPv6 + * 1234:1234:1234:1234:1234:1234:1234:1234 + * [1234:1234:1234:1234:1234:1234:1234:1234]:6443 + * 1234:1234:1234:0000:0000:0000:1234:1234 + * 1234:1234:1234::::1234:1234 + * [1234:1234:1234::::1234:1234]:6443 + + + In other words, the field may be set to any value that is parsable + by Go's https://pkg.go.dev/net#ResolveIPAddr and + https://pkg.go.dev/net#ParseIP functions. + type: string + response: + description: Response will be the authenticated ticket corresponding + to this web console request. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/deployments/integration-tests/crds/vmoperator.vmware.com_webconsolerequests.yaml b/config/deployments/integration-tests/crds/vmoperator.vmware.com_webconsolerequests.yaml index a09b717611..0da232f54f 100644 --- a/config/deployments/integration-tests/crds/vmoperator.vmware.com_webconsolerequests.yaml +++ b/config/deployments/integration-tests/crds/vmoperator.vmware.com_webconsolerequests.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: webconsolerequests.vmoperator.vmware.com spec: group: vmoperator.vmware.com @@ -21,14 +21,19 @@ spec: ticket that can be used to interact with the VM. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -58,16 +63,34 @@ spec: format: date-time type: string proxyAddr: - description: "ProxyAddr describes the host address and optional port - used to access the VM's web console. The value could be a DNS entry, - IPv4, or IPv6 address, followed by an optional port. For example, - valid values include: \n DNS * host.com * host.com:6443 \n IPv4 - * 1.2.3.4 * 1.2.3.4:6443 \n IPv6 * 1234:1234:1234:1234:1234:1234:1234:1234 - * [1234:1234:1234:1234:1234:1234:1234:1234]:6443 * 1234:1234:1234:0000:0000:0000:1234:1234 - * 1234:1234:1234::::1234:1234 * [1234:1234:1234::::1234:1234]:6443 - \n In other words, the field may be set to any value that is parsable - by Go's https://pkg.go.dev/net#ResolveIPAddr and https://pkg.go.dev/net#ParseIP - functions." + description: |- + ProxyAddr describes the host address and optional port used to access + the VM's web console. + The value could be a DNS entry, IPv4, or IPv6 address, followed by an + optional port. For example, valid values include: + + + DNS + * host.com + * host.com:6443 + + + IPv4 + * 1.2.3.4 + * 1.2.3.4:6443 + + + IPv6 + * 1234:1234:1234:1234:1234:1234:1234:1234 + * [1234:1234:1234:1234:1234:1234:1234:1234]:6443 + * 1234:1234:1234:0000:0000:0000:1234:1234 + * 1234:1234:1234::::1234:1234 + * [1234:1234:1234::::1234:1234]:6443 + + + In other words, the field may be set to any value that is parsable + by Go's https://pkg.go.dev/net#ResolveIPAddr and + https://pkg.go.dev/net#ParseIP functions. type: string response: description: Response will be the authenticated ticket corresponding diff --git a/config/deployments/integration-tests/kustomization.yaml b/config/deployments/integration-tests/kustomization.yaml index 3a4e4fc700..443f81c787 100644 --- a/config/deployments/integration-tests/kustomization.yaml +++ b/config/deployments/integration-tests/kustomization.yaml @@ -2,13 +2,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../supervisor +- ./crds/vmoperator.vmware.com_clustervirtualmachineimages.yaml - ./crds/vmoperator.vmware.com_contentlibraryproviders.yaml - ./crds/vmoperator.vmware.com_contentsourcebindings.yaml - ./crds/vmoperator.vmware.com_contentsources.yaml - ./crds/vmoperator.vmware.com_virtualmachineclassbindings.yaml - ./crds/vmoperator.vmware.com_virtualmachineclasses.yaml - ./crds/vmoperator.vmware.com_virtualmachineimages.yaml +- ./crds/vmoperator.vmware.com_virtualmachinepublishrequests.yaml - ./crds/vmoperator.vmware.com_virtualmachines.yaml - ./crds/vmoperator.vmware.com_virtualmachineservices.yaml - ./crds/vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml +- ./crds/vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml - ./crds/vmoperator.vmware.com_webconsolerequests.yaml From a2ea76be1cc9163046ea61a505f57ad4b9f97c14 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Wed, 5 Jun 2024 16:35:01 +0200 Subject: [PATCH 3/4] review fixes --- config/deployments/integration-tests/README.md | 15 +++++++++++++++ pkg/services/vmoperator/vmopmachine.go | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 config/deployments/integration-tests/README.md diff --git a/config/deployments/integration-tests/README.md b/config/deployments/integration-tests/README.md new file mode 100644 index 0000000000..bfd9569e62 --- /dev/null +++ b/config/deployments/integration-tests/README.md @@ -0,0 +1,15 @@ +# Integration tests + +The [crds](./crds/) are copied from the vm-operators version which is consumed as go module. + +These should get updated when bumping the dependency vm-operator dependency. + +To sync the new CRD's use the following script **and** update `kustomization.yaml` accordingly. + +```sh +make clean-vm-operator checkout-vm-operator +rm -r config/deployments/integration-tests/crds +cp -r test/infrastructure/vm-operator/vm-operator.tmp/config/crd/bases config/deployments/integration-tests/crds + +make clean-vm-operator +``` diff --git a/pkg/services/vmoperator/vmopmachine.go b/pkg/services/vmoperator/vmopmachine.go index 8c756a0a27..159ff7f6b5 100644 --- a/pkg/services/vmoperator/vmopmachine.go +++ b/pkg/services/vmoperator/vmopmachine.go @@ -335,7 +335,7 @@ func (v *VmopMachineService) reconcileVMOperatorVM(ctx context.Context, supervis vmOperatorVM.Spec.StorageClass = supervisorMachineCtx.VSphereMachine.Spec.StorageClass } vmOperatorVM.Spec.PowerState = vmoprv1.VirtualMachinePowerStateOn - if vmOperatorVM.Spec.Reserved == nil { + if vmOperatorVM.Spec.Reserved == nil && supervisorMachineCtx.VSphereCluster.Status.ResourcePolicyName != "" { vmOperatorVM.Spec.Reserved = &vmoprv1.VirtualMachineReservedSpec{} } if vmOperatorVM.Spec.Reserved.ResourcePolicyName == "" { From 1feaf6a9572b97e003990f4de52112d2a97f7367 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 14 Jun 2024 17:14:38 +0200 Subject: [PATCH 4/4] review fixes --- config/deployments/integration-tests/README.md | 2 +- go.mod | 16 ++++++++++------ pkg/services/network/network_test.go | 1 - test/go.mod | 12 ++++++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/config/deployments/integration-tests/README.md b/config/deployments/integration-tests/README.md index bfd9569e62..2c57737fc5 100644 --- a/config/deployments/integration-tests/README.md +++ b/config/deployments/integration-tests/README.md @@ -2,7 +2,7 @@ The [crds](./crds/) are copied from the vm-operators version which is consumed as go module. -These should get updated when bumping the dependency vm-operator dependency. +These should get updated when bumping the vm-operator dependency. To sync the new CRD's use the following script **and** update `kustomization.yaml` accordingly. diff --git a/go.mod b/go.mod index 0af98d1877..cc6f834672 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,16 @@ replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.7.0-rc.0.0.2024061 replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 +require ( + github.com/vmware-tanzu/net-operator-api v0.0.0-20240326163340-1f32d6bf7f9d + github.com/vmware-tanzu/nsx-operator/pkg/apis v0.1.0 + // The version of vm-operator should be kept in sync with the manifests at: config/deployments/integration-tests + github.com/vmware-tanzu/vm-operator/api v1.8.6 + github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9505 + github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 + github.com/vmware/govmomi v0.38.0 +) + require ( github.com/blang/semver/v4 v4.0.0 github.com/go-logr/logr v1.4.2 @@ -16,12 +26,6 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - github.com/vmware-tanzu/net-operator-api v0.0.0-20240326163340-1f32d6bf7f9d - github.com/vmware-tanzu/nsx-operator/pkg/apis v0.1.0 - github.com/vmware-tanzu/vm-operator/api v1.8.6 - github.com/vmware-tanzu/vm-operator/external/ncp v0.0.0-20240404200847-de75746a9505 - github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 - github.com/vmware/govmomi v0.38.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/mod v0.18.0 diff --git a/pkg/services/network/network_test.go b/pkg/services/network/network_test.go index a9a84813f7..33114c6e1f 100644 --- a/pkg/services/network/network_test.go +++ b/pkg/services/network/network_test.go @@ -271,7 +271,6 @@ var _ = Describe("Network provider", func() { Expect(vm.Spec.Network.Interfaces[0].Network.Name).To(Equal(vSphereCluster.Name)) Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.Kind).To(Equal("SubnetSet")) Expect(vm.Spec.Network.Interfaces[0].Network.TypeMeta.APIVersion).To(Equal(nsxopv1.SchemeGroupVersion.String())) - // TODO(chrischdi): also assert group version }) }) }) diff --git a/test/go.mod b/test/go.mod index f8a0fb8d4c..41026390b4 100644 --- a/test/go.mod +++ b/test/go.mod @@ -10,16 +10,20 @@ replace sigs.k8s.io/cluster-api-provider-vsphere => ../ replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 +require ( + github.com/vmware-tanzu/net-operator-api v0.0.0-20240326163340-1f32d6bf7f9d + // The version of vm-operator should be kept in sync with the manifests at: config/deployments/integration-tests + github.com/vmware-tanzu/vm-operator/api v1.8.6 + github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 + github.com/vmware/govmomi v0.38.0 +) + require ( github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02 github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 github.com/pkg/errors v0.9.1 github.com/spf13/pflag v1.0.5 - github.com/vmware-tanzu/net-operator-api v0.0.0-20240326163340-1f32d6bf7f9d - github.com/vmware-tanzu/vm-operator/api v1.8.6 - github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-20240404200847-de75746a9505 - github.com/vmware/govmomi v0.38.0 golang.org/x/crypto v0.24.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.30.2