Skip to content

Commit

Permalink
update types_gcprovider.go
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelStuchly committed Nov 17, 2021
1 parent c497013 commit 313a5bb
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
34 changes: 33 additions & 1 deletion machine/v1beta1/types_gcpprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// GCPHostMaintenanceType is a type representing acceptable values for OnHostMaintenance field in GCPMachineProviderSpec
type GCPHostMaintenanceType string

const (
// MigrateHostMaintenanceType [default] - causes Compute Engine to live migrate an instance when there is a maintenance event.
MigrateHostMaintenanceType GCPHostMaintenanceType = "Migrate"
// TerminateHostMaintenanceType - stops an instance instead of migrating it.
TerminateHostMaintenanceType GCPHostMaintenanceType = "Terminate"
)

// GCPMachineProviderSpec is the type that will be embedded in a Machine.Spec.ProviderSpec field
// for an GCP virtual machine. It is used by the GCP machine actuator to create a single Machine.
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
Expand Down Expand Up @@ -54,9 +64,21 @@ type GCPMachineProviderSpec struct {
// ProjectID is the project in which the GCP machine provider will create the VM.
// +optional
ProjectID string `json:"projectID,omitempty"`
// Preemptible indicates if created instance is preemptible
// GPUs is a list of GPUs to be attached to the VM.
// +optional
GPUs []GCPGPUConfig `json:"GPUs,omitempty"`
// Preemptible indicates if created instance is preemptible.
// +optional
Preemptible bool `json:"preemptible,omitempty"`
// OnHostMaintenance determines the behavior when a maintenance event occurs that might cause the instance to reboot.
// This is required to be set to TerminateHostMaintenanceType if you want to provision machine with attached GPUs.
// +kubebuilder:validation:Enum=MigrateHostMaintenanceType;TerminateHostMaintenanceType;
// +optional
OnHostMaintenance GCPHostMaintenanceType `json:"onHostMaintenance,omitempty"`
// AutomaticRestart determines the behavior when an instance crashes or the underlying infrastructure provider stops the instance as part of a maintenance event (default true).
// Cannot be true with preemptible instances.
// +optional
AutomaticRestart bool `json:"automaticRestart,omitempty"`
}

// GCPDisk describes disks for GCP.
Expand Down Expand Up @@ -134,6 +156,16 @@ type GCPKMSKeyReference struct {
Location string `json:"location"`
}

// GCPGPUConfig describes type and count of GPUs attached to the instance on GCP.
type GCPGPUConfig struct {
// Count is number of GPUs to be attached to an instance.
Count int32 `json:"count"`
// Type is the type of GPU to be attached to an instance.
// Supported GPU types are: nvidia-tesla-k80, nvidia-tesla-p100, nvidia-tesla-v100, nvidia-tesla-p4, nvidia-tesla-t4
// +kubebuilder:validation:Pattern=`^nvidia-tesla-(k80|p100|v100|p4|t4)$`
Type string `json:"type"`
}

// GCPMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field.
// It contains GCP-specific status information.
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
Expand Down
21 changes: 21 additions & 0 deletions machine/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion machine/v1beta1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 313a5bb

Please sign in to comment.