Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update types_gcprovider.go #1044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion machine/v1beta1/types_gcpprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ 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"
)

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

const (
// Restart an instance if an instance crashes or the underlying infrastructure provider stops the instance as part of a maintenance event.
RestartPolicyAlways GCPRestartPolicyType = "Always"
// Do not restart an instance if an instance crashes or the underlying infrastructure provider stops the instance as part of a maintenance event.
RestartPolicyNever GCPRestartPolicyType = "Never"
)

// 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 +74,27 @@ 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 "Terminate" if you want to provision machine with attached GPUs.
// Otherwise, allowed values are "Migrate" and "Terminate".
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is "Migrate".
// +kubebuilder:validation:Enum=Migrate;Terminate;
// +optional
OnHostMaintenance GCPHostMaintenanceType `json:"onHostMaintenance,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to describe what happens when the value is empty. We often say, " "" means no opinion and the platform chooses a default, which is subject to change over time, currently that default is ".

// RestartPolicy determines the behavior when an instance crashes or the underlying infrastructure provider stops the instance as part of a maintenance event (default "Always").
// Cannot be "Always" with preemptible instances.
// Otherwise, allowed values are "Always" and "Never".
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is "Always".
// RestartPolicy represents AutomaticRestart in GCP compute api
// +kubebuilder:validation:Enum=Always;Never;
// +optional
RestartPolicy GCPRestartPolicyType `json:"restartPolicy,omitempty"`
}

// GCPDisk describes disks for GCP.
Expand Down Expand Up @@ -134,6 +172,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 the 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.