2 minute read
Adding support for a new cloud provider
For adding support for a new cloud provider in the Machine Controller Manager, follow the steps described below. Replace provider with your provider-name.
- Add a ProviderMachineClass CRD similar to existing AWSMachineClass into
- Add ProviderMachineClass structs similar to existing AWSMachineClass into the machine APIs into
pkg/apis/machine/v1alpha1/types.go. This would be the machineClass template used to describe provider specific configurations.
- Add the Go structures of your machine class (list) to
pkg/apis/machine/v1alpha1/register.goto allow reporting events on these objects.
- Regenerate the machine API clients by running
- Add validation for the new provider machine class at
pkg/controller/machine_util.goto allow validation of the new provider.
- Add a new driver into
pkg/driver/driver_aws.goto implement the driver interface.
pkg/driver/driver.goto add a new switch case to support the new provider driver.
- Add a new method in
pkg/controller/machine_safety.gocalled checkProviderMachineClass similar to the existing method called checkAWSMachineClass present in the same file. Now invoke this method as a go-routine in the method checkVMObjects.
- Extend the
cmd/machine-controller-manager/app/controllermanager.goto only start if your new machine class is under the available resources.
pkg/controller/controller.goto add new providerMachineClassLister, providerMachineClassQueue, awsMachineClassSynced into the controller struct. Also initialize them in NewController() method.
- Add a new file
pkg/controller/providermachineclass.gothat allows re-queuing of machines which refer to an modified providerMachineClass.
.Shutdown()similar to other cloud providers.
- Update the example ClusterRole in
kubernetes/deployment/in-tree/clusterrole.yamlto allow operations on your new machine class.
pkg/controller/secret_util.goto add event handlers to add/remove finalizers referenced by your machine Class. Refer this commit.