Skip to content

Commit 727ac5c

Browse files
de1987RadekManak
authored andcommitted
add ProvisioningModel to enable gcp spot instances
1 parent 7837a80 commit 727ac5c

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-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" and omitted.
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.deepcopy.go

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

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
@@ -22925,6 +22925,10 @@
2292522925
"description": "projectID is the project in which the GCP machine provider will create the VM.",
2292622926
"type": "string"
2292722927
},
22928+
"provisioningModel": {
22929+
"description": "provisioningModel is an optional field that determines the provisioning model for the GCP machine instance. Valid values are \"Spot\" and omitted. 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.",
22930+
"type": "string"
22931+
},
2292822932
"region": {
2292922933
"description": "region is the region in which the GCP machine provider will create the VM.",
2293022934
"type": "string",

0 commit comments

Comments
 (0)