Skip to content

Commit 13e2f62

Browse files
1
Signed-off-by: Yaroslav Borbat <[email protected]>
1 parent 9bb8f59 commit 13e2f62

File tree

22 files changed

+1319
-114
lines changed

22 files changed

+1319
-114
lines changed

api/client/generated/clientset/versioned/typed/core/v1alpha2/virtualmachine_expansion.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ import (
2323
"net"
2424
"time"
2525

26-
"github.com/deckhouse/virtualization/api/subresources/v1alpha2"
26+
"github.com/deckhouse/virtualization/api/subresources/v1alpha3"
2727
)
2828

2929
type VirtualMachineExpansion interface {
3030
SerialConsole(name string, options *SerialConsoleOptions) (StreamInterface, error)
3131
VNC(name string) (StreamInterface, error)
32-
PortForward(name string, opts v1alpha2.VirtualMachinePortForward) (StreamInterface, error)
33-
Freeze(ctx context.Context, name string, opts v1alpha2.VirtualMachineFreeze) error
32+
PortForward(name string, opts v1alpha3.VirtualMachinePortForward) (StreamInterface, error)
33+
Freeze(ctx context.Context, name string, opts v1alpha3.VirtualMachineFreeze) error
3434
Unfreeze(ctx context.Context, name string) error
35-
AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineAddVolume) error
36-
RemoveVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineRemoveVolume) error
35+
AddVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineAddVolume) error
36+
RemoveVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineRemoveVolume) error
3737
CancelEvacuation(ctx context.Context, name string, dryRun []string) error
3838
}
3939

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

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

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

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

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

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

api/client/kubeclient/request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"k8s.io/client-go/rest"
2929
)
3030

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

3333
func RequestFromConfig(config *rest.Config, resource, name, namespace, subresource string,
3434
queryParams url.Values) (*http.Request, error) {

api/client/kubeclient/vm.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
virtv1 "kubevirt.io/api/core/v1"
3535

3636
virtualizationv1alpha2 "github.com/deckhouse/virtualization/api/client/generated/clientset/versioned/typed/core/v1alpha2"
37-
"github.com/deckhouse/virtualization/api/subresources/v1alpha2"
37+
"github.com/deckhouse/virtualization/api/subresources/v1alpha3"
3838
)
3939

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

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

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

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

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

150-
func (v vm) RemoveVolume(ctx context.Context, name string, opts v1alpha2.VirtualMachineRemoveVolume) error {
150+
func (v vm) RemoveVolume(ctx context.Context, name string, opts v1alpha3.VirtualMachineRemoveVolume) error {
151151
path := fmt.Sprintf(subresourceURLTpl, v.namespace, v.resource, name, "removevolume")
152152
return v.restClient.
153153
Put().

api/scripts/update-codegen.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ function generate::subresources {
4949
--boilerplate "${SCRIPT_DIR}/boilerplate.go.txt" \
5050
"${API_ROOT}/subresources"
5151

52-
# "${THIS_PKG}/subresources/v1alpha2" "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/version"
52+
# "${THIS_PKG}/subresources/v1alpha3" "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/version"
5353
# TODO: replace packages when legacyVMStorage is removed
5454
go tool openapi-gen \
5555
--output-pkg "openapi" \
5656
--output-dir "${ROOT}/images/virtualization-artifact/pkg/apiserver/api/generated/openapi" \
5757
--output-file "zz_generated.openapi.go" \
5858
--go-header-file "${SCRIPT_DIR}/boilerplate.go.txt" \
5959
-r /dev/null \
60-
"${THIS_PKG}/core/v1alpha2" "${THIS_PKG}/subresources/v1alpha2" "kubevirt.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/version"
60+
"${THIS_PKG}/core/v1alpha2" "${THIS_PKG}/subresources/v1alpha2" "${THIS_PKG}/subresources/v1alpha3" "kubevirt.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/version"
6161
}
6262

6363
function generate::core {

api/subresources/install/install.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ import (
2222

2323
"github.com/deckhouse/virtualization/api/subresources"
2424
"github.com/deckhouse/virtualization/api/subresources/v1alpha2"
25+
"github.com/deckhouse/virtualization/api/subresources/v1alpha3"
2526
)
2627

2728
// Install registers the API group and adds types to a scheme
2829
func Install(scheme *runtime.Scheme) {
2930
utilruntime.Must(subresources.AddToScheme(scheme))
3031
utilruntime.Must(v1alpha2.AddToScheme(scheme))
31-
utilruntime.Must(scheme.SetVersionPriority(v1alpha2.SchemeGroupVersion))
32+
utilruntime.Must(v1alpha3.AddToScheme(scheme))
33+
utilruntime.Must(scheme.SetVersionPriority(v1alpha3.SchemeGroupVersion))
3234
}

api/subresources/register.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ var (
4848
AddToScheme = SchemeBuilder.AddToScheme
4949
)
5050

51-
// TODO: move types virtv2 to pkg/apiserver/api/install
5251
func addKnownTypes(scheme *runtime.Scheme) error {
5352
scheme.AddKnownTypes(SchemeGroupVersion,
5453
&APIVirtualMachine{},

api/subresources/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
)
2222

2323
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
24+
2425
type APIVirtualMachine struct {
2526
metav1.TypeMeta
2627
metav1.ObjectMeta

api/subresources/v1alpha2/register.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ var (
5151

5252
func addKnownTypes(scheme *runtime.Scheme) error {
5353
scheme.AddKnownTypes(SchemeGroupVersion,
54-
&APIVirtualMachine{},
5554
&VirtualMachineConsole{},
5655
&VirtualMachineVNC{},
5756
&VirtualMachinePortForward{},

api/subresources/v1alpha2/types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ package v1alpha2
1818

1919
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020

21-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
22-
type APIVirtualMachine struct {
23-
metav1.TypeMeta `json:",inline"`
24-
metav1.ObjectMeta `json:"metadata,omitempty"`
25-
}
26-
2721
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2822
// +k8s:conversion-gen:explicit-from=net/url.Values
2923

api/subresources/v1alpha2/zz_generated.conversion.go

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)