GithubHelp home page GithubHelp logo

client-go's Introduction

KubeVirt

Build Status Go Report Card Licensed under Apache License version 2.0 Coverage Status CII Best Practices Visit our Slack channel FOSSA Status Quality Gate Status

KubeVirt is a virtual machine management add-on for Kubernetes. The aim is to provide a common ground for virtualization solutions on top of Kubernetes.

Introduction

Virtualization extension for Kubernetes

At its core, KubeVirt extends Kubernetes by adding additional virtualization resource types (especially the VM type) through Kubernetes's Custom Resource Definitions API. By using this mechanism, the Kubernetes API can be used to manage these VM resources alongside all other resources Kubernetes provides.

The resources themselves are not enough to launch virtual machines. For this to happen the functionality and business logic needs to be added to the cluster. The functionality is not added to Kubernetes itself, but rather added to a Kubernetes cluster by running additional controllers and agents on an existing cluster.

The necessary controllers and agents are provided by KubeVirt.

As of today KubeVirt can be used to declaratively

  • Create a predefined VM
  • Schedule a VM on a Kubernetes cluster
  • Launch a VM
  • Stop a VM
  • Delete a VM

To start using KubeVirt

Try our quickstart at kubevirt.io.

See our user documentation at kubevirt.io/docs.

Once you have the basics, you can learn more about how to run KubeVirt and its newest features by taking a look at:

To start developing KubeVirt

To set up a development environment please read our Getting Started Guide. To learn how to contribute, please read our contribution guide.

You can learn more about how KubeVirt is designed (and why it is that way), and learn more about the major components by taking a look at our developer documentation:

Useful links

The KubeVirt SIG-release repo is responsible for information regarding upcoming and previous releases.

Community

If you got enough of code and want to speak to people, then you got a couple of options:

Related resources

Submitting patches

When sending patches to the project, the submitter is required to certify that they have the legal right to submit the code. This is achieved by adding a line

Signed-off-by: Real Name <[email protected]>

to the bottom of every commit message. Existence of such a line certifies that the submitter has complied with the Developer's Certificate of Origin 1.1, (as defined in the file docs/developer-certificate-of-origin).

This line can be automatically added to a commit in the correct format, by using the '-s' option to 'git commit'.

License

KubeVirt is distributed under the Apache License, Version 2.0.

Copyright 2016

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.

FOSSA Status

FOSSA Status

client-go's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

client-go's Issues

execute command:virtctl addvolume return:error adding volume, the server could not find the requested resource

i want to hotplug a volume to vmi, execute command:virtctl addvolume myvmi --volume-name=datavolume --serial=1234567890, but return:error adding volume, the server could not find the requested resource
please help me fix it

kubectl get pv,pvc,dv,vmi

NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
persistentvolume/mypv 10Gi RWX Recycle Bound default/mypvc nfs 64m
persistentvolume/mypvhp 500Mi RWX Recycle Bound default/datavolume nfs 63m
persistentvolume/pv-local 5Gi RWX Retain Bound default/volume-hotplug1 local-standard 63m

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/datavolume Bound mypvhp 500Mi RWX nfs 57m
persistentvolumeclaim/mypvc Bound mypv 10Gi RWX nfs 63m
persistentvolumeclaim/volume-hotplug1 Bound pv-local 5Gi RWX local-standard 56m

NAME PHASE PROGRESS RESTARTS AGE
datavolume.cdi.kubevirt.io/datavolume 57m
datavolume.cdi.kubevirt.io/volume-hotplug1 Succeeded 100.0% 56m

NAME AGE PHASE IP NODENAME
virtualmachineinstance.kubevirt.io/myvmi 63m Running 10.244.0.11 k8s-master

k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible

Hi team,
I'd like to run the example 'list-vm.go' of client-go but got a blocking issue , and have no idea how to fix. is there any suggestion on this ? thanks.
BTW, I use go 1.19,

