Skip to content

Commit

Permalink
add vmpool to discovery definitions in virt-api
Browse files Browse the repository at this point in the history
Signed-off-by: David Vossel <[email protected]>
  • Loading branch information
davidvossel committed Dec 15, 2021
1 parent 6ac5d62 commit d36ee28
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/virt-api/rest/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (

v1 "kubevirt.io/api/core/v1"
flavorv1alpha1 "kubevirt.io/api/flavor/v1alpha1"
poolv1alpha1 "kubevirt.io/api/pool/v1alpha1"
snapshotv1 "kubevirt.io/api/snapshot/v1alpha1"
mime "kubevirt.io/kubevirt/pkg/rest"
)
Expand All @@ -47,6 +48,7 @@ func ComposeAPIDefinitions() []*restful.WebService {
snapshotApiServiceDefinitions,
flavorApiServiceDefinitions,
migrationPoliciesApiServiceDefinitions,
poolApiServiceDefinitions,
} {
result = append(result, f()...)
}
Expand Down Expand Up @@ -183,6 +185,27 @@ func flavorApiServiceDefinitions() []*restful.WebService {
return []*restful.WebService{ws, ws2}
}

func poolApiServiceDefinitions() []*restful.WebService {
poolGVR := poolv1alpha1.SchemeGroupVersion.WithResource("virtualmachinepools")

ws, err := GroupVersionProxyBase(poolv1alpha1.SchemeGroupVersion)
if err != nil {
panic(err)
}

ws, err = GenericNamespacedResourceProxy(ws, poolGVR, &poolv1alpha1.VirtualMachinePool{}, "VirtualMachinePool", &poolv1alpha1.VirtualMachinePoolList{})
if err != nil {
panic(err)
}

ws2, err := ResourceProxyAutodiscovery(poolGVR)
if err != nil {
panic(err)
}

return []*restful.WebService{ws, ws2}
}

func GroupVersionProxyBase(gv schema.GroupVersion) (*restful.WebService, error) {
ws := new(restful.WebService)
ws.Doc("The KubeVirt API, a virtual machine management.")
Expand Down

0 comments on commit d36ee28

Please sign in to comment.