Documentation ¶
Index ¶
- Constants
- func GetClient(secret *corev1.Secret) (client.Client, string, error)
- func GetServerVersion(secret *corev1.Secret) (string, error)
- func IsMachineNotFoundError(err error) bool
- type ClientFactory
- type ClientFactoryFunc
- type MachineNotFoundError
- type PluginSPIImpl
- func (p PluginSPIImpl) CreateMachine(ctx context.Context, machineName string, ...) (providerID string, err error)
- func (p PluginSPIImpl) DeleteMachine(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, ...) (foundProviderID string, err error)
- func (p PluginSPIImpl) GetMachineStatus(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, ...) (foundProviderID string, err error)
- func (p PluginSPIImpl) ListMachines(ctx context.Context, providerSpec *api.KubeVirtProviderSpec, ...) (providerIDList map[string]string, err error)
- func (p PluginSPIImpl) ShutDownMachine(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, ...) (foundProviderID string, err error)
- type ServerVersionFactory
- type ServerVersionFactoryFunc
- type Timer
- type TimerFunc
Constants ¶
const (
// ProviderName is the kubevirt provider name.
ProviderName = "kubevirt"
)
Variables ¶
This section is empty.
Functions ¶
func GetClient ¶
GetClient creates a client from the kubeconfig saved in the "kubeconfig" field of the given secret. It also returns the namespace of the kubeconfig's current context.
func GetServerVersion ¶
GetServerVersion gets the server version from the kubeconfig saved in the "kubeconfig" field of the given secret.
func IsMachineNotFoundError ¶
IsMachineNotFoundError returns true if the given error is a MachineNotFoundError, false otherwise.
Types ¶
type ClientFactory ¶
type ClientFactory interface { // GetClient creates a client from the kubeconfig saved in the "kubeconfig" field of the given secret. // It also returns the namespace of the kubeconfig's current context. GetClient(secret *corev1.Secret) (client.Client, string, error) }
ClientFactory creates a client from the kubeconfig saved in the "kubeconfig" field of the given secret.
type ClientFactoryFunc ¶
ClientFactoryFunc is a function that implements ClientFactory.
type MachineNotFoundError ¶
type MachineNotFoundError struct { // Name is the machine name Name string }
MachineNotFoundError represents a "machine not found" error.
func (*MachineNotFoundError) Error ¶
func (e *MachineNotFoundError) Error() string
type PluginSPIImpl ¶
type PluginSPIImpl struct {
// contains filtered or unexported fields
}
PluginSPIImpl is the implementation of PluginSPI interface.
func NewPluginSPIImpl ¶
func NewPluginSPIImpl(cf ClientFactory, svf ServerVersionFactory, timer Timer) *PluginSPIImpl
NewPluginSPIImpl creates a new PluginSPIImpl with the given ClientFactory, ServerVersionFactory, and Timer.
func (PluginSPIImpl) CreateMachine ¶
func (p PluginSPIImpl) CreateMachine(ctx context.Context, machineName string, providerSpec *api.KubeVirtProviderSpec, secret *corev1.Secret) (providerID string, err error)
CreateMachine creates a machine with the given name, using the given provider spec and secret. Here it creates a kubevirt virtual machine and a secret containing the userdata (cloud-init).
func (PluginSPIImpl) DeleteMachine ¶
func (p PluginSPIImpl) DeleteMachine(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, secret *corev1.Secret) (foundProviderID string, err error)
DeleteMachine deletes the machine with the given name and provider id, using the given provider spec and secret. Here it deletes the kubevirt virtual machine with the given name.
func (PluginSPIImpl) GetMachineStatus ¶
func (p PluginSPIImpl) GetMachineStatus(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, secret *corev1.Secret) (foundProviderID string, err error)
GetMachineStatus returns the provider id of the machine with the given name and provider id, using the given provider spec and secret. Here it returns the provider id of the kubevirt virtual machine with the given name.
func (PluginSPIImpl) ListMachines ¶
func (p PluginSPIImpl) ListMachines(ctx context.Context, providerSpec *api.KubeVirtProviderSpec, secret *corev1.Secret) (providerIDList map[string]string, err error)
ListMachines lists all machines matching the given provider spec and secret. Here it lists all kubevirt virtual machines matching the tags of the given provider spec.
func (PluginSPIImpl) ShutDownMachine ¶
func (p PluginSPIImpl) ShutDownMachine(ctx context.Context, machineName, _ string, _ *api.KubeVirtProviderSpec, secret *corev1.Secret) (foundProviderID string, err error)
ShutDownMachine shuts down the machine with the given name and provider id, using the given provider spec and secret. Here it shuts down the kubevirt virtual machine with the given name by setting its spec.running field to false.
type ServerVersionFactory ¶
type ServerVersionFactory interface { // GetServerVersion gets the server version from the kubeconfig saved in the "kubeconfig" field of the given secret. GetServerVersion(secret *corev1.Secret) (string, error) }
ServerVersionFactory gets the server version from the kubeconfig saved in the "kubeconfig" field of the given secret.
type ServerVersionFactoryFunc ¶
ServerVersionFactoryFunc is a function that implements ServerVersionFactory.
func (ServerVersionFactoryFunc) GetServerVersion ¶
func (f ServerVersionFactoryFunc) GetServerVersion(secret *corev1.Secret) (string, error)
GetServerVersion gets the server version from the kubeconfig saved in the "kubeconfig" field of the given secret.