driver

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0, BSD-3-Clause Imports: 57 Imported by: 0

Documentation

Overview

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Package driver contains the cloud provider specific implementations to manage machines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCredentialsFromData

func ExtractCredentialsFromData(data map[string][]byte, keys ...string) string

ExtractCredentialsFromData extracts and trims a value from the given data map. The first key that exists is being returned, otherwise, the next key is tried, etc. If no key exists then an empty string is returned.

Types

type AWSDriver

type AWSDriver struct {
	AWSMachineClass *v1alpha1.AWSMachineClass
	CredentialsData map[string][]byte
	UserData        string
	MachineID       string
	MachineName     string
}

AWSDriver is the driver struct for holding AWS machine information

func (*AWSDriver) Create

func (d *AWSDriver) Create() (string, string, error)

Create method is used to create a AWS machine

func (*AWSDriver) Delete

func (d *AWSDriver) Delete(machineID string) error

Delete method is used to delete a AWS machine

func (*AWSDriver) GetExisting

func (d *AWSDriver) GetExisting() (string, error)

GetExisting method is used to get machineID for existing AWS machine

func (*AWSDriver) GetUserData

func (d *AWSDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*AWSDriver) GetVMs

func (d *AWSDriver) GetVMs(machineID string) (VMs, error)

GetVMs returns a VM matching the machineID If machineID is an empty string then it returns all matching instances

func (*AWSDriver) GetVolNames

func (d *AWSDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*AWSDriver) SetUserData

