kubecli

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 109 Imported by: 160

Documentation

Index

Constants

View Source
const (
	ApiGroupName = "/apis/" + v1.SubresourceGroupName
)
View Source
const (
	WebsocketMessageBufferSize = 10240
)

Variables

View Source
var (
	SchemeBuilder  runtime.SchemeBuilder
	Scheme         *runtime.Scheme
	Codecs         serializer.CodecFactory
	ParameterCodec runtime.ParameterCodec
)
View Source
var GetKubevirtClientFromClientConfig = func(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error) {
	config, err := cmdConfig.ClientConfig()
	if err != nil {
		return nil, err
	}
	return GetKubevirtClientFromRESTConfig(config)

}

this function is defined as a closure so iut could be overwritten by unit tests

Functions

func Copy added in v0.20.1

func Copy(dst *websocket.Conn, src *websocket.Conn) (int64, error)

func CopyFrom added in v0.20.1

func CopyFrom(dst io.Writer, src *websocket.Conn) (written int64, err error)

func CopyTo added in v0.20.1

func CopyTo(dst *websocket.Conn, src io.Reader) (written int64, err error)

func DefaultClientConfig

func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig

DefaultClientConfig creates a clientcmd.ClientConfig with the following hierarchy:

  1. Use the kubeconfig builder. The number of merges and overrides here gets a little crazy. Stay with me.

  2. Merge the kubeconfig itself. This is done with the following hierarchy rules:

  3. CommandLineLocation - this parsed from the command line, so it must be late bound. If you specify this, then no other kubeconfig files are merged. This file must exist.

  4. If $KUBECONFIG is set, then it is treated as a list of files that should be merged.

  5. HomeDirectoryLocation Empty filenames are ignored. Files with non-deserializable content produced errors. The first file to set a particular value or map key wins and the value or map key is never changed. This means that the first file to set CurrentContext will have its context preserved. It also means that if two files specify a "red-user", only values from the first file's red-user are used. Even non-conflicting entries from the second file's "red-user" are discarded.

  6. Determine the context to use based on the first hit in this chain

  7. command line argument - again, parsed from the command line, so it must be late bound

  8. CurrentContext from the merged kubeconfig file

  9. Empty is allowed at this stage

  10. Determine the cluster info and auth info to use. At this point, we may or may not have a context. They are built based on the first hit in this chain. (run it twice, once for auth, once for cluster)

  11. command line argument

  12. If context is present, then use the context value

  13. Empty is allowed

  14. Determine the actual cluster info to use. At this point, we may or may not have a cluster info. Build each piece of the cluster info based on the chain:

  15. command line argument

  16. If cluster info is present and a value for the attribute is present, use it.

  17. If you don't have a server location, bail.

  18. Auth info is build using the same rules as cluster info, EXCEPT that you can only have one authentication technique per auth info. The following conditions result in an error:

  19. If there are two conflicting techniques specified from the command line, fail.

  20. If the command line does not specify one, and the auth info has conflicting techniques, fail.

  21. If the command line specifies one and the auth info specifies another, honor the command line technique.

  22. Use default values and potentially prompt for auth information

    However, if it appears that we're running in a kubernetes cluster container environment, then run with the auth info kubernetes mounted for us. Specifically: The env vars KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT are set, and the file /var/run/secrets/kubernetes.io/serviceaccount/token exists and is not a directory.

Initially copied from https://github.com/kubernetes/kubernetes/blob/09f321c80bfc9bca63a5530b56d7a1a3ba80ba9b/pkg/kubectl/cmd/util/factory_client_access.go#L174

func Dial added in v0.20.1

func Dial(address string, tlsConfig *tls.Config) (*websocket.Conn, *http.Response, error)

func FlagSet added in v0.22.0

func FlagSet() *flag.FlagSet

func GetConfig deprecated

func GetConfig() (*restclient.Config, error)

Deprecated: Use GetKubevirtClientConfig instead

func GetKubevirtClientConfig

func GetKubevirtClientConfig() (*rest.Config, error)

func Init added in v0.20.1

func Init()

Init adds the default `kubeconfig` and `master` flags. It is not added by default to allow integration into the different controller generators which normally add these flags too.

func NewKubeVirtList

func NewKubeVirtList(kubevirts ...v1.KubeVirt) *v1.KubeVirtList

func NewMinimalClone added in v0.55.0

func NewMinimalClone(name string) *v1alpha12.VirtualMachineClone

func NewMinimalCloneList added in v0.55.0

func NewMinimalCloneList(clones ...v1alpha12.VirtualMachineClone) *v1alpha12.VirtualMachineCloneList

func NewMinimalCloneWithNS added in v0.55.0

func NewMinimalCloneWithNS(name, namespace string) *v1alpha12.VirtualMachineClone

func NewMinimalKubeVirt

func NewMinimalKubeVirt(name string) *v1.KubeVirt

func NewMinimalMigration

func NewMinimalMigration(name string) *v1.VirtualMachineInstanceMigration

func NewMinimalMigrationPolicy added in v0.49.0

func NewMinimalMigrationPolicy(name string) *v1alpha1.MigrationPolicy

func NewMinimalMigrationPolicyList added in v0.49.0

func NewMinimalMigrationPolicyList(policies ...v1alpha1.MigrationPolicy) *v1alpha1.MigrationPolicyList

func NewMinimalVM

func NewMinimalVM(name string) *v1.VirtualMachine

func NewMinimalVirtualMachineInstancePreset

func NewMinimalVirtualMachineInstancePreset(name string) *v1.VirtualMachineInstancePreset

func NewMinimalVirtualMachineInstanceReplicaSet

func NewMinimalVirtualMachineInstanceReplicaSet(name string) *v1.VirtualMachineInstanceReplicaSet

func NewUpgrader added in v0.20.1

func NewUpgrader() *websocket.Upgrader

func NewVMList

func NewVMList(vms ...v1.VirtualMachine) *v1.VirtualMachineList

func NewWebsocketStreamer added in v0.58.0

func NewWebsocketStreamer(conn *websocket.Conn, done chan struct{}) *wsStreamer