~/Desktop/backup/client-go$go mod tidy
go: finding module for package k8s.io/client-go/kubernetes/typed/discovery/v1beta1
go: finding module for package k8s.io/client-go/kubernetes/typed/certificates/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/discovery/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/admissionregistration/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1
go: finding module for package k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1
go: finding module for package k8s.io/client-go/kubernetes/typed/authentication/v1alpha1
go: finding module for package k8s.io/client-go/kubernetes/typed/autoscaling/v2
go: finding module for package k8s.io/client-go/kubernetes/typed/events/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1
go: finding module for package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1
go: finding module for package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2
go: finding module for package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3
go: finding module for package k8s.io/client-go/kubernetes/typed/networking/v1alpha1
go: finding module for package k8s.io/client-go/kubernetes/typed/node/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/policy/v1
go: finding module for package k8s.io/client-go/kubernetes/typed/resource/v1alpha1
go: finding module for package github.com/googleapis/gnostic/OpenAPIv2
go: finding module for package k8s.io/apimachinery/pkg/util/clock
go: finding module for package k8s.io/api/auditregistration/v1alpha1
go: finding module for package k8s.io/api/batch/v2alpha1
go: finding module for package k8s.io/api/settings/v1alpha1
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/admissionregistration/v1: package k8s.io/client-go/kubernetes/typed/admissionregistration/v1 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1: package k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1: package k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/authentication/v1alpha1: package k8s.io/client-go/kubernetes/typed/authentication/v1alpha1 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/autoscaling/v2: package k8s.io/client-go/kubernetes/typed/autoscaling/v2 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible
kubevirt.io/client-go/kubecli imports
k8s.io/client-go/kubernetes/typed/certificates/v1: package k8s.io/client-go/kubernetes/typed/certificates/v1 provided by k8s.io/client-go at latest version v0.27.4 but not at required version v12.0.0+incompatible

create datavolume err: v1.GetOptions is not suitable for converting to "kubevirt.io/v1"

v1.GetOptions is not suitable for converting to "kubevirt.io/v1" in scheme "kubevirt.io/client-go/generated/containerized-data-importer/clientset/versioned/scheme
/register.go:31"

go 1.19, kubevirt client-go v1.0.0, I used methods of DataVolumeInterface

type DataVolumeInterface interface {
	Create(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.CreateOptions) (*v1beta1.DataVolume, error)
	Update(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error)
	UpdateStatus(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error)
	Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
	DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
	Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataVolume, error)
	List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataVolumeList, error)
	Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataVolume, err error)
	DataVolumeExpansion
}

kubevirt.io/client-go/kubecli is not compatible with k8s.io/client-go v0.21.0

There are some changes in apis with v0.21.0 and kubevirt.io/client-go is not compatible with those changes.

kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/batch/v2alpha1: module k8s.io/client-go@latest found (v11.0.0+incompatible, replaced by k8s.io/[email protected]), but does not contain package k8s.io/client-go/kubernetes/typed/batch/v2alpha1
kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/discovery/v1alpha1: module k8s.io/client-go@latest found (v11.0.0+incompatible, replaced by k8s.io/[email protected]), but does not contain package k8s.io/client-go/kubernetes/typed/discovery/v1alpha1

