kubevirt

package
v0.0.0-...-3871800 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package kubevirt contains the cloud kubevirt specific implementations to manage machines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKubevirtPlugin

func NewKubevirtPlugin() driver.Driver

NewKubevirtPlugin returns a new Kubevirt p

Types

type MachinePlugin

type MachinePlugin struct {
	SPI PluginSPI
}

MachinePlugin implements the cmi.MachineServer It also implements the pluginSPI interface

func (*MachinePlugin) CreateMachine

CreateMachine handles a machine creation request REQUIRED METHOD

REQUEST PARAMETERS (driver.CreateMachineRequest) Machine *v1alpha1.Machine Machine object from whom VM is to be created MachineClass *v1alpha1.MachineClass MachineClass backing the machine object Secret *corev1.Secret Kubernetes secret that contains any sensitive data/credentials

RESPONSE PARAMETERS (driver.CreateMachineResponse) ProviderID string Unique identification of the VM at the cloud kubevirt. This could be the same/different from req.MachineName.

ProviderID typically matches with the node.Spec.ProviderID on the node object.
Eg: gce://project-name/region/vm-ProviderID

NodeName string Returns the name of the node-object that the VM register's with Kubernetes.

This could be different from req.MachineName as well

LastKnownState string (Optional) Last known state of VM during the current operation.

Could be helpful to continue operations in future requests.

OPTIONAL IMPLEMENTATION LOGIC It is optionally expected by the safety controller to use an identification mechanisms to map the VM Created by a providerSpec. These could be done using tag(s)/resource-groups etc. This logic is used by safety controller to delete orphan VMs which are not backed by any machine CRD

func (*MachinePlugin) DeleteMachine

DeleteMachine handles a machine deletion request

REQUEST PARAMETERS (driver.DeleteMachineRequest) Machine *v1alpha1.Machine Machine object from whom VM is to be deleted MachineClass *v1alpha1.MachineClass MachineClass backing the machine object Secret *corev1.Secret Kubernetes secret that contains any sensitive data/credentials

RESPONSE PARAMETERS (driver.DeleteMachineResponse) LastKnownState bytes(blob) (Optional) Last known state of VM during the current operation.

Could be helpful to continue operations in future requests.

func (*MachinePlugin) GetMachineStatus

GetMachineStatus handles a machine get status request OPTIONAL METHOD

REQUEST PARAMETERS (driver.GetMachineStatusRequest) Machine *v1alpha1.Machine Machine object from whom VM status needs to be returned MachineClass *v1alpha1.MachineClass MachineClass backing the machine object Secret *corev1.Secret Kubernetes secret that contains any sensitive data/credentials

RESPONSE PARAMETERS (driver.GetMachineStatueResponse) ProviderID string Unique identification of the VM at the cloud kubevirt. This could be the same/different from req.MachineName.

ProviderID typically matches with the node.Spec.ProviderID on the node object.
Eg: gce://project-name/region/vm-ProviderID

NodeName string Returns the name of the node-object that the VM register's with Kubernetes.

This could be different from req.MachineName as well

The request should return a NOT_FOUND (5) status errors code if the machine is not existing

func (*MachinePlugin) GetVolumeIDs

GetVolumeIDs returns a list of Volume IDs for all PV Specs for whom an kubevirt volume was found

REQUEST PARAMETERS (driver.GetVolumeIDsRequest) PVSpecList []*corev1.PersistentVolumeSpec PVSpecsList is a list PV specs for whom volume-IDs are required.

RESPONSE PARAMETERS (driver.GetVolumeIDsResponse) VolumeIDs []string VolumeIDs is a repeated list of VolumeIDs.

func (*MachinePlugin) ListMachines

ListMachines lists all the machines possibilly created by a providerSpec Identifying machines created by a given providerSpec depends on the OPTIONAL IMPLEMENTATION LOGIC you have used to identify machines created by a providerSpec. It could be tags/resource-groups etc OPTIONAL METHOD

REQUEST PARAMETERS (driver.ListMachinesRequest) MachineClass *v1alpha1.MachineClass MachineClass based on which VMs created have to be listed Secret *corev1.Secret Kubernetes secret that contains any sensitive data/credentials

RESPONSE PARAMETERS (driver.ListMachinesResponse) MachineList map<string,string> A map containing the keys as the MachineID and value as the MachineName

for all machine's who where possibilly created by this ProviderSpec

type PluginSPI

type PluginSPI interface {
	CreateMachine(ctx context.Context, machineName string, providerSpec *api.KubeVirtProviderSpec, secrets *corev1.Secret) (providerID string, err error)
	DeleteMachine(ctx context.Context, machineName, providerID string, providerSpec *api.KubeVirtProviderSpec, secrets *corev1.Secret) (foundProviderID string, err error)
	GetMachineStatus(ctx context.Context, machineName, providerID string, providerSpec *api.KubeVirtProviderSpec, secrets *corev1.Secret) (foundProviderID string, err error)
	ListMachines(ctx context.Context, providerSpec *api.KubeVirtProviderSpec, secrets *corev1.Secret) (providerIDList map[string]string, err error)
	ShutDownMachine(ctx context.Context, machineName, providerID string, providerSpec *api.KubeVirtProviderSpec, secrets *corev1.Secret) (foundProviderID string, err error)
}

PluginSPI provides an interface to deal with cloud provider session You can optionally enhance this interface to add interface methods here You can use it to mock cloud provider calls

Directories

Path Synopsis
Package kubevirt contains the cloud kubevirt specific implementations to manage machines
Package kubevirt contains the cloud kubevirt specific implementations to manage machines
/* Copyright (c) 2019 SAP SE or an SAP affiliate company.
/* Copyright (c) 2019 SAP SE or an SAP affiliate company.

Jump to

Keyboard shortcuts

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