From 93b1e1601ebfc64238f2881705e0bef276f5e9ce Mon Sep 17 00:00:00 2001 From: Aniruddha Basak Date: Mon, 11 Jul 2022 15:28:23 +0530 Subject: [PATCH 1/2] Add fields required to provision an GCP instance with GPU Signed-off-by: Aniruddha Basak --- api/v1beta1/gcpmachine_types.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/v1beta1/gcpmachine_types.go b/api/v1beta1/gcpmachine_types.go index 3b9f9cf27..6c5c54c98 100644 --- a/api/v1beta1/gcpmachine_types.go +++ b/api/v1beta1/gcpmachine_types.go @@ -89,6 +89,21 @@ type GCPMachineSpec struct { // +optional Image *string `json:"image,omitempty"` + // AccleratorType is the full reference to a valid GPU to be used for this machine + // +optional + AccleratorType *string `json:"AccleratorType,omitempty"` + + // AcceleratorCount is the number of GPUs to be available at the instance creation time + // default=1 + // +optional + AcceleratorCount *string `json:"AcceleratorCount,omitempty"` + + // OnHostMaintenance is an option to set the behaviour of selected Google Cloud virtual machine + // instance during a maintenance event + // default=TERMINATE + // +optional + OnHostMaintenance *string `json:"OnHostMaintenance,omitempty"` + // AdditionalLabels is an optional set of tags to add to an instance, in addition to the ones added by default by the // GCP provider. If both the GCPCluster and the GCPMachine specify the same tag name with different values, the // GCPMachine's value takes precedence. From 29ebf20b8d31b2180a97c0807ce8736712c9eb0d Mon Sep 17 00:00:00 2001 From: Aniruddha Basak Date: Tue, 12 Jul 2022 15:46:04 +0530 Subject: [PATCH 2/2] Add GCPAcceleratorConfig struct Signed-off-by: Aniruddha Basak --- api/v1beta1/gcpmachine_types.go | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/api/v1beta1/gcpmachine_types.go b/api/v1beta1/gcpmachine_types.go index 6c5c54c98..164277aab 100644 --- a/api/v1beta1/gcpmachine_types.go +++ b/api/v1beta1/gcpmachine_types.go @@ -66,6 +66,18 @@ const ( IPForwardingDisabled IPForwarding = "Disabled" ) +// AcceleratorConfig defines the type & number of accelerator required +type AcceleratorConfig struct { + // AccleratorType is the full reference to a valid GPU to be used for this machine + // +required + Type string `json:"type,omitempty"` + + // AcceleratorCount is the number of GPUs to be available at the instance creation time + // default=1 + // +optional + Count int64 `json:"count,omitempty"` +} + // GCPMachineSpec defines the desired state of GCPMachine. type GCPMachineSpec struct { // InstanceType is the type of instance to create. Example: n1.standard-2 @@ -89,20 +101,19 @@ type GCPMachineSpec struct { // +optional Image *string `json:"image,omitempty"` - // AccleratorType is the full reference to a valid GPU to be used for this machine - // +optional - AccleratorType *string `json:"AccleratorType,omitempty"` - - // AcceleratorCount is the number of GPUs to be available at the instance creation time - // default=1 - // +optional - AcceleratorCount *string `json:"AcceleratorCount,omitempty"` + // Accelerator is the reference to a valid GPU Accelerator + Accelerator *AcceleratorConfig `json:"accelerator,omitempty"` // OnHostMaintenance is an option to set the behaviour of selected Google Cloud virtual machine // instance during a maintenance event - // default=TERMINATE + // default=MIGRATE + // +optional + OnHostMaintenance string `json:"onHostMaintenance,omitempty"` + + // AutomaticRestart defines if the instance should be restarted when it is + // default=True // +optional - OnHostMaintenance *string `json:"OnHostMaintenance,omitempty"` + AutomaticRestart bool `json:"automaticRestart,omitempty"` // AdditionalLabels is an optional set of tags to add to an instance, in addition to the ones added by default by the // GCP provider. If both the GCPCluster and the GCPMachine specify the same tag name with different values, the