Skip to content

Commit 3ff05bf

Browse files
committed
add ProvisioningModel to enable gcp spot instances
1 parent 588d549 commit 3ff05bf

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

machine/v1beta1/types_gcpprovider.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ const (
2525
RestartPolicyNever GCPRestartPolicyType = "Never"
2626
)
2727

28+
// GCPProvisioningModelType is a type representing acceptable values for ProvisioningModel field in GCPMachineProviderSpec
29+
type GCPProvisioningModelType string
30+
31+
const (
32+
// GCPSpotInstance enables the GCP instances as spot instances which provide significant cost savings but may be preempted by Google Cloud Platform when resources are needed elsewhere.
33+
GCPSpotInstance GCPProvisioningModelType = "Spot"
34+
)
35+
2836
// SecureBootPolicy represents the secure boot configuration for the GCP machine.
2937
type SecureBootPolicy string
3038

@@ -129,6 +137,14 @@ type GCPMachineProviderSpec struct {
129137
// preemptible indicates if created instance is preemptible.
130138
// +optional
131139
Preemptible bool `json:"preemptible,omitempty"`
140+
// provisioningModel is an optional field that determines the provisioning model for the GCP machine instance.
141+
// Valid values are "Spot".
142+
// When set to Spot, the instance runs as a Google Cloud Spot instance which provides significant cost savings but may be preempted by Google Cloud Platform when resources are needed elsewhere.
143+
// When omitted, the machine will be provisioned as a standard on-demand instance.
144+
// This field cannot be used together with the preemptible field.
145+
// +optional
146+
// +kubebuilder:validation:Enum=Spot
147+
ProvisioningModel GCPProvisioningModelType `json:"provisioningModel,omitempty"`
132148
// onHostMaintenance determines the behavior when a maintenance event occurs that might cause the instance to reboot.
133149
// This is required to be set to "Terminate" if you want to provision machine with attached GPUs.
134150
// Otherwise, allowed values are "Migrate" and "Terminate".

machine/v1beta1/zz_generated.swagger_doc_generated.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22911,6 +22911,10 @@
2291122911
"description": "projectID is the project in which the GCP machine provider will create the VM.",
2291222912
"type": "string"
2291322913
},
22914+
"provisioningModel": {
22915+
"description": "provisioningModel is an optional field that determines the provisioning model for the GCP machine instance. Valid values are \"Spot\". When set to Spot, the instance runs as a Google Cloud Spot instance which provides significant cost savings but may be preempted by Google Cloud Platform when resources are needed elsewhere. When omitted, the machine will be provisioned as a standard on-demand instance. This field cannot be used together with the preemptible field.",
22916+
"type": "string"
22917+
},
2291422918
"region": {
2291522919
"description": "region is the region in which the GCP machine provider will create the VM.",
2291622920
"type": "string",

0 commit comments

Comments
 (0)