Comments (16)
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
did you port 'kubecli' into your project? I still encounter such problem after copied the kubecli package from client-go into my project.
No, what I did is follow the instructions from https://github.com/kubevirt/api. Namely, first install the client-gen
binary via
go install k8s.io/code-generator/cmd/client-gen@latest
Then add the API project as a dependency to your project
go get kubevirt.io/api
Then run the code generator
client-gen --input-base="kubevirt.io/api/" --input="core/v1" --output-package="testapi/client" --output-base="../" --clientset-name="versioned" --go-header-file boilerplate.go.txt
Then you can use the generated API client in your code.
from client-go.
I can confirm the same using golang 1.20.6.
from client-go.
Finally, I have to generate the client by myself. And I link my project here for reference : https://github.com/jeven2016/kubevirt-manager
I generated a project named 'kubevirt.io' based on 'kubevirt/api' (https://github.com/kubevirt/api), and it now can work for go 1.19 with kubernetes v0.27.1
from client-go.
Same here, currently unusable
from client-go.
Also here
from client-go.
any updates?
from client-go.
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
from client-go.
Can you share it?
from client-go.
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
did you port 'kubecli' into your project? I still encounter such problem after copied the kubecli package from client-go into my project.
from client-go.
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
I was able to generate the client using client-gen
, however it seems it doesn't include the Start
/Stop
methods.
Seems like a bit of a sub-optimal solution. If generating the client is the recommended path forward, is the recommended way to handle start/stop actions just to patch the VirtualMachine.Spec.Running
field? Or is there a straightforward way to support the Start
/Stop
methods in the generated client? Or will this issue (module imports) be fixed in kubevirt/client-go
?
from client-go.
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
I was able to generate the client using
client-gen
, however it seems it doesn't include theStart
/Stop
methods.Seems like a bit of a sub-optimal solution. If generating the client is the recommended path forward, is the recommended way to handle start/stop actions just to patch the
VirtualMachine.Spec.Running
field? Or is there a straightforward way to support theStart
/Stop
methods in the generated client? Or will this issue (module imports) be fixed inkubevirt/client-go
?
I think you have to directly call the rest api after checked the code of kubecli, the below code I currently used can work as expected:
VmSubresourceURLFmt = "/apis/subresources.kubevirt.io/%s/namespaces/%s/virtualmachines/%s/%s"
// invoke rest api to start a VMI
func (v *VmManager) start(ctx context.Context, namespace string, name string, startOptions *kv1.StartOptions) error {
uri := fmt.Sprintf(constants.VmSubresourceURLFmt, kv1.ApiStorageVersion, namespace, name, "start")
optsJson, err := json.Marshal(startOptions)
if err != nil {
return err
}
// here kvClient is *versioned.Clientset
return v.kvClient.RESTClient().Put().AbsPath(uri).Body(optsJson).Do(ctx).Error()
}
// invoke rest api to stop a VMI
func (v *VmManager) stop(ctx context.Context, namespace string, name string, stopOptions *kv1.StopOptions) error {
uri := fmt.Sprintf(constants.VmSubresourceURLFmt, kv1.ApiStorageVersion, namespace, name, "stop")
optsJson, err := json.Marshal(stopOptions)
if err != nil {
return err
}
return v.kvClient.RESTClient().Put().AbsPath(uri).Body(optsJson).Do(ctx).Error()
}
from client-go.
I suspect this is not going to be fixed anymore. Probably the standard way now is to use the API project and generate the client using the Kubernetes client code generator. I followed the documentation in the API project and got it working for kubevirt and CDI.
did you port 'kubecli' into your project? I still encounter such problem after copied the kubecli package from client-go into my project.
No, what I did is follow the instructions from https://github.com/kubevirt/api. Namely, first install the
client-gen
binary viago install k8s.io/code-generator/cmd/client-gen@latestThen add the API project as a dependency to your project
go get kubevirt.io/apiThen run the code generator
client-gen --input-base="kubevirt.io/api/" --input="core/v1" --output-package="testapi/client" --output-base="../" --clientset-name="versioned" --go-header-file boilerplate.go.txtThen you can use the generated API client in your code.
How do I reference it in my code instead of the normal package?
from client-go.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
from client-go.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten
from client-go.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
/close
from client-go.
@kubevirt-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen
.
Mark the issue as fresh with/remove-lifecycle rotten
./close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
from client-go.
Related Issues (19)
- where is the documentation ? HOT 4
- Replace glog to klog HOT 4
- unknown revision v0.0.0 HOT 5
- undefined: log.Context on go vet HOT 1
- GetKubevirtClientFromRESTConfig should not change the content of parameter HOT 2
- kubevirt.io/client-go/kubecli is not compatible with k8s.io/client-go v0.21.0 HOT 8
- how to watch vm status change HOT 5
- execute command:virtctl addvolume return:error adding volume, the server could not find the requested resource HOT 4
- Having issues pulling package HOT 5
- Add examples HOT 5
- Recommendation to use client-go with k8s.io v0.26.0 HOT 6
- Cannot use MockKubevirtClientInstance HOT 8
- Incorrect version values from version.Get() HOT 6
- create datavolume err: v1.GetOptions is not suitable for converting to "kubevirt.io/v1" HOT 4
- run example failed HOT 2
- Project missing LICENSE file. HOT 1
- Not Compataible | kubevirt client-go in a code-base that uses Kubenetes 1.18.8 dependencies. HOT 2
- client-go support informer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client-go.