func RegisterRestConfigHook added in v0.46.0

func RegisterRestConfigHook(fn RestConfigHookFunc)

func RequestFromConfig

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

Types

type AsyncSubresourceError

type AsyncSubresourceError struct {
	StatusCode int
	// contains filtered or unexported fields
}

func (*AsyncSubresourceError) Error

func (a *AsyncSubresourceError) Error() string

func (*AsyncSubresourceError) GetStatusCode

func (a *AsyncSubresourceError) GetStatusCode() int

type ClusterProfiler added in v0.46.0

type ClusterProfiler struct {
	// contains filtered or unexported fields
}

func (*ClusterProfiler) Dump added in v0.46.0

Dump returns at most cpRequest.PageSize profiler results. To fetch results from all kubevirt pods Dump should be called with Continue fields set to Continue field value from the response to a previous request. This should be repeated until Continue or ComponentsResult field in ClusterProfilerResponse is empty.

func (*ClusterProfiler) Start added in v0.46.0

func (v *ClusterProfiler) Start() error

func (*ClusterProfiler) Stop added in v0.46.0

func (v *ClusterProfiler) Stop() error

type ExpandSpecInterface added in v0.58.1

type ExpandSpecInterface interface {
	ForVirtualMachine(vm *v1.VirtualMachine) (*v1.VirtualMachine, error)
}

type GuestfsInfo added in v0.44.1

type GuestfsInfo struct {
	Registry    string `json:"registry"`
	Tag         string `json:"tag"`
	Digest      string `json:"digest"`
	ImagePrefix string `json:"imagePrefix"`
	GsImage     string `json:"gsImage"`
}

type GuestfsVersion added in v0.44.1

type GuestfsVersion struct {
	// contains filtered or unexported fields
}

func (*GuestfsVersion) Get added in v0.44.1

func (v *GuestfsVersion) Get() (*GuestfsInfo, error)

type KubeVirtInterface

type KubeVirtInterface interface {
	Get(name string, options *metav1.GetOptions) (*v1.KubeVirt, error)
	List(opts *metav1.ListOptions) (*v1.KubeVirtList, error)
	Create(instance *v1.KubeVirt) (*v1.KubeVirt, error)
	Update(*v1.KubeVirt) (*v1.KubeVirt, error)
	Delete(name string, options *metav1.DeleteOptions) error
	Patch(name string, pt types.PatchType, data []byte, patchOptions *metav1.PatchOptions, subresources ...string) (result *v1.KubeVirt, err error)
	UpdateStatus(*v1.KubeVirt) (*v1.KubeVirt, error)
	PatchStatus(name string, pt types.PatchType, data []byte, patchOptions *metav1.PatchOptions) (result *v1.KubeVirt, err error)
}

type KubevirtClient

type KubevirtClient interface {
	VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface
	VirtualMachineInstanceMigration(namespace string) VirtualMachineInstanceMigrationInterface
	ReplicaSet(namespace string) ReplicaSetInterface
	VirtualMachinePool(namespace string) poolv1.VirtualMachinePoolInterface
	VirtualMachine(namespace string) VirtualMachineInterface
	KubeVirt(namespace string) KubeVirtInterface
	VirtualMachineInstancePreset(namespace string) VirtualMachineInstancePresetInterface
	VirtualMachineSnapshot(namespace string) vmsnapshotv1alpha1.VirtualMachineSnapshotInterface
	VirtualMachineSnapshotContent(namespace string) vmsnapshotv1alpha1.VirtualMachineSnapshotContentInterface
	VirtualMachineRestore(namespace string) vmsnapshotv1alpha1.VirtualMachineRestoreInterface
	VirtualMachineExport(namespace string) vmexportv1alpha1.VirtualMachineExportInterface
	VirtualMachineInstancetype(namespace string) instancetypev1beta1.VirtualMachineInstancetypeInterface
	VirtualMachineClusterInstancetype() instancetypev1beta1.VirtualMachineClusterInstancetypeInterface
	VirtualMachinePreference(namespace string) instancetypev1beta1.VirtualMachinePreferenceInterface
	VirtualMachineClusterPreference() instancetypev1beta1.VirtualMachineClusterPreferenceInterface
	MigrationPolicy() migrationsv1.MigrationPolicyInterface
	ExpandSpec(namespace string) ExpandSpecInterface
	ServerVersion() ServerVersionInterface
	VirtualMachineClone(namespace string) clonev1alpha1.VirtualMachineCloneInterface
	ClusterProfiler() *ClusterProfiler
	GuestfsVersion() *GuestfsVersion
	RestClient() *rest.RESTClient
	GeneratedKubeVirtClient() generatedclient.Interface
	CdiClient() cdiclient.Interface
	NetworkClient() networkclient.Interface
	ExtensionsClient() extclient.Interface
	SecClient() secv1.SecurityV1Interface
	RouteClient() routev1.RouteV1Interface
	DiscoveryClient() discovery.DiscoveryInterface
	PrometheusClient() promclient.Interface
	KubernetesSnapshotClient() k8ssnapshotclient.Interface
	DynamicClient() dynamic.Interface
	MigrationPolicyClient() *migrationsv1.MigrationsV1alpha1Client
	kubernetes.Interface
	Config() *rest.Config
	SetRestTimeout(timeout time.Duration) (KubevirtClient, error)
}

func GetInvalidKubevirtClientFromClientConfig

func GetInvalidKubevirtClientFromClientConfig(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error)

GetInvalidKubevirtClientFromClientConfig is an entry point for testing case where client should be invalid

func GetKubevirtClient

func GetKubevirtClient() (KubevirtClient, error)

func GetKubevirtClientFromFlags

func GetKubevirtClientFromFlags(master string, kubeconfig string) (KubevirtClient, error)

func GetKubevirtClientFromRESTConfig

func GetKubevirtClientFromRESTConfig(config *rest.Config) (KubevirtClient, error)

func GetKubevirtSubresourceClient

func GetKubevirtSubresourceClient() (KubevirtClient, error)

