Documentation ¶
Overview ¶
Package provider contains the cloud provider specific implementations to manage machines
Package provider contains the cloud provider specific implementations to manage machines
Index ¶
- func NewProvider(spi spi.SessionProviderInterface) driver.Driver
- type Provider
- func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineRequest) (*driver.CreateMachineResponse, error)
- func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineRequest) (*driver.DeleteMachineResponse, error)
- func (p *Provider) GenerateMachineClassForMigration(ctx context.Context, req *driver.GenerateMachineClassForMigrationRequest) (*driver.GenerateMachineClassForMigrationResponse, error)
- func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineStatusRequest) (*driver.GetMachineStatusResponse, error)
- func (p *Provider) GetVolumeIDs(_ context.Context, req *driver.GetVolumeIDsRequest) (*driver.GetVolumeIDsResponse, error)
- func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesRequest) (*driver.ListMachinesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
func NewProvider(spi spi.SessionProviderInterface) driver.Driver
NewProvider returns an empty provider object
Types ¶
type Provider ¶
type Provider struct {
SPI spi.SessionProviderInterface
}
Provider is the struct that implements the driver interface It is used to implement the basic driver functionalities
func (*Provider) CreateMachine ¶
func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineRequest) (*driver.CreateMachineResponse, error)
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 provider. 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 (*Provider) DeleteMachine ¶
func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineRequest) (*driver.DeleteMachineResponse, error)
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 (*Provider) GenerateMachineClassForMigration ¶
func (p *Provider) GenerateMachineClassForMigration(ctx context.Context, req *driver.GenerateMachineClassForMigrationRequest) (*driver.GenerateMachineClassForMigrationResponse, error)
GenerateMachineClassForMigration helps in migration of one kind of machineClass CR to another kind. For instance an machineClass custom resource of `AWSMachineClass` to `MachineClass`. Implement this functionality only if something like this is desired in your setup. If you don't require this functionality leave is as is. (return Unimplemented)
The following are the tasks typically expected out of this method 1. Validate if the incoming classSpec is valid one for migration (e.g. has the right kind). 2. Migrate/Copy over all the fields/spec from req.ProviderSpecificMachineClass to req.MachineClass For an example refer
https://github.com/prashanth26/machine-controller-manager-provider-gcp/blob/migration/pkg/gcp/machine_controller.go#L222-L233
REQUEST PARAMETERS (driver.GenerateMachineClassForMigration) ProviderSpecificMachineClass interface{} ProviderSpecificMachineClass is provider specfic machine class object (E.g. AWSMachineClass). Typecasting is required here. MachineClass *v1alpha1.MachineClass MachineClass is the machine class object that is to be filled up by this method. ClassSpec *v1alpha1.ClassSpec Somemore classSpec details useful while migration.
RESPONSE PARAMETERS (driver.GenerateMachineClassForMigration) NONE
func (*Provider) GetMachineStatus ¶
func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineStatusRequest) (*driver.GetMachineStatusResponse, error)
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 provider. 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 error code if the machine is not existing
func (*Provider) GetVolumeIDs ¶
func (p *Provider) GetVolumeIDs(_ context.Context, req *driver.GetVolumeIDsRequest) (*driver.GetVolumeIDsResponse, error)
GetVolumeIDs returns a list of Volume IDs for all PV Specs for whom an provider 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 (*Provider) ListMachines ¶
func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesRequest) (*driver.ListMachinesResponse, error)
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
Directories ¶
Path | Synopsis |
---|---|
validation
Package validation - validation is used to validate cloud specific ProviderSpec
|
Package validation - validation is used to validate cloud specific ProviderSpec |