Some projects under kubevirt started using v0.21.0 (See https://github.com/kubevirt/hyperconverged-cluster-operator/blob/main/go.mod#L88) and this client should be updated as well.

unknown revision v0.0.0

when I use the commad "go mod tidy" to resolve dependencies,the following error occurred.Can you telll me how to deal it?

go: finding module for package kubevirt.io/kubevirt
go: found kubevirt.io/kubevirt in kubevirt.io/kubevirt v0.39.1
go: kubevirt.io/[email protected] requires
github.com/openshift/[email protected]: reading github.com/openshift/api/go.mod at revision v0.0.0: unknown revision v0.0.0

Not Compataible | kubevirt client-go in a code-base that uses Kubenetes 1.18.8 dependencies.

Hi Fellas,
After migrating the code-base to k8s 1.18.8 dependencies, kubevirt client-go started crashing.
kubevirt client-go Version used is v0.32.0 (Although tried with multiple versions).
GO Version is 1.15
Looks like No support for latest k8s Versions.

Please let me know if there is any work-around !

FYI, attaching the error below :

# kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:74:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("network-attachment-definitions").Name(name).VersionedParams(&options, scheme.ParameterCodec).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:91:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("network-attachment-definitions").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:108:8: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("network-attachment-definitions").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Watch
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:118:5: not enough arguments in call to c.client.Post().Namespace(c.ns).Resource("network-attachment-definitions").Body(networkAttachmentDefinition).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:131:5: not enough arguments in call to c.client.Put().Namespace(c.ns).Resource("network-attachment-definitions").Name(networkAttachmentDefinition.ObjectMeta.Name).Body(networkAttachmentDefinition).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:143:5: not enough arguments in call to c.client.Delete().Namespace(c.ns).Resource("network-attachment-definitions").Name(name).Body(options).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:159:5: not enough arguments in call to c.client.Delete().Namespace(c.ns).Resource("network-attachment-definitions").VersionedParams(&listOptions, scheme.ParameterCodec).Timeout(timeout).Body(options).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go:172:5: not enough arguments in call to c.client.Patch(pt).Namespace(c.ns).Resource("network-attachment-definitions").SubResource(subresources...).Name(name).Body(data).Do
        have ()
        want (context.Context)
# kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:75:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("virtualmachinesnapshots").Name(name).VersionedParams(&options, scheme.ParameterCodec).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:92:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("virtualmachinesnapshots").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:109:8: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("virtualmachinesnapshots").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Watch
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:119:5: not enough arguments in call to c.client.Post().Namespace(c.ns).Resource("virtualmachinesnapshots").Body(virtualMachineSnapshot).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:132:5: not enough arguments in call to c.client.Put().Namespace(c.ns).Resource("virtualmachinesnapshots").Name(virtualMachineSnapshot.ObjectMeta.Name).Body(virtualMachineSnapshot).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:148:5: not enough arguments in call to c.client.Put().Namespace(c.ns).Resource("virtualmachinesnapshots").Name(virtualMachineSnapshot.ObjectMeta.Name).SubResource("status").Body(virtualMachineSnapshot).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:160:5: not enough arguments in call to c.client.Delete().Namespace(c.ns).Resource("virtualmachinesnapshots").Name(name).Body(options).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:176:5: not enough arguments in call to c.client.Delete().Namespace(c.ns).Resource("virtualmachinesnapshots").VersionedParams(&listOptions, scheme.ParameterCodec).Timeout(timeout).Body(options).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshot.go:189:5: not enough arguments in call to c.client.Patch(pt).Namespace(c.ns).Resource("virtualmachinesnapshots").SubResource(subresources...).Name(name).Body(data).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshotcontent.go:75:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("virtualmachinesnapshotcontents").Name(name).VersionedParams(&options, scheme.ParameterCodec).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1/virtualmachinesnapshotcontent.go:75:5: too many errors
# kubevirt.io/client-go/log
../../vendor/kubevirt.io/client-go/log/log.go:72:25: undefined: log.Context
../../vendor/kubevirt.io/client-go/log/log.go:111:26: undefined: log.NewContext
../../vendor/kubevirt.io/client-go/log/log.go:155:17: undefined: log.NewContext
../../vendor/kubevirt.io/client-go/log/log.go:160:17: undefined: log.NewContext
# kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:75:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("alertmanagers").Name(name).VersionedParams(&options, scheme.ParameterCodec).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:92:5: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("alertmanagers").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:109:8: not enough arguments in call to c.client.Get().Namespace(c.ns).Resource("alertmanagers").VersionedParams(&opts, scheme.ParameterCodec).Timeout(timeout).Watch
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:119:5: not enough arguments in call to c.client.Post().Namespace(c.ns).Resource("alertmanagers").Body(alertmanager).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:132:5: not enough arguments in call to c.client.Put().Namespace(c.ns).Resource("alertmanagers").Name(alertmanager.ObjectMeta.Name).Body(alertmanager).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:148:5: not enough arguments in call to c.client.Put().Namespace(c.ns).Resource("alertmanagers").Name(alertmanager.ObjectMeta.Name).SubResource("status").Body(alertmanager).Do
        have ()
        want (context.Context)
../../vendor/kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned/typed/monitoring/v1/alertmanager.go:160:5: not enough arguments in call to c.client.Delete().Namespace(c.ns).Resource("alertmanagers").Name(name).Body(options).Do
        have ()
        want (context.Context)

undefined: log.Context on go vet

when importing kubeivrt v0.40.0-rc.2 on KMP repo (see go mod below) with appropriate client-go, go mod tidy & vendor succeeds but then go vet fails on:

make vet
/home/ralavi/go/src/github.com/k8snetworkplumbingwg/kubemacpool/build/_output/bin//go//bin//go vet ./pkg/... ./cmd/... ./tests/...
# kubevirt.io/client-go/log
vendor/kubevirt.io/client-go/log/log.go:72:25: undefined: log.Context
vendor/kubevirt.io/client-go/log/log.go:111:26: undefined: log.NewContext
vendor/kubevirt.io/client-go/log/log.go:155:17: undefined: log.NewContext
vendor/kubevirt.io/client-go/log/log.go:160:17: undefined: log.NewContext
make: *** [Makefile:79: vet] Error 2
module github.com/k8snetworkplumbingwg/kubemacpool

go 1.15

require (
	github.com/go-logr/logr v0.3.0
	github.com/intel/multus-cni v0.0.0-20200316125841-bfaf22964b51
	github.com/mattn/goveralls v0.0.7
	github.com/onsi/ginkgo v1.15.0
	github.com/onsi/gomega v1.10.5
	github.com/pkg/errors v0.9.1
	github.com/qinqon/kube-admission-webhook v0.14.0
	github.com/spf13/pflag v1.0.5
	gomodules.xyz/jsonpatch/v2 v2.1.0
	k8s.io/api v0.20.2
	k8s.io/apimachinery v0.20.2
	k8s.io/client-go v12.0.0+incompatible
	k8s.io/code-generator v0.20.2
	kubevirt.io/client-go v0.40.0-rc.2
	kubevirt.io/kubevirt v0.40.0-rc.2
	kubevirt.io/qe-tools v0.1.6
	sigs.k8s.io/controller-runtime v0.8.2
	sigs.k8s.io/controller-tools v0.4.0
	sigs.k8s.io/kustomize/kustomize/v3 v3.3.0
)

replace (
	bitbucket.org/ww/goautoneg => github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d
	github.com/go-logr/zapr => github.com/go-logr/zapr v0.2.0
	github.com/openshift/api => github.com/openshift/api v0.0.0-20201120165435-072a4cd8ca42
	github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200521150516-05eb9880269c
	golang.org/x/text => golang.org/x/text v0.3.3

	// Pinned to kubernetes-0.20.2
	k8s.io/api => k8s.io/api v0.20.2
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.2
	k8s.io/apimachinery => k8s.io/apimachinery v0.20.2
	k8s.io/apiserver => k8s.io/apiserver v0.20.2
	k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.2
	k8s.io/client-go => k8s.io/client-go v0.20.2
	k8s.io/cloud-provider => k8s.io/cloud-provider v0.20.2
	k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.2
	k8s.io/component-base => k8s.io/component-base v0.20.2
	k8s.io/cri-api => k8s.io/cri-api v0.20.2
	k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.20.2
	k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.2
	k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.20.2
	k8s.io/kube-proxy => k8s.io/kube-proxy v0.20.2
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.20.2
	k8s.io/kubelet => k8s.io/kubelet v0.20.2
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.20.2
	k8s.io/metrics => k8s.io/metrics v0.20.2
	k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.20.2

	kubevirt.io/client-go => kubevirt.io/client-go v0.40.0-rc.2
	sigs.k8s.io/structured-merge-diff => sigs.k8s.io/structured-merge-diff v1.0.2
)

also tried v0.40.0, had no luck..
issue looks related to former issue but I didn't find something useful there.

client-go support informer

hi, I am very interested in the kubevirt project and also trying to use client-go recently.

Currently, it supports clientset but lacks informer. Is there a development plan for informer?

Thanks.

Cannot use MockKubevirtClientInstance

kubevirt.io/client-go/kubecli

../../go/pkg/mod/kubevirt.io/[email protected]/kubecli/kubevirt_test_utils.go:32:9: cannot use MockKubevirtClientInstance (variable of type *MockKubevirtClient) as type KubevirtClient in return statement:
*MockKubevirtClient does not implement KubevirtClient (missing NetworkingV1alpha1 method)

I am currently using kubevirt v0.59.0. it's all working as expected in go.mod but while building the code, it's above above issue.

run example failed

What happened:
When I run the example "listvm" in corresponding folder, execute the command to install deps:

go get kubevirt.io/client-go/kubecli

then, the error occurs (w11 and linux have tried)

o: kube-go imports
        kubevirt.io/client-go/api/v1: module kubevirt.io/client-go@latest found (v1.2.0), but does not contain package kubevirt.io/client-go/api/v1
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/admissionregistration/v1: package k8s.io/client-go/kubernetes/typed/admissionregistration/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1: package k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1: package k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/authentication/v1alpha1: package k8s.io/client-go/kubernetes/typed/authentication/v1alpha1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/autoscaling/v2: package k8s.io/client-go/kubernetes/typed/autoscaling/v2 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/certificates/v1: package k8s.io/client-go/kubernetes/typed/certificates/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/discovery/v1: package k8s.io/client-go/kubernetes/typed/discovery/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/discovery/v1beta1: package k8s.io/client-go/kubernetes/typed/discovery/v1beta1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/events/v1: package k8s.io/client-go/kubernetes/typed/events/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1: module k8s.io/client-go@latest found (v0.29.3), but does not contain package k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1: package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2: package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3: package k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/networking/v1alpha1: package k8s.io/client-go/kubernetes/typed/networking/v1alpha1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/node/v1: package k8s.io/client-go/kubernetes/typed/node/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/policy/v1: package k8s.io/client-go/kubernetes/typed/policy/v1 provided by k8s.io/client-go at latest version v0.29.3 but not at required version v12.0.0+incompatible
go: kube-go imports
        kubevirt.io/client-go/kubecli imports
        k8s.io/client-go/kubernetes/typed/resource/v1alpha1: module k8s.io/client-go@latest found (v0.29.3), but does not contain package k8s.io/client-go/kubernetes/typed/resource/v1alpha1      
go: kube-go imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/discovery imports
        github.com/googleapis/gnostic/OpenAPIv2: module github.com/googleapis/gnostic@latest found (v0.7.0), but does not contain package github.com/googleapis/gnostic/OpenAPIv2
go: kube-go imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1 imports
        k8s.io/api/auditregistration/v1alpha1: module k8s.io/api@latest found (v0.29.3), but does not contain package k8s.io/api/auditregistration/v1alpha1
go: kube-go imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/batch/v2alpha1 imports
        k8s.io/api/batch/v2alpha1: module k8s.io/api@latest found (v0.29.3), but does not contain package k8s.io/api/batch/v2alpha1
go: kube-go imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/settings/v1alpha1 imports
        k8s.io/api/settings/v1alpha1: module k8s.io/api@latest found (v0.29.3), but does not contain package k8s.io/api/settings/v1alpha1
go: kube-go imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/util/flowcontrol imports
        k8s.io/apimachinery/pkg/util/clock: module k8s.io/apimachinery@latest found (v0.29.3), but does not contain package k8s.io/apimachinery/pkg/util/clock

What you expected to happen:
A clear and concise description of what you expected to happen.

How to reproduce it (as minimally and precisely as possible):
Steps to reproduce the behavior.

Additional context:
Add any other context about the problem here.

Environment:

  • KubeVirt version (use virtctl version): N/A
  • Kubernetes version (use kubectl version): N/A
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: N/A
  • OS (e.g. from /etc/os-release): N/A
  • Kernel (e.g. uname -a): N/A
  • Install tools: N/A
  • Others: N/A

Add examples

Need some examples to show how to use go-client.

how to watch vm status change

kubevirt client-go , how to watch vm status change? like K8S watch pod status change then send event Trigger business changes!

func main() {
    config, err := rest.InClusterConfig()
    if err != nil {
        panic(err.Error())
    }

    clientset, err := kubernetes.NewForConfig(config)
    if err != nil {
        panic(err.Error())
    }

    watchlist := cache.NewListWatchFromClient(clientset.Core().RESTClient(), "pods", v1.NamespaceDefault, 
       fields.Everything())
    _, controller := cache.NewInformer(
        watchlist,
        &v1.Pod{},
        time.Second * 0,
        cache.ResourceEventHandlerFuncs{
            AddFunc: func(obj interface{}) {
                fmt.Printf("add: %s \n", obj)
            },
            DeleteFunc: func(obj interface{}) {
                fmt.Printf("delete: %s \n", obj)
            },
            UpdateFunc:func(oldObj, newObj interface{}) {
                fmt.Printf("old: %s, new: %s \n", oldObj, newObj)
            },
        },
    )
    stop := make(chan struct{})
    go controller.Run(stop)
}

GetKubevirtClientFromRESTConfig should not change the content of parameter

GetKubevirtClientFromRESTConfig will change the content of config parameter. This will overwrite the value of field NegotiatedSerializer silently.

k.istio, err = istioclient.NewForConfig(config)
k.kubevirt, err = kubecli.GetKubevirtClientFromRESTConfig(config)
if err != nil {
    return nil, err
}
...

This code snipped makes method UseOrCreateObject of k8s.io/client-go return error likes W0701 15:23:18.284503 57102 reflector.go:436] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:167: watch of *v1.Node ended with: an error on the server ("unable to decode an event from the watch stream: unable to decode watch event: no kind \"Node\" is registered for version \"v1\" in scheme \"pkg/runtime/scheme.go:100\"") has prevented the request from succeeding, because NegotiatedSerializer has been overwritten.