func GetKubevirtSubresourceClientFromFlags

func GetKubevirtSubresourceClientFromFlags(master string, kubeconfig string) (KubevirtClient, error)

func GetMockKubevirtClientFromClientConfig

func GetMockKubevirtClientFromClientConfig(cmdConfig clientcmd.ClientConfig) (KubevirtClient, error)

GetMockKubevirtClientFromClientConfig is an entry point for testing, could be used to override GetKubevirtClientFromClientConfig

type MockExpandSpecInterface added in v0.58.1

type MockExpandSpecInterface struct {
	// contains filtered or unexported fields
}

Mock of ExpandSpecInterface interface

func NewMockExpandSpecInterface added in v0.58.1

func NewMockExpandSpecInterface(ctrl *gomock.Controller) *MockExpandSpecInterface

func (*MockExpandSpecInterface) EXPECT added in v0.58.1

func (_m *MockExpandSpecInterface) EXPECT() *_MockExpandSpecInterfaceRecorder

func (*MockExpandSpecInterface) ForVirtualMachine added in v0.58.1

func (_m *MockExpandSpecInterface) ForVirtualMachine(vm *v120.VirtualMachine) (*v120.VirtualMachine, error)

type MockKubeVirtInterface

type MockKubeVirtInterface struct {
	// contains filtered or unexported fields
}

Mock of KubeVirtInterface interface

func NewMockKubeVirtInterface

func NewMockKubeVirtInterface(ctrl *gomock.Controller) *MockKubeVirtInterface

func (*MockKubeVirtInterface) Create

func (_m *MockKubeVirtInterface) Create(instance *v120.KubeVirt) (*v120.KubeVirt, error)

func (*MockKubeVirtInterface) Delete

func (_m *MockKubeVirtInterface) Delete(name string, options *v12.DeleteOptions) error

func (*MockKubeVirtInterface) EXPECT

func (_m *MockKubeVirtInterface) EXPECT() *_MockKubeVirtInterfaceRecorder

func (*MockKubeVirtInterface) Get

func (_m *MockKubeVirtInterface) Get(name string, options *v12.GetOptions) (*v120.KubeVirt, error)

func (*MockKubeVirtInterface) List

func (*MockKubeVirtInterface) Patch

func (_m *MockKubeVirtInterface) Patch(name string, pt types.PatchType, data []byte, patchOptions *v12.PatchOptions, subresources ...string) (*v120.KubeVirt, error)

func (*MockKubeVirtInterface) PatchStatus added in v0.33.0

func (_m *MockKubeVirtInterface) PatchStatus(name string, pt types.PatchType, data []byte, patchOptions *v12.PatchOptions) (*v120.KubeVirt, error)

func (*MockKubeVirtInterface) Update

func (_m *MockKubeVirtInterface) Update(_param0 *v120.KubeVirt) (*v120.KubeVirt, error)

func (*MockKubeVirtInterface) UpdateStatus added in v0.33.0

func (_m *MockKubeVirtInterface) UpdateStatus(_param0 *v120.KubeVirt) (*v120.KubeVirt, error)

type MockKubevirtClient

type MockKubevirtClient struct {
	// contains filtered or unexported fields
}

Mock of KubevirtClient interface

var MockKubevirtClientInstance *MockKubevirtClient

MockKubevirtClientInstance is a reference to the kubevirt client that could be manipulated by the test code

func NewMockKubevirtClient

func NewMockKubevirtClient(ctrl *gomock.Controller) *MockKubevirtClient

func (*MockKubevirtClient) AdmissionregistrationV1 added in v0.26.0

func (_m *MockKubevirtClient) AdmissionregistrationV1() v13.AdmissionregistrationV1Interface

func (*MockKubevirtClient) AdmissionregistrationV1alpha1

func (_m *MockKubevirtClient) AdmissionregistrationV1alpha1() v1alpha1.AdmissionregistrationV1alpha1Interface

func (*MockKubevirtClient) AdmissionregistrationV1beta1

func (_m *MockKubevirtClient) AdmissionregistrationV1beta1() v1beta1.AdmissionregistrationV1beta1Interface

func (*MockKubevirtClient) AppsV1

func (_m *MockKubevirtClient) AppsV1() v14.AppsV1Interface

func (*MockKubevirtClient) AppsV1beta1

func (*MockKubevirtClient) AppsV1beta2

func (*MockKubevirtClient) AuthenticationV1

func (_m *MockKubevirtClient) AuthenticationV1() v15.AuthenticationV1Interface

func (*MockKubevirtClient) AuthenticationV1alpha1 added in v1.0.0

func (_m *MockKubevirtClient) AuthenticationV1alpha1() v1alpha11.AuthenticationV1alpha1Interface

func (*MockKubevirtClient) AuthenticationV1beta1

func (_m *MockKubevirtClient) AuthenticationV1beta1() v1beta11.AuthenticationV1beta1Interface

func (*MockKubevirtClient) AuthorizationV1

func (_m *MockKubevirtClient) AuthorizationV1() v16.AuthorizationV1Interface

func (*MockKubevirtClient) AuthorizationV1beta1

func (_m *MockKubevirtClient) AuthorizationV1beta1() v1beta12.AuthorizationV1beta1Interface

func (*MockKubevirtClient) AutoscalingV1

func (_m *MockKubevirtClient) AutoscalingV1() v17.AutoscalingV1Interface

func (*MockKubevirtClient) AutoscalingV2 added in v0.50.0

func (_m *MockKubevirtClient) AutoscalingV2() v2.AutoscalingV2Interface

func (*MockKubevirtClient) AutoscalingV2beta1

func (_m *MockKubevirtClient) AutoscalingV2beta1() v2beta1.AutoscalingV2beta1Interface

func (*MockKubevirtClient) AutoscalingV2beta2

func (_m *MockKubevirtClient) AutoscalingV2beta2() v2beta2.AutoscalingV2beta2Interface

func (*MockKubevirtClient) BatchV1

func (_m *MockKubevirtClient) BatchV1() v18.BatchV1Interface