func (d *AWSDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type AlicloudDriver

type AlicloudDriver struct {
	AlicloudMachineClass *v1alpha1.AlicloudMachineClass
	CredentialsData      map[string][]byte
	UserData             string
	MachineID            string
	MachineName          string
}

AlicloudDriver is the driver struct for holding Alicloud machine information

func (*AlicloudDriver) Create

func (c *AlicloudDriver) Create() (string, string, error)

Create is used to create a VM

func (*AlicloudDriver) Delete

func (c *AlicloudDriver) Delete(machineID string) error

Delete method is used to delete an alicloud machine

func (*AlicloudDriver) GetExisting

func (c *AlicloudDriver) GetExisting() (string, error)

GetExisting method is used to get machineID for existing Alicloud machine

func (*AlicloudDriver) GetUserData

func (c *AlicloudDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*AlicloudDriver) GetVMs

func (c *AlicloudDriver) GetVMs(machineID string) (VMs, error)

GetVMs returns a VM matching the machineID If machineID is an empty string then it returns all matching instances

func (*AlicloudDriver) GetVolNames

func (c *AlicloudDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*AlicloudDriver) SetUserData

func (c *AlicloudDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type AzureDriver

type AzureDriver struct {
	AzureMachineClass *v1alpha1.AzureMachineClass
	CredentialsData   map[string][]byte
	UserData          string
	MachineID         string
	MachineName       string
}

AzureDriver is the driver struct for holding azure machine information

func (*AzureDriver) Create

func (d *AzureDriver) Create() (string, string, error)

Create method is used to create an azure machine

func (*AzureDriver) Delete

func (d *AzureDriver) Delete(machineID string) error

Delete method is used to delete an azure machine

func (*AzureDriver) GetExisting

func (d *AzureDriver) GetExisting() (string, error)

GetExisting method is used to fetch the machineID for an azure machine

func (*AzureDriver) GetUserData

func (d *AzureDriver) GetUserData() string

GetUserData return the user data with which the VM will be booted

func (*AzureDriver) GetVMs

func (d *AzureDriver) GetVMs(machineID string) (result VMs, err error)

GetVMs returns a list of VM or VM resources Azure earlier treated all VM resources (instance, NIC, Disks) as a single resource and atomically created/deleted them in the driver interface. This caused issues when the controller crashes, during deletions. To fix this, now GetVMs interface checks for all resources instead of just VMs.

func (*AzureDriver) GetVolNames

func (d *AzureDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*AzureDriver) SetUserData

func (d *AzureDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type Driver

type Driver interface {
	Create() (string, string, error)
	Delete(string) error
	GetExisting() (string, error)
	GetVMs(string) (VMs, error)
	GetVolNames([]corev1.PersistentVolumeSpec) ([]string, error)
	GetUserData() string
	SetUserData(string)
}

Driver is the common interface for creation/deletion of the VMs over different cloud-providers.

func NewAWSDriver

func NewAWSDriver(create func() (string, error), delete func() error, existing func() (string, error)) Driver

NewAWSDriver returns an empty AWSDriver object

func NewDriver

func NewDriver(machineID string, secretData map[string][]byte, classKind string, machineClass interface{}, machineName string) Driver

NewDriver creates a new driver object based on the classKind

func NewFakeDriver

func NewFakeDriver(create func() (string, string, error), delete func(string) error, existing func() (string, error), getVMs func() (VMs, error)) Driver

NewFakeDriver returns a new fakedriver object

func NewPacketDriver

func NewPacketDriver(create func() (string, error), delete func() error, existing func() (string, error)) Driver

NewPacketDriver returns an empty PacketDriver object

type FakeDriver

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

FakeDriver is a fake driver returned when none of the actual drivers match

func (*FakeDriver) Create

func (d *FakeDriver) Create() (string, string, error)

Create returns a newly created fake driver

func (*FakeDriver) Delete

func (d *FakeDriver) Delete(machineID string) error

Delete deletes a fake driver

func (*FakeDriver) GetExisting

func (d *FakeDriver) GetExisting() (string, error)

GetExisting returns the existing fake driver

func (*FakeDriver) GetUserData

func (d *FakeDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*FakeDriver) GetVMs

func (d *FakeDriver) GetVMs(name string) (VMs, error)

GetVMs returns a list of VMs

func (*FakeDriver) GetVolNames

func (d *FakeDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*FakeDriver) SetUserData

func (d *FakeDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type GCPDriver

type GCPDriver struct {
	GCPMachineClass *v1alpha1.GCPMachineClass
	CredentialsData map[string][]byte
	UserData        string
	MachineID       string
	MachineName     string
}

GCPDriver is the driver struct for holding GCP machine information

func (*GCPDriver) Create

func (d *GCPDriver) Create() (string, string, error)

Create method is used to create a GCP machine

func (*GCPDriver) Delete

func (d *GCPDriver) Delete(machineID string) error

Delete method is used to delete a GCP machine

func (*GCPDriver) GetExisting

func (d *GCPDriver) GetExisting() (string, error)

GetExisting method is used to get machineID for existing GCP machine

func (*GCPDriver) GetUserData

func (d *GCPDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*GCPDriver) GetVMs

func (d *GCPDriver) GetVMs(machineID string) (VMs, error)

GetVMs returns a list of VMs

func (*GCPDriver) GetVolNames

func (d *GCPDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*GCPDriver) SetUserData

func (d *GCPDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type OpenStackDriver

type OpenStackDriver struct {
	OpenStackMachineClass *v1alpha1.OpenStackMachineClass
	CredentialsData       map[string][]byte
	UserData              string
	MachineID             string
	MachineName           string
}

OpenStackDriver is the driver struct for holding OS machine information

func (*OpenStackDriver) Create

func (d *OpenStackDriver) Create() (string, string, error)

Create method is used to create an OS machine

func (*OpenStackDriver) Delete

func (d *OpenStackDriver) Delete(machineID string) error

Delete method is used to delete an OS machine

func (*OpenStackDriver) GetExisting

func (d *OpenStackDriver) GetExisting() (string, error)

GetExisting method is used to get machineID for existing OS machine

func (*OpenStackDriver) GetUserData

func (d *OpenStackDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*OpenStackDriver) GetVMs

func (d *OpenStackDriver) GetVMs(machineID string) (VMs, error)

GetVMs returns a VM matching the machineID If machineID is an empty string then it returns all matching instances

func (*OpenStackDriver) GetVolNames

func (d *OpenStackDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*OpenStackDriver) SetUserData

func (d *OpenStackDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type PacketDriver

type PacketDriver struct {
	PacketMachineClass *v1alpha1.PacketMachineClass
	CredentialsData    map[string][]byte
	UserData           string
	MachineID          string
	MachineName        string
}

PacketDriver is the driver struct for holding Packet machine information

func (*PacketDriver) Create

func (d *PacketDriver) Create() (string, string, error)

Create method is used to create a Packet machine

func (*PacketDriver) Delete

func (d *PacketDriver) Delete(machineID string) error

Delete method is used to delete a Packet machine

func (*PacketDriver) GetExisting

func (d *PacketDriver) GetExisting() (string, error)

GetExisting method is used to get machineID for existing Packet machine

func (*PacketDriver) GetUserData

func (d *PacketDriver) GetUserData() string

GetUserData return the used data whit which the VM will be booted

func (*PacketDriver) GetVMs

func (d *PacketDriver) GetVMs(machineID string) (VMs, error)

GetVMs returns a machine matching the machineID If machineID is an empty string then it returns all matching instances

func (*PacketDriver) GetVolNames

func (d *PacketDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error)

GetVolNames parses volume names from pv specs

func (*PacketDriver) SetUserData

func (d *PacketDriver) SetUserData(userData string)

SetUserData set the used data whit which the VM will be booted

type VMs

type VMs map[string]string

VMs maintains a list of VM returned by the provider Key refers to the machine-id on the cloud provider value refers to the machine-name of the machine object

Jump to

Keyboard shortcuts

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