I have read packages like prometheus-operator/prometheus-operator, k8s.io/apiextensions-apiserver . These package won't change content of config parameter. So I think it's better for GetKubevirtClientFromRESTConfig not to change paramter of config.

Recommendation to use client-go with k8s.io v0.26.0

We are using kubevirt.io/client-go package as a dependency in our project. We want to migrate our project to use k8s.io v0.26.0.
While compiling with k8s.io v0.26.0, we are seeing following failures related to kubevirt.io/client-go.

# kubevirt.io/client-go/kubecli
/cachevol/mod/kubevirt.io/[email protected]/kubecli/kubevirt_test_utils.go:32:9: cannot use MockKubevirtClientInstance (variable of type *MockKubevirtClient) as type KubevirtClient in return statement:
	*MockKubevirtClient does not implement KubevirtClient (missing AdmissionregistrationV1alpha1 method)

We observed that kubevirt is using k8s.io v0.23.5. could you please recommend a way to use this library with k8s.io v0.26.0.
NOTE: We are seeing above error with k8s.io v0.25.0 as well.

where is the documentation ?

Hi,

Is it possible to add some documentation? (one small example without any documentation isn't enough)
in the contrary to python client which is have a million examples and way of usage.

Having issues pulling package

Hello I am attempting to pull the client but I am presented with this error when I do a

go get githube.com/kubevirt/client-go
github.com/kubevirt/client-go/kubecli: github.com/kubevirt/[email protected]: parsing go.mod:
 module declares its path as: kubevirt.io/client-go
    but was required as: github.com/kubevirt/client-go

Do you have any idea how to resolve this?

thank you

Incorrect version values from version.Get()

I vendored client-go v0.19.0 in my project.
I just fetch the version and log it on server startup, and I see something like

{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator using kubevirt client-go (v0.0.0-master+$Format:%h$ $Format:%H$ 1970-01-01T00:00:00Z)","pos":"app.go:77","timestamp":"2019-07-26T13:21:30.760879Z"}

I was expecting

  • GitVersion [v]0.19.0
  • GitCommit
  • BuildDate a valid date

it seems these fields aren't properly set when the tag is cut.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.