Skip to content

Commit

Permalink
Merge pull request #300 from alexander-demichev/preemptible
Browse files Browse the repository at this point in the history
Add support for preemptible instances
  • Loading branch information
k8s-ci-robot authored Feb 5, 2021
2 parents c4f7588 + d083cb5 commit c495997
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha3/gcpmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ type GCPMachineSpec struct {
// Defaults to: email: "default", scope: []{compute.CloudPlatformScope}
// +optional
ServiceAccount *ServiceAccount `json:"serviceAccounts,omitempty"`

// Preemptible defines if instance is preemptible
// +optional
Preemptible bool `json:"preemptible,omitempty"`
}

// GCPMachineStatus defines the observed state of GCPMachine.
Expand Down
3 changes: 3 additions & 0 deletions cloud/services/compute/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ func (s *Service) CreateInstance(scope *scope.MachineScope) (*compute.Instance,
},
},
},
Scheduling: &compute.Scheduling{
Preemptible: scope.GCPMachine.Spec.Preemptible,
},
}

if scope.GCPMachine.Spec.ServiceAccount != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
description: 'InstanceType is the type of instance to create. Example:
n1.standard-2'
type: string
preemptible:
description: Preemptible defines if instance is preemptible
type: boolean
providerID:
description: ProviderID is the unique identifier as specified by the
cloud provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ spec:
description: 'InstanceType is the type of instance to create.
Example: n1.standard-2'
type: string
preemptible:
description: Preemptible defines if instance is preemptible
type: boolean
providerID:
description: ProviderID is the unique identifier as specified
by the cloud provider.
Expand Down

0 comments on commit c495997

Please sign in to comment.