func (*MockKubevirtClient) BatchV1beta1

func (*MockKubevirtClient) CdiClient

func (_m *MockKubevirtClient) CdiClient() versioned.Interface

func (*MockKubevirtClient) CertificatesV1 added in v0.38.1

func (_m *MockKubevirtClient) CertificatesV1() v19.CertificatesV1Interface

func (*MockKubevirtClient) CertificatesV1beta1

func (_m *MockKubevirtClient) CertificatesV1beta1() v1beta14.CertificatesV1beta1Interface

func (*MockKubevirtClient) ClusterProfiler added in v0.46.0

func (_m *MockKubevirtClient) ClusterProfiler() *ClusterProfiler

func (*MockKubevirtClient) Config

func (_m *MockKubevirtClient) Config() *rest.Config

func (*MockKubevirtClient) CoordinationV1 added in v0.26.0

func (_m *MockKubevirtClient) CoordinationV1() v110.CoordinationV1Interface

func (*MockKubevirtClient) CoordinationV1beta1

func (_m *MockKubevirtClient) CoordinationV1beta1() v1beta15.CoordinationV1beta1Interface

func (*MockKubevirtClient) CoreV1

func (*MockKubevirtClient) Discovery

func (*MockKubevirtClient) DiscoveryClient

func (_m *MockKubevirtClient) DiscoveryClient() discovery.DiscoveryInterface

func (*MockKubevirtClient) DiscoveryV1 added in v0.49.1

func (_m *MockKubevirtClient) DiscoveryV1() v112.DiscoveryV1Interface

func (*MockKubevirtClient) DiscoveryV1beta1 added in v0.38.1

func (_m *MockKubevirtClient) DiscoveryV1beta1() v1beta16.DiscoveryV1beta1Interface

func (*MockKubevirtClient) DynamicClient added in v0.38.1

func (_m *MockKubevirtClient) DynamicClient() dynamic.Interface

func (*MockKubevirtClient) EXPECT

func (_m *MockKubevirtClient) EXPECT() *_MockKubevirtClientRecorder

func (*MockKubevirtClient) EventsV1 added in v0.38.1

func (_m *MockKubevirtClient) EventsV1() v113.EventsV1Interface

func (*MockKubevirtClient) EventsV1beta1

func (*MockKubevirtClient) ExpandSpec added in v0.57.0

func (_m *MockKubevirtClient) ExpandSpec(namespace string) ExpandSpecInterface

func (*MockKubevirtClient) ExtensionsClient

func (_m *MockKubevirtClient) ExtensionsClient() clientset.Interface

func (*MockKubevirtClient) ExtensionsV1beta1

func (_m *MockKubevirtClient) ExtensionsV1beta1() v1beta18.ExtensionsV1beta1Interface

func (*MockKubevirtClient) FlowcontrolV1alpha1 added in v0.38.1

func (_m *MockKubevirtClient) FlowcontrolV1alpha1() v1alpha12.FlowcontrolV1alpha1Interface

func (*MockKubevirtClient) FlowcontrolV1beta1 added in v0.38.1

func (_m *MockKubevirtClient) FlowcontrolV1beta1() v1beta19.FlowcontrolV1beta1Interface

func (*MockKubevirtClient) FlowcontrolV1beta2 added in v0.50.0

func (_m *MockKubevirtClient) FlowcontrolV1beta2() v1beta20.FlowcontrolV1beta2Interface

func (*MockKubevirtClient) FlowcontrolV1beta3 added in v1.0.0

func (_m *MockKubevirtClient) FlowcontrolV1beta3() v1beta3.FlowcontrolV1beta3Interface

func (*MockKubevirtClient) GeneratedKubeVirtClient added in v0.31.0

func (_m *MockKubevirtClient) GeneratedKubeVirtClient() versioned1.Interface

func (*MockKubevirtClient) GuestfsVersion added in v0.44.1

func (_m *MockKubevirtClient) GuestfsVersion() *GuestfsVersion

func (*MockKubevirtClient) InternalV1alpha1 added in v0.38.1

func (*MockKubevirtClient) KubeVirt

func (_m *MockKubevirtClient) KubeVirt(namespace string) KubeVirtInterface

func (*MockKubevirtClient) KubernetesSnapshotClient added in v0.31.0

func (_m *MockKubevirtClient) KubernetesSnapshotClient() versioned0.Interface

func (*MockKubevirtClient) MigrationPolicy added in v0.49.0

func (*MockKubevirtClient) MigrationPolicyClient added in v0.49.0

func (_m *MockKubevirtClient) MigrationPolicyClient() *v1alpha111.MigrationsV1alpha1Client

func (*MockKubevirtClient) NetworkClient

func (_m *MockKubevirtClient) NetworkClient() versioned2.Interface

func (*MockKubevirtClient) NetworkingV1

func (_m *MockKubevirtClient) NetworkingV1() v114.NetworkingV1Interface

func (*MockKubevirtClient) NetworkingV1alpha1 added in v1.0.0

func (_m *MockKubevirtClient) NetworkingV1alpha1() v1alpha13.NetworkingV1alpha1Interface

func (*MockKubevirtClient) NetworkingV1beta1 added in v0.26.0

func (*MockKubevirtClient) NodeV1 added in v0.38.1

func (*MockKubevirtClient) NodeV1alpha1 added in v0.26.0

func (*MockKubevirtClient) NodeV1beta1 added in v0.26.0

func (*MockKubevirtClient) PolicyV1 added in v0.49.1

func (_m *MockKubevirtClient) PolicyV1() v116.PolicyV1Interface

func (*MockKubevirtClient) PolicyV1beta1

func (*MockKubevirtClient) PrometheusClient added in v0.20.6

func (_m *MockKubevirtClient) PrometheusClient() versioned3.Interface

func (*MockKubevirtClient) RbacV1

func (*MockKubevirtClient) RbacV1alpha1

func (*MockKubevirtClient) RbacV1beta1

func (*MockKubevirtClient) ReplicaSet

func (_m *MockKubevirtClient) ReplicaSet(namespace string) ReplicaSetInterface

