Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import (
"net"
"time"

"github.com/deckhouse/virtualization/api/subresources/v1alpha2"
"github.com/deckhouse/virtualization/api/subresources/v1alpha3"
)

type VirtualMachineExpansion interface {
SerialConsole(name string, options *SerialConsoleOptions) (StreamInterface, error)
VNC(name string) (StreamInterface, error)
PortForward(name string, opts v1alpha2.VirtualMachinePortForward) (StreamInterface, error)
Freeze(ctx context.Context, name string, opts v1alpha2.VirtualMachineFreeze) error
PortForward(name string, opts v1alpha3.VirtualMachinePortForward) (StreamInterface, error)
Freeze(ctx context.Context, name string, opts v1alpha3.VirtualMachineFreeze) error
Unfreeze(ctx context.Context, name string) error
AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineAddVolume) error
RemoveVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineRemoveVolume) error
AddVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineAddVolume) error
RemoveVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineRemoveVolume) error
CancelEvacuation(ctx context.Context, name string, dryRun []string) error
}

Expand All @@ -58,23 +58,23 @@ func (c *virtualMachines) VNC(name string) (StreamInterface, error) {
return nil, fmt.Errorf("not implemented")
}

func (c *virtualMachines) PortForward(name string, opts v1alpha2.VirtualMachinePortForward) (StreamInterface, error) {
func (c *virtualMachines) PortForward(name string, opts v1alpha3.VirtualMachinePortForward) (StreamInterface, error) {
return nil, fmt.Errorf("not implemented")
}

func (c *virtualMachines) Freeze(ctx context.Context, name string, opts v1alpha2.VirtualMachineFreeze) error {
func (c *virtualMachines) Freeze(ctx context.Context, name string, opts v1alpha3.VirtualMachineFreeze) error {
return fmt.Errorf("not implemented")
}

func (c *virtualMachines) Unfreeze(ctx context.Context, name string) error {
return fmt.Errorf("not implemented")
}

func (c *virtualMachines) AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineAddVolume) error {
func (c *virtualMachines) AddVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineAddVolume) error {
return fmt.Errorf("not implemented")
}

func (c *virtualMachines) RemoveVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineRemoveVolume) error {
func (c *virtualMachines) RemoveVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineRemoveVolume) error {
return fmt.Errorf("not implemented")
}

Expand Down
2 changes: 1 addition & 1 deletion api/client/kubeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c client) VirtualMachines(namespace string) virtualizationv1alpha2.Virtual
restClient: c.restClient,
config: c.config,
namespace: namespace,
resource: "virtualmachines",
resource: "apivirtualmachines",
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/client/kubeclient/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/client-go/rest"
)

const subresourceURLTpl = "/apis/subresources.virtualization.deckhouse.io/v1alpha2/namespaces/%s/%s/%s/%s"
const subresourceURLTpl = "/apis/subresources.virtualization.deckhouse.io/v1alpha3/namespaces/%s/%s/%s/%s"

func RequestFromConfig(config *rest.Config, resource, name, namespace, subresource string,
queryParams url.Values) (*http.Request, error) {
Expand Down
10 changes: 5 additions & 5 deletions api/client/kubeclient/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
virtv1 "kubevirt.io/api/core/v1"

virtualizationv1alpha2 "github.com/deckhouse/virtualization/api/client/generated/clientset/versioned/typed/core/v1alpha2"
"github.com/deckhouse/virtualization/api/subresources/v1alpha2"
"github.com/deckhouse/virtualization/api/subresources/v1alpha3"
)

type vm struct {
Expand Down Expand Up @@ -96,7 +96,7 @@ func (v vm) VNC(name string) (virtualizationv1alpha2.StreamInterface, error) {
return asyncSubresourceHelper(v.config, v.resource, v.namespace, name, "vnc", url.Values{})
}

func (v vm) PortForward(name string, opts v1alpha2.VirtualMachinePortForward) (virtualizationv1alpha2.StreamInterface, error) {
func (v vm) PortForward(name string, opts v1alpha3.VirtualMachinePortForward) (virtualizationv1alpha2.StreamInterface, error) {
params := url.Values{}
if opts.Port > 0 {
params.Add("port", strconv.Itoa(opts.Port))
Expand All @@ -107,7 +107,7 @@ func (v vm) PortForward(name string, opts v1alpha2.VirtualMachinePortForward) (v
return asyncSubresourceHelper(v.config, v.resource, v.namespace, name, "portforward", params)
}

func (v vm) Freeze(ctx context.Context, name string, opts v1alpha2.VirtualMachineFreeze) error {
func (v vm) Freeze(ctx context.Context, name string, opts v1alpha3.VirtualMachineFreeze) error {
path := fmt.Sprintf(subresourceURLTpl, v.namespace, v.resource, name, "freeze")

unfreezeTimeout := virtv1.FreezeUnfreezeTimeout{
Expand All @@ -132,7 +132,7 @@ func (v vm) Unfreeze(ctx context.Context, name string) error {
return v.restClient.Put().AbsPath(path).Do(ctx).Error()
}

func (v vm) AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineAddVolume) error {
func (v vm) AddVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineAddVolume) error {
path := fmt.Sprintf(subresourceURLTpl, v.namespace, v.resource, name, "addvolume")
return v.restClient.
Put().
Expand All @@ -147,7 +147,7 @@ func (v vm) AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMac
Error()
}

func (v vm) RemoveVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineRemoveVolume) error {
func (v vm) RemoveVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineRemoveVolume) error {
path := fmt.Sprintf(subresourceURLTpl, v.namespace, v.resource, name, "removevolume")
return v.restClient.
Put().
Expand Down
Loading
Loading