Documentation
¶
Overview ¶
Package driver contains the cloud provider specific implementations to manage machines
Package driver contains a fake driver implementation
Index ¶
- type CreateMachineRequest
- type CreateMachineResponse
- type DeleteMachineRequest
- type DeleteMachineResponse
- type Driver
- type FakeDriver
- func (d *FakeDriver) AddMachine(machineID, machineName string) error
- func (d *FakeDriver) CreateMachine(_ context.Context, _ *CreateMachineRequest) (*CreateMachineResponse, error)
- func (d *FakeDriver) DeleteMachine(_ context.Context, deleteMachineRequest *DeleteMachineRequest) (*DeleteMachineResponse, error)
- func (d *FakeDriver) GenerateMachineClassForMigration(_ context.Context, req *GenerateMachineClassForMigrationRequest) (*GenerateMachineClassForMigrationResponse, error)
- func (d *FakeDriver) GetMachineStatus(_ context.Context, _ *GetMachineStatusRequest) (*GetMachineStatusResponse, error)
- func (d *FakeDriver) GetVolumeIDs(_ context.Context, _ *GetVolumeIDsRequest) (*GetVolumeIDsResponse, error)
- func (d *FakeDriver) InitializeMachine(_ context.Context, _ *InitializeMachineRequest) (*InitializeMachineResponse, error)
- func (d *FakeDriver) ListMachines(_ context.Context, _ *ListMachinesRequest) (*ListMachinesResponse, error)
- type GenerateMachineClassForMigrationRequest
- type GenerateMachineClassForMigrationResponse
- type GetMachineStatusRequest
- type GetMachineStatusResponse
- type GetVolumeIDsRequest
- type GetVolumeIDsResponse
- type InitializeMachineRequest
- type InitializeMachineResponse
- type ListMachinesRequest
- type ListMachinesResponse
- type VMs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateMachineRequest ¶
type CreateMachineRequest struct {
// Machine object from whom VM is to be created
Machine *v1alpha1.Machine
// MachineClass backing the machine object
MachineClass *v1alpha1.MachineClass
// Secret backing the machineClass object
Secret *corev1.Secret
}
CreateMachineRequest is the create request for VM creation
type CreateMachineResponse ¶
type CreateMachineResponse struct {
// ProviderID is the unique identification of the VM at the cloud provider.
// ProviderID typically matches with the node.Spec.ProviderID on the node object.
// Eg: gce://project-name/region/vm-ID
ProviderID string
// NodeName is the name of the node-object registered to kubernetes.
NodeName string
// LastKnownState represents the last state of the VM during an creation/deletion error
LastKnownState string
// Addresses to reach the VM. Returning this field is optional, and only used if the MCM provider runs without a
// target cluster.
Addresses []corev1.NodeAddress
}
CreateMachineResponse is the create response for VM creation
type DeleteMachineRequest ¶
type DeleteMachineRequest struct {
// Machine object from whom VM is to be deleted
Machine *v1alpha1.Machine
// MachineClass backing the machine object
MachineClass *v1alpha1.MachineClass
// Secret backing the machineClass object
Secret *corev1.Secret
}
DeleteMachineRequest is the delete request for VM deletion
type DeleteMachineResponse ¶
type DeleteMachineResponse struct {
// LastKnownState represents the last state of the VM during an creation/deletion error
LastKnownState string
}
DeleteMachineResponse is the delete response for VM deletion
type Driver ¶
type Driver interface {
// CreateMachine call is responsible for VM creation on the provider
CreateMachine(context.Context, *CreateMachineRequest) (*CreateMachineResponse, error)
// InitializeMachine call is responsible for VM initialization on the provider.
// This method should only be invoked as a post VM creation initialization to configure network configuration etc.
//
// In case of an error, this operation should return an error with one of the following status codes
// - codes.Unimplemented if the provider does not support VM instance initialization.
// - codes.Uninitialized initialization of VM instance failed due to errors
// - codes.NotFound if VM instance was not found.
InitializeMachine(context.Context, *InitializeMachineRequest) (*InitializeMachineResponse, error)
// DeleteMachine call is responsible for VM deletion/termination on the provider
DeleteMachine(context.Context, *DeleteMachineRequest) (*DeleteMachineResponse, error)
// GetMachineStatus call get's the status of the VM backing the machine object on the provider
GetMachineStatus(context.Context, *GetMachineStatusRequest) (*GetMachineStatusResponse, error)
// ListMachines lists all the machines that might have been created by the supplied machineClass
ListMachines(context.Context, *ListMachinesRequest) (*ListMachinesResponse, error)
// GetVolumeIDs returns a list volumeIDs for the list of PVSpecs
GetVolumeIDs(context.Context, *GetVolumeIDsRequest) (*GetVolumeIDsResponse, error)
}
Driver is the common interface for creation/deletion of the VMs over different cloud-providers.
func NewFakeDriver ¶
func NewFakeDriver(vmExists bool, providerID, nodeName, lastKnownState string, addresses []corev1.NodeAddress, err error, fakeVMs VMs) Driver
NewFakeDriver returns a new fakedriver object
type FakeDriver ¶
type FakeDriver struct {
VMExists bool
ProviderID string
NodeName string
LastKnownState string
Addresses []corev1.NodeAddress
Err error
// contains filtered or unexported fields
}
FakeDriver is a fake driver returned when none of the actual drivers match
func (*FakeDriver) AddMachine ¶ added in v0.37.0
func (d *FakeDriver) AddMachine(machineID, machineName string) error
AddMachine makes a call to the driver to create the machine.
func (*FakeDriver) CreateMachine ¶
func (d *FakeDriver) CreateMachine(_ context.Context, _ *CreateMachineRequest) (*CreateMachineResponse, error)
CreateMachine makes a call to the driver to create the machine.
func (*FakeDriver) DeleteMachine ¶
func (d *FakeDriver) DeleteMachine(_ context.Context, deleteMachineRequest *DeleteMachineRequest) (*DeleteMachineResponse, error)
DeleteMachine make a call to the driver to delete the machine.
func (*FakeDriver) GenerateMachineClassForMigration ¶ added in v0.34.0
func (d *FakeDriver) GenerateMachineClassForMigration(_ context.Context, req *GenerateMachineClassForMigrationRequest) (*GenerateMachineClassForMigrationResponse, error)
GenerateMachineClassForMigration converts providerMachineClass to (generic)MachineClass
func (*FakeDriver) GetMachineStatus ¶
func (d *FakeDriver) GetMachineStatus(_ context.Context, _ *GetMachineStatusRequest) (*GetMachineStatusResponse, error)
GetMachineStatus makes a gRPC call to the driver to check existance of machine
func (*FakeDriver) GetVolumeIDs ¶
func (d *FakeDriver) GetVolumeIDs(_ context.Context, _ *GetVolumeIDsRequest) (*GetVolumeIDsResponse, error)
GetVolumeIDs returns a list of VolumeIDs for the PV spec list supplied
func (*FakeDriver) InitializeMachine ¶ added in v0.53.0
func (d *FakeDriver) InitializeMachine(_ context.Context, _ *InitializeMachineRequest) (*InitializeMachineResponse, error)
InitializeMachine makes a call to the driver to initialize the VM instance of machine.
func (*FakeDriver) ListMachines ¶
func (d *FakeDriver) ListMachines(_ context.Context, _ *ListMachinesRequest) (*ListMachinesResponse, error)
ListMachines have to list machines
type GenerateMachineClassForMigrationRequest ¶ added in v0.34.0
type GenerateMachineClassForMigrationRequest struct {
// ProviderSpecificMachineClass is provider specfic machine class object.
// E.g. AWSMachineClass
ProviderSpecificMachineClass interface{}
// MachineClass is the machine class object generated that is to be filled up
MachineClass *v1alpha1.MachineClass
// ClassSpec contains the class spec object to determine the machineClass kind
ClassSpec *v1alpha1.ClassSpec
}
GenerateMachineClassForMigrationRequest is the request for generating the generic machineClass for the provider specific machine class
type GenerateMachineClassForMigrationResponse ¶ added in v0.34.0
type GenerateMachineClassForMigrationResponse struct{}
GenerateMachineClassForMigrationResponse is the response for generating the generic machineClass for the provider specific machine class
type GetMachineStatusRequest ¶
type GetMachineStatusRequest struct {
// Machine object from whom VM status is to be fetched
Machine *v1alpha1.Machine
// MachineClass backing the machine object
MachineClass *v1alpha1.MachineClass
// Secret backing the machineClass object
Secret *corev1.Secret
}
GetMachineStatusRequest is the get request for VM info
type GetMachineStatusResponse ¶
type GetMachineStatusResponse struct {
// ProviderID is the unique identification of the VM at the cloud provider.
// ProviderID typically matches with the node.Spec.ProviderID on the node object.
// Eg: gce://project-name/region/vm-ID
ProviderID string
// NodeName is the name of the node-object registered to kubernetes.
NodeName string
// Addresses to reach the VM. Returning this field is optional, and only used if the MCM provider runs without a
// target cluster.
Addresses []corev1.NodeAddress
}
GetMachineStatusResponse is the get response for VM info
type GetVolumeIDsRequest ¶
type GetVolumeIDsRequest struct {
// PVSpecsList is a list of PV specs for whom volume-IDs are required
// Plugin should parse this raw data into pre-defined list of PVSpecs
PVSpecs []*corev1.PersistentVolumeSpec
}
GetVolumeIDsRequest is the request object to get a list of VolumeIDs for a PVSpec
type GetVolumeIDsResponse ¶
type GetVolumeIDsResponse struct {
// VolumeIDs is a list of VolumeIDs.
VolumeIDs []string
}
GetVolumeIDsResponse is the response object of the list of VolumeIDs for a PVSpec
type InitializeMachineRequest ¶ added in v0.53.0
type InitializeMachineRequest struct {
// Machine object representing VM that must be initialized
Machine *v1alpha1.Machine
// MachineClass backing the machine object
MachineClass *v1alpha1.MachineClass
// Secret backing the machineClass object
Secret *corev1.Secret
}
InitializeMachineRequest encapsulates params for the VM Initialization operation (Driver.InitializeMachine).
type InitializeMachineResponse ¶ added in v0.53.0
type InitializeMachineResponse struct {
// ProviderID is the unique identification of the VM at the cloud provider.
// ProviderID typically matches with the node.Spec.ProviderID on the node object.
// Eg: gce://project-name/region/vm-ID
ProviderID string
// NodeName is the name of the node-object registered to kubernetes.
NodeName string
// Addresses to reach the VM. Returning this field is optional, and only used if the MCM provider runs without a
// target cluster.
Addresses []corev1.NodeAddress
}
InitializeMachineResponse is the response for VM instance initialization (Driver.InitializeMachine).
type ListMachinesRequest ¶
type ListMachinesRequest struct {
// MachineClass object
MachineClass *v1alpha1.MachineClass
// Secret backing the machineClass object
Secret *corev1.Secret
}
ListMachinesRequest is the request object to get a list of VMs belonging to a machineClass
type ListMachinesResponse ¶
type ListMachinesResponse struct {
// MachineList is the map of list of machines. Format for the map should be <ProviderID, MachineName>.
MachineList map[string]string
}
ListMachinesResponse is the response object of the list of VMs belonging to a machineClass