func (*MockKubevirtClient) ResourceV1alpha1 added in v1.0.0

func (*MockKubevirtClient) RestClient

func (_m *MockKubevirtClient) RestClient() *rest.RESTClient

func (*MockKubevirtClient) RouteClient added in v0.55.0

func (_m *MockKubevirtClient) RouteClient() v1.RouteV1Interface

func (*MockKubevirtClient) SchedulingV1 added in v0.26.0

func (_m *MockKubevirtClient) SchedulingV1() v118.SchedulingV1Interface

func (*MockKubevirtClient) SchedulingV1alpha1

func (_m *MockKubevirtClient) SchedulingV1alpha1() v1alpha17.SchedulingV1alpha1Interface

func (*MockKubevirtClient) SchedulingV1beta1

func (*MockKubevirtClient) SecClient

func (_m *MockKubevirtClient) SecClient() v10.SecurityV1Interface

func (*MockKubevirtClient) ServerVersion

func (_m *MockKubevirtClient) ServerVersion() ServerVersionInterface

func (*MockKubevirtClient) SetRestTimeout added in v1.2.0

func (_m *MockKubevirtClient) SetRestTimeout(timeout time.Duration) (KubevirtClient, error)

func (*MockKubevirtClient) StorageV1

func (_m *MockKubevirtClient) StorageV1() v119.StorageV1Interface

func (*MockKubevirtClient) StorageV1alpha1

func (*MockKubevirtClient) StorageV1beta1

func (*MockKubevirtClient) VirtualMachine

func (_m *MockKubevirtClient) VirtualMachine(namespace string) VirtualMachineInterface

func (*MockKubevirtClient) VirtualMachineClone added in v0.55.0

func (_m *MockKubevirtClient) VirtualMachineClone(namespace string) v1alpha19.VirtualMachineCloneInterface

func (*MockKubevirtClient) VirtualMachineClusterInstancetype added in v0.56.0

func (_m *MockKubevirtClient) VirtualMachineClusterInstancetype() v1beta116.VirtualMachineClusterInstancetypeInterface

func (*MockKubevirtClient) VirtualMachineClusterPreference added in v0.54.0

func (_m *MockKubevirtClient) VirtualMachineClusterPreference() v1beta116.VirtualMachineClusterPreferenceInterface

func (*MockKubevirtClient) VirtualMachineExport added in v0.55.0

func (_m *MockKubevirtClient) VirtualMachineExport(namespace string) v1alpha110.VirtualMachineExportInterface

func (*MockKubevirtClient) VirtualMachineInstance

func (_m *MockKubevirtClient) VirtualMachineInstance(namespace string) VirtualMachineInstanceInterface

func (*MockKubevirtClient) VirtualMachineInstanceMigration

func (_m *MockKubevirtClient) VirtualMachineInstanceMigration(namespace string) VirtualMachineInstanceMigrationInterface

func (*MockKubevirtClient) VirtualMachineInstancePreset

func (_m *MockKubevirtClient) VirtualMachineInstancePreset(namespace string) VirtualMachineInstancePresetInterface

func (*MockKubevirtClient) VirtualMachineInstancetype added in v0.56.0

func (_m *MockKubevirtClient) VirtualMachineInstancetype(namespace string) v1beta116.VirtualMachineInstancetypeInterface

func (*MockKubevirtClient) VirtualMachinePool added in v0.49.0

func (_m *MockKubevirtClient) VirtualMachinePool(namespace string) v1alpha112.VirtualMachinePoolInterface

func (*MockKubevirtClient) VirtualMachinePreference added in v0.54.0

func (_m *MockKubevirtClient) VirtualMachinePreference(namespace string) v1beta116.VirtualMachinePreferenceInterface

func (*MockKubevirtClient) VirtualMachineRestore added in v0.34.0

func (_m *MockKubevirtClient) VirtualMachineRestore(namespace string) v1alpha113.VirtualMachineRestoreInterface

func (*MockKubevirtClient) VirtualMachineSnapshot added in v0.31.0

func (_m *MockKubevirtClient) VirtualMachineSnapshot(namespace string) v1alpha113.VirtualMachineSnapshotInterface

func (*MockKubevirtClient) VirtualMachineSnapshotContent added in v0.31.0

func (_m *MockKubevirtClient) VirtualMachineSnapshotContent(namespace string) v1alpha113.VirtualMachineSnapshotContentInterface

type MockReplicaSetInterface

type MockReplicaSetInterface struct {
	// contains filtered or unexported fields
}

Mock of ReplicaSetInterface interface

func NewMockReplicaSetInterface

func NewMockReplicaSetInterface(ctrl *gomock.Controller) *MockReplicaSetInterface

func (*MockReplicaSetInterface) Create

func (*MockReplicaSetInterface) Delete

func (_m *MockReplicaSetInterface) Delete(name string, options *v12.DeleteOptions) error

func (*MockReplicaSetInterface) EXPECT

func (_m *MockReplicaSetInterface) EXPECT() *_MockReplicaSetInterfaceRecorder

func (*MockReplicaSetInterface) Get

func (*MockReplicaSetInterface) GetScale

func (_m *MockReplicaSetInterface) GetScale(replicaSetName string, options v12.GetOptions) (*v11.Scale, error)

func (*MockReplicaSetInterface) List

func (*MockReplicaSetInterface) Patch

func (_m *MockReplicaSetInterface) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v120.VirtualMachineInstanceReplicaSet, error)

func (*MockReplicaSetInterface) PatchStatus added in v0.33.0

func (*MockReplicaSetInterface) Update

func (*MockReplicaSetInterface) UpdateScale

func (_m *MockReplicaSetInterface) UpdateScale(replicaSetName string, scale *v11.Scale) (*v11.Scale, error)

func (*MockReplicaSetInterface) UpdateStatus added in v0.33.0

type MockServerVersionInterface added in v0.52.0

type MockServerVersionInterface struct {
	// contains filtered or unexported fields
}

Mock of ServerVersionInterface interface

func NewMockServerVersionInterface added in v0.52.0

