-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Isteb4k <[email protected]>
- Loading branch information
Showing
21 changed files
with
316 additions
and
9 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"feature": { | ||
"network": { | ||
"incoming": "steal", | ||
"outgoing": true | ||
}, | ||
"fs": { | ||
"mode": "read", | ||
"read_only": [ "^/var/", "^/etc/" ] | ||
}, | ||
"env": true | ||
}, | ||
"agent": { | ||
"communication_timeout": 6000, | ||
"startup_timeout": 56000 | ||
}, | ||
"internal_proxy": { | ||
"start_idle_timeout": 13000, | ||
"idle_timeout": 1500 | ||
}, | ||
"target": { | ||
"namespace": "d8-virtualization", | ||
"path": "deployment/virtualization-api/container/virtualization-api" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
images/virt-artifact/patches/017-fix-vmi-subresource-url.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/staging/src/kubevirt.io/client-go/kubecli/vmi.go b/staging/src/kubevirt.io/client-go/kubecli/vmi.go | ||
index a9e071350..cb867cfc6 100644 | ||
--- a/staging/src/kubevirt.io/client-go/kubecli/vmi.go | ||
+++ b/staging/src/kubevirt.io/client-go/kubecli/vmi.go | ||
@@ -47,7 +47,10 @@ import ( | ||
"kubevirt.io/client-go/subresources" | ||
) | ||
|
||
-const vmiSubresourceURL = "/apis/subresources.kubevirt.io/%s/namespaces/%s/virtualmachineinstances/%s/%s" | ||
+const ( | ||
+ vmiSubresourceURL = "/apis/subresources.kubevirt.io/%s/namespaces/%s/virtualmachineinstances/%s/%s" | ||
+ vmiSubresourceVirtualizationURL = "/apis/subresources.virtualization.deckhouse.io/%s/namespaces/%s/virtualmachineinstances/%s/%s" | ||
+) | ||
|
||
func (k *kubevirt) VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface { | ||
return &vmis{ | ||
@@ -470,7 +473,7 @@ func (v *vmis) Screenshot(ctx context.Context, name string, screenshotOptions *v | ||
} | ||
|
||
func (v *vmis) AddVolume(ctx context.Context, name string, addVolumeOptions *v1.AddVolumeOptions) error { | ||
- uri := fmt.Sprintf(vmiSubresourceURL, v1.ApiStorageVersion, v.namespace, name, "addvolume") | ||
+ uri := fmt.Sprintf(vmiSubresourceVirtualizationURL, v1.ApiStorageVersion, v.namespace, name, "addvolume") | ||
|
||
JSON, err := json.Marshal(addVolumeOptions) | ||
|
||
@@ -482,7 +485,7 @@ func (v *vmis) AddVolume(ctx context.Context, name string, addVolumeOptions *v1. | ||
} | ||
|
||
func (v *vmis) RemoveVolume(ctx context.Context, name string, removeVolumeOptions *v1.RemoveVolumeOptions) error { | ||
- uri := fmt.Sprintf(vmiSubresourceURL, v1.ApiStorageVersion, v.namespace, name, "removevolume") | ||
+ uri := fmt.Sprintf(vmiSubresourceVirtualizationURL, v1.ApiStorageVersion, v.namespace, name, "removevolume") | ||
|
||
JSON, err := json.Marshal(removeVolumeOptions) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
images/virtualization-artifact/pkg/apiserver/registry/vm/rest/addvolume.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
Copyright 2024 Flant JSC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package rest | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
|
||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apiserver/pkg/registry/rest" | ||
"k8s.io/client-go/tools/cache" | ||
|
||
"github.com/deckhouse/virtualization-controller/pkg/tls/certmanager" | ||
"github.com/deckhouse/virtualization/api/subresources" | ||
) | ||
|
||
type AddVolumeREST struct { | ||
vmLister cache.GenericLister | ||
proxyCertManager certmanager.CertificateManager | ||
kubevirt KubevirtApiServerConfig | ||
} | ||
|
||
var ( | ||
_ rest.Storage = &AddVolumeREST{} | ||
_ rest.Connecter = &AddVolumeREST{} | ||
) | ||
|
||
func NewAddVolumeREST(vmLister cache.GenericLister, kubevirt KubevirtApiServerConfig, proxyCertManager certmanager.CertificateManager) *AddVolumeREST { | ||
return &AddVolumeREST{ | ||
vmLister: vmLister, | ||
kubevirt: kubevirt, | ||
proxyCertManager: proxyCertManager, | ||
} | ||
} | ||
|
||
func (r AddVolumeREST) New() runtime.Object { | ||
return &subresources.VirtualMachineAddVolume{} | ||
} | ||
|
||
func (r AddVolumeREST) Destroy() { | ||
} | ||
|
||
func (r AddVolumeREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) { | ||
addVolumeOpts, ok := opts.(*subresources.VirtualMachineAddVolume) | ||
if !ok { | ||
return nil, fmt.Errorf("invalid options object: %#v", opts) | ||
} | ||
location, transport, err := AddVolumeLocation(ctx, r.vmLister, name, addVolumeOpts, r.kubevirt, r.proxyCertManager) | ||
if err != nil { | ||
return nil, err | ||
} | ||
handler := newThrottledUpgradeAwareProxyHandler(location, transport, responder, r.kubevirt.ServiceAccount) | ||
return handler, nil | ||
} | ||
|
||
// NewConnectOptions implements rest.Connecter interface | ||
func (r AddVolumeREST) NewConnectOptions() (runtime.Object, bool, string) { | ||
return &subresources.VirtualMachineConsole{}, false, "" | ||
} | ||
|
||
// ConnectMethods implements rest.Connecter interface | ||
func (r AddVolumeREST) ConnectMethods() []string { | ||
return upgradeableMethods | ||
} | ||
|
||
func AddVolumeLocation( | ||
ctx context.Context, | ||
getter cache.GenericLister, | ||
name string, | ||
opts *subresources.VirtualMachineAddVolume, | ||
kubevirt KubevirtApiServerConfig, | ||
proxyCertManager certmanager.CertificateManager, | ||
) (*url.URL, *http.Transport, error) { | ||
return streamLocation(ctx, getter, name, opts, "addvolume", kubevirt, proxyCertManager) | ||
} |
Oops, something went wrong.