Advanced
Machine Template Model
Each cluster has one or more Machine Templates, which specify to create a particular number of machines using a specified Machine Config + Cloud Credential. Basic information about the template is shown later on detail screens, such as the machine size and location. This is done by providing a model class for your driver's template and overriding methods.
Your model should be called models/rke-machine.cattle.io.[your driver in lowercase]template.js (corresponding to the schema that shows up once the driver is installed). It should extend the generic MachineTemplate and override methods as appropriate:
import MachineTemplate from '@shell/models/rke-machine.cattle.io.machinetemplate';
export default class MyDriverMachineTemplate extends MachineTemplate {
get provider() {
return 'mydriver';
}
get providerLocation() {
return this.spec.template.spec.zone;
}
get providerSize() {
return this.spec.template.spec.instanceType;
}
}