func NewMockServerVersionInterface(ctrl *gomock.Controller) *MockServerVersionInterface

func (*MockServerVersionInterface) EXPECT added in v0.52.0

func (_m *MockServerVersionInterface) EXPECT() *_MockServerVersionInterfaceRecorder

func (*MockServerVersionInterface) Get added in v0.52.0

type MockStreamInterface

type MockStreamInterface struct {
	// contains filtered or unexported fields
}

Mock of StreamInterface interface

func NewMockStreamInterface

func NewMockStreamInterface(ctrl *gomock.Controller) *MockStreamInterface

func (*MockStreamInterface) AsConn added in v0.44.1

func (_m *MockStreamInterface) AsConn() net.Conn

func (*MockStreamInterface) EXPECT

func (_m *MockStreamInterface) EXPECT() *_MockStreamInterfaceRecorder

func (*MockStreamInterface) Stream

func (_m *MockStreamInterface) Stream(options StreamOptions) error

type MockVirtualMachineInstanceInterface

type MockVirtualMachineInstanceInterface struct {
	// contains filtered or unexported fields
}

Mock of VirtualMachineInstanceInterface interface

func NewMockVirtualMachineInstanceInterface

func NewMockVirtualMachineInstanceInterface(ctrl *gomock.Controller) *MockVirtualMachineInstanceInterface

func (*MockVirtualMachineInstanceInterface) AddVolume added in v0.36.0

func (_m *MockVirtualMachineInstanceInterface) AddVolume(ctx context.Context, name string, addVolumeOptions *v120.AddVolumeOptions) error

func (*MockVirtualMachineInstanceInterface) Create

func (*MockVirtualMachineInstanceInterface) Delete

func (*MockVirtualMachineInstanceInterface) EXPECT

func (_m *MockVirtualMachineInstanceInterface) EXPECT() *_MockVirtualMachineInstanceInterfaceRecorder

func (*MockVirtualMachineInstanceInterface) FilesystemList added in v0.28.0

func (*MockVirtualMachineInstanceInterface) Freeze added in v0.44.1

func (_m *MockVirtualMachineInstanceInterface) Freeze(ctx context.Context, name string, unfreezeTimeout time.Duration) error

func (*MockVirtualMachineInstanceInterface) Get

func (*MockVirtualMachineInstanceInterface) GuestOsInfo added in v0.27.0

func (*MockVirtualMachineInstanceInterface) List

func (*MockVirtualMachineInstanceInterface) Patch

func (_m *MockVirtualMachineInstanceInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *v12.PatchOptions, subresources ...string) (*v120.VirtualMachineInstance, error)

func (*MockVirtualMachineInstanceInterface) Pause added in v0.24.0

func (_m *MockVirtualMachineInstanceInterface) Pause(ctx context.Context, name string, pauseOptions *v120.PauseOptions) error

func (*MockVirtualMachineInstanceInterface) PortForward added in v0.44.1

func (_m *MockVirtualMachineInstanceInterface) PortForward(name string, port int, protocol string) (StreamInterface, error)

func (*MockVirtualMachineInstanceInterface) RemoveVolume added in v0.36.0

func (_m *MockVirtualMachineInstanceInterface) RemoveVolume(ctx context.Context, name string, removeVolumeOptions *v120.RemoveVolumeOptions) error

func (*MockVirtualMachineInstanceInterface) SEVFetchCertChain added in v1.1.0

func (_m *MockVirtualMachineInstanceInterface) SEVFetchCertChain(name string) (v120.SEVPlatformInfo, error)

func (*MockVirtualMachineInstanceInterface) SEVInjectLaunchSecret added in v1.1.0

func (_m *MockVirtualMachineInstanceInterface) SEVInjectLaunchSecret(name string, sevSecretOptions *v120.SEVSecretOptions) error

func (*MockVirtualMachineInstanceInterface) SEVQueryLaunchMeasurement added in v1.1.0

func (_m *MockVirtualMachineInstanceInterface) SEVQueryLaunchMeasurement(name string) (v120.SEVMeasurementInfo, error)

func (*MockVirtualMachineInstanceInterface) SEVSetupSession added in v1.1.0

func (_m *MockVirtualMachineInstanceInterface) SEVSetupSession(name string, sevSessionOptions *v120.SEVSessionOptions) error

func (*MockVirtualMachineInstanceInterface) Screenshot added in v0.58.0

func (_m *MockVirtualMachineInstanceInterface) Screenshot(ctx context.Context, name string, options *v120.ScreenshotOptions) ([]byte, error)

func (*MockVirtualMachineInstanceInterface) SerialConsole

func (*MockVirtualMachineInstanceInterface) SoftReboot added in v0.48.0

func (*MockVirtualMachineInstanceInterface) USBRedir added in v0.44.1

func (*MockVirtualMachineInstanceInterface) Unfreeze added in v0.44.1

func (*MockVirtualMachineInstanceInterface) Unpause added in v0.24.0

func (_m *MockVirtualMachineInstanceInterface) Unpause(ctx context.Context, name string, unpauseOptions *v120.UnpauseOptions) error

func (*MockVirtualMachineInstanceInterface) Update

func (*MockVirtualMachineInstanceInterface) UserList added in v0.28.0

func (*MockVirtualMachineInstanceInterface) VNC

func (*MockVirtualMachineInstanceInterface) VSOCK added in v0.59.0

func (*MockVirtualMachineInstanceInterface) Watch added in v0.41.4

type MockVirtualMachineInstanceMigrationInterface

type MockVirtualMachineInstanceMigrationInterface struct {
	// contains filtered or unexported fields
}

Mock of VirtualMachineInstanceMigrationInterface interface

func (*MockVirtualMachineInstanceMigrationInterface) Create

func (*MockVirtualMachineInstanceMigrationInterface) Delete

func (*MockVirtualMachineInstanceMigrationInterface) EXPECT

func (_m *MockVirtualMachineInstanceMigrationInterface) EXPECT() *_MockVirtualMachineInstanceMigrationInterfaceRecorder

