Skip to content

Commit

Permalink
change AutomaticRestart from bool to RestartPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelStuchly committed Nov 18, 2021
1 parent d2e80cb commit a1fab72
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions machine/v1beta1/types_gcpprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ const (
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 @@ -77,11 +87,13 @@ type GCPMachineProviderSpec struct {
// +kubebuilder:validation:Enum=Migrate;Terminate;
// +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.
// If omitted, the platform chooses a default, which is subject to change over time, currently that default is true.
// AutomaticRestart 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".
// +kubebuilder:validation:Enum=Always;Never;
// +optional
AutomaticRestart bool `json:"automaticRestart,omitempty"`
RestartPolicy GCPRestartPolicyType `json:"restartPolicy,omitempty"`
}

// GCPDisk describes disks for GCP.
Expand Down
2 changes: 1 addition & 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 a1fab72

Please sign in to comment.