func (*MockVirtualMachineInstanceMigrationInterface) Get

func (*MockVirtualMachineInstanceMigrationInterface) List

func (*MockVirtualMachineInstanceMigrationInterface) Patch

func (*MockVirtualMachineInstanceMigrationInterface) PatchStatus added in v0.33.0

func (*MockVirtualMachineInstanceMigrationInterface) Update

func (*MockVirtualMachineInstanceMigrationInterface) UpdateStatus added in v0.33.0

type MockVirtualMachineInstancePresetInterface

type MockVirtualMachineInstancePresetInterface struct {
	// contains filtered or unexported fields
}

Mock of VirtualMachineInstancePresetInterface interface

func NewMockVirtualMachineInstancePresetInterface

func NewMockVirtualMachineInstancePresetInterface(ctrl *gomock.Controller) *MockVirtualMachineInstancePresetInterface

func (*MockVirtualMachineInstancePresetInterface) Create

func (*MockVirtualMachineInstancePresetInterface) Delete

func (*MockVirtualMachineInstancePresetInterface) EXPECT

func (_m *MockVirtualMachineInstancePresetInterface) EXPECT() *_MockVirtualMachineInstancePresetInterfaceRecorder

func (*MockVirtualMachineInstancePresetInterface) Get

func (*MockVirtualMachineInstancePresetInterface) List

func (*MockVirtualMachineInstancePresetInterface) Patch

func (*MockVirtualMachineInstancePresetInterface) Update

type MockVirtualMachineInterface

type MockVirtualMachineInterface struct {
	// contains filtered or unexported fields
}

Mock of VirtualMachineInterface interface

func NewMockVirtualMachineInterface

func NewMockVirtualMachineInterface(ctrl *gomock.Controller) *MockVirtualMachineInterface

func (*MockVirtualMachineInterface) AddVolume added in v0.36.0

func (_m *MockVirtualMachineInterface) AddVolume(ctx context.Context, name string, addVolumeOptions *v120.AddVolumeOptions) error

func (*MockVirtualMachineInterface) Create

func (*MockVirtualMachineInterface) Delete

func (_m *MockVirtualMachineInterface) Delete(ctx context.Context, name string, options *v12.DeleteOptions) error

func (*MockVirtualMachineInterface) EXPECT

func (_m *MockVirtualMachineInterface) EXPECT() *_MockVirtualMachineInterfaceRecorder

func (*MockVirtualMachineInterface) ForceRestart added in v0.25.0

func (_m *MockVirtualMachineInterface) ForceRestart(ctx context.Context, name string, restartOptions *v120.RestartOptions) error

func (*MockVirtualMachineInterface) ForceStop added in v0.41.4

func (_m *MockVirtualMachineInterface) ForceStop(ctx context.Context, name string, stopOptions *v120.StopOptions) error

func (*MockVirtualMachineInterface) Get

func (*MockVirtualMachineInterface) GetWithExpandedSpec added in v0.57.0

func (_m *MockVirtualMachineInterface) GetWithExpandedSpec(ctx context.Context, name string) (*v120.VirtualMachine, error)

func (*MockVirtualMachineInterface) List

func (*MockVirtualMachineInterface) MemoryDump added in v0.54.0

func (_m *MockVirtualMachineInterface) MemoryDump(ctx context.Context, name string, memoryDumpRequest *v120.VirtualMachineMemoryDumpRequest) error

func (*MockVirtualMachineInterface) Migrate added in v0.21.0

func (_m *MockVirtualMachineInterface) Migrate(ctx context.Context, name string, migrateOptions *v120.MigrateOptions) error

func (*MockVirtualMachineInterface) Patch

func (_m *MockVirtualMachineInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *v12.PatchOptions, subresources ...string) (*v120.VirtualMachine, error)

func (*MockVirtualMachineInterface) PatchStatus added in v0.33.0

func (_m *MockVirtualMachineInterface) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *v12.PatchOptions) (*v120.VirtualMachine, error)

func (*MockVirtualMachineInterface) PortForward added in v0.44.1

func (_m *MockVirtualMachineInterface) PortForward(name string, port int, protocol string) (StreamInterface, error)

func (*MockVirtualMachineInterface) RemoveMemoryDump added in v0.54.0

func (_m *MockVirtualMachineInterface) RemoveMemoryDump(ctx context.Context, name string) error

func (*MockVirtualMachineInterface) RemoveVolume added in v0.36.0

func (_m *MockVirtualMachineInterface) RemoveVolume(ctx context.Context, name string, removeVolumeOptions *v120.RemoveVolumeOptions) error

func (*MockVirtualMachineInterface) Restart

func (_m *MockVirtualMachineInterface) Restart(ctx context.Context, name string, restartOptions *v120.RestartOptions) error

func (*MockVirtualMachineInterface) Start

func (_m *MockVirtualMachineInterface) Start(ctx context.Context, name string, startOptions *v120.StartOptions) error

func (*MockVirtualMachineInterface) Stop

func (_m *MockVirtualMachineInterface) Stop(ctx context.Context, name string, stopOptions *v120.StopOptions) error

func (*MockVirtualMachineInterface) Update

func (*MockVirtualMachineInterface) UpdateStatus added in v0.33.0

type RestConfigHookFunc added in v0.46.0

type RestConfigHookFunc func(*rest.Config)

type RoundTripCallback

type RoundTripCallback func(conn *websocket.Conn, resp *http.Response, err error) error

type SerialConsoleOptions added in v0.26.1

type SerialConsoleOptions struct {
	ConnectionTimeout time.Duration
}

type ServerVersion

type ServerVersion struct {
	// contains filtered or unexported fields
}

func (*ServerVersion) Get

func (v *ServerVersion) Get() (*version.Info, error)

type ServerVersionInterface added in v0.52.0

type ServerVersionInterface interface {
	Get() (*version.Info, error)
}

type StreamInterface

type StreamInterface interface {
	Stream(options StreamOptions) error
	AsConn() net.Conn
}

type StreamOptions

type StreamOptions struct {
	In  io.Reader
	Out io.Writer
}

type VirtHandlerClient

type VirtHandlerClient interface {
	ForNode(nodeName string) VirtHandlerConn
	Port(port int) VirtHandlerClient
	Namespace(namespace string) VirtHandlerClient
}

func NewVirtHandlerClient

func NewVirtHandlerClient(virtCli KubevirtClient, httpCli *http.Client) VirtHandlerClient

type VirtHandlerConn

type VirtHandlerConn interface {
	ConnectionDetails() (ip string, port int, err error)
	ConsoleURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	USBRedirURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	VNCURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	VSOCKURI(vmi *virtv1.VirtualMachineInstance, port string, tls string) (string, error)
	PauseURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	UnpauseURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	FreezeURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	UnfreezeURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	SoftRebootURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	SEVFetchCertChainURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	SEVQueryLaunchMeasurementURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	SEVInjectLaunchSecretURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	Pod() (pod *v1.Pod, err error)
	Put(url string, body io.ReadCloser) error
	Get(url string) (string, error)
	GuestInfoURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	UserListURI(vmi *virtv1.VirtualMachineInstance) (string, error)
	FilesystemListURI(vmi *virtv1.VirtualMachineInstance) (string, error)
}

type VirtualMachineInstanceInterface

type VirtualMachineInstanceInterface interface {
	Get(ctx context.Context, name string, options *metav1.GetOptions) (*v1.VirtualMachineInstance, error)
	List(ctx context.Context, opts *metav1.ListOptions) (*v1.VirtualMachineInstanceList, error)
	Create(ctx context.Context, instance *v1.VirtualMachineInstance) (*v1.VirtualMachineInstance, error)
	Update(ctx context.Context, instance *v1.VirtualMachineInstance) (*v1.VirtualMachineInstance, error)
	Delete(ctx context.Context, name string, options *metav1.DeleteOptions) error
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *metav1.PatchOptions, subresources ...string) (result *v1.VirtualMachineInstance, err error)
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
	SerialConsole(name string, options *SerialConsoleOptions) (StreamInterface, error)
	USBRedir(vmiName string) (StreamInterface, error)
	VNC(name string) (StreamInterface, error)
	Screenshot(ctx context.Context, name string, options *v1.ScreenshotOptions) ([]byte, error)
	PortForward(name string, port int, protocol string) (StreamInterface, error)
	Pause(ctx context.Context, name string, pauseOptions *v1.PauseOptions) error
	Unpause(ctx context.Context, name string, unpauseOptions *v1.UnpauseOptions) error
	Freeze(ctx context.Context, name string, unfreezeTimeout time.Duration) error
	Unfreeze(ctx context.Context, name string) error
	SoftReboot(ctx context.Context, name string) error
	GuestOsInfo(ctx context.Context, name string) (v1.VirtualMachineInstanceGuestAgentInfo, error)
	UserList(ctx context.Context, name string) (v1.VirtualMachineInstanceGuestOSUserList, error)
	FilesystemList(ctx context.Context, name string) (v1.VirtualMachineInstanceFileSystemList, error)
	AddVolume(ctx context.Context, name string, addVolumeOptions *v1.AddVolumeOptions) error
	RemoveVolume(ctx context.Context, name string, removeVolumeOptions *v1.RemoveVolumeOptions) error
	VSOCK(name string, options *v1.VSOCKOptions) (StreamInterface, error)
	SEVFetchCertChain(name string) (v1.SEVPlatformInfo, error)
	SEVQueryLaunchMeasurement(name string) (v1.SEVMeasurementInfo, error)
	SEVSetupSession(name string, sevSessionOptions *v1.SEVSessionOptions) error
	SEVInjectLaunchSecret(name string, sevSecretOptions *v1.SEVSecretOptions) error
}

type VirtualMachineInterface

type VirtualMachineInterface interface {
	Get(ctx context.Context, name string, options *metav1.GetOptions) (*v1.VirtualMachine, error)
	GetWithExpandedSpec(ctx context.Context, name string) (*v1.VirtualMachine, error)
	List(ctx context.Context, opts *metav1.ListOptions) (*v1.VirtualMachineList, error)
	Create(ctx context.Context, vm *v1.VirtualMachine) (*v1.VirtualMachine, error)
	Update(ctx context.Context, vm *v1.VirtualMachine) (*v1.VirtualMachine, error)
	Delete(ctx context.Context, name string, options *metav1.DeleteOptions) error
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *metav1.PatchOptions, subresources ...string) (result *v1.VirtualMachine, err error)
	UpdateStatus(ctx context.Context, vm *v1.VirtualMachine) (*v1.VirtualMachine, error)
	PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, patchOptions *metav1.PatchOptions) (result *v1.VirtualMachine, err error)
	Restart(ctx context.Context, name string, restartOptions *v1.RestartOptions) error
	ForceRestart(ctx context.Context, name string, restartOptions *v1.RestartOptions) error
	Start(ctx context.Context, name string, startOptions *v1.StartOptions) error
	Stop(ctx context.Context, name string, stopOptions *v1.StopOptions) error
	ForceStop(ctx context.Context, name string, stopOptions *v1.StopOptions) error
	Migrate(ctx context.Context, name string, migrateOptions *v1.MigrateOptions) error
	AddVolume(ctx context.Context, name string, addVolumeOptions *v1.AddVolumeOptions) error
	RemoveVolume(ctx context.Context, name string, removeVolumeOptions *v1.RemoveVolumeOptions) error
	PortForward(name string, port int, protocol string) (StreamInterface, error)
	MemoryDump(ctx context.Context, name string, memoryDumpRequest *v1.VirtualMachineMemoryDumpRequest) error
	RemoveMemoryDump(ctx context.Context, name string) error
}

VirtualMachineInterface provides convenience methods to work with virtual machines inside the cluster

type WebsocketRoundTripper

type WebsocketRoundTripper struct {
	Dialer *websocket.Dialer
	Do     RoundTripCallback
}

func (*WebsocketRoundTripper) RoundTrip

func (d *WebsocketRoundTripper) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL