Skip to content

Commit

Permalink
Rename ErrorMessage and ErrorReason to FailureMessage and FailureReason
Browse files Browse the repository at this point in the history
  • Loading branch information
noamran committed Nov 14, 2019
1 parent 80b9d58 commit 4f52174
Show file tree
Hide file tree
Showing 23 changed files with 305 additions and 225 deletions.
72 changes: 72 additions & 0 deletions api/v1alpha2/conversion.go
Expand Up @@ -139,6 +139,78 @@ func Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(in *MachineSpec, out *
return nil
}

func Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in *ClusterStatus, out *v1alpha3.ClusterStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in, out, s); err != nil {
return err
}

// Manually convert the Error fields to the Failure fields
out.FailureMessage = in.ErrorMessage
out.FailureReason = in.ErrorReason

return nil
}

func Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in *v1alpha3.ClusterStatus, out *ClusterStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in, out, s); err != nil {
return err
}

// Manually convert the Failure fields to the Error fields
out.ErrorMessage = in.FailureMessage
out.ErrorReason = in.FailureReason

return nil
}

func Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *MachineSetStatus, out *v1alpha3.MachineSetStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in, out, s); err != nil {
return err
}

// Manually convert the Error fields to the Failure fields
out.FailureMessage = in.ErrorMessage
out.FailureReason = in.ErrorReason

return nil
}

func Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in *v1alpha3.MachineSetStatus, out *MachineSetStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in, out, s); err != nil {
return err
}

// Manually convert the Failure fields to the Error fields
out.ErrorMessage = in.FailureMessage
out.ErrorReason = in.FailureReason

return nil
}

func Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in *MachineStatus, out *v1alpha3.MachineStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in, out, s); err != nil {
return err
}

// Manually convert the Error fields to the Failure fields
out.FailureMessage = in.ErrorMessage
out.FailureReason = in.ErrorReason

return nil
}

func Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in *v1alpha3.MachineStatus, out *MachineStatus, s apiconversion.Scope) error {
if err := autoConvert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in, out, s); err != nil {
return err
}

// Manually convert the Failure fields to the Error fields
out.ErrorMessage = in.FailureMessage
out.ErrorReason = in.FailureReason

return nil
}

func Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(in *v1alpha3.MachineDeploymentSpec, out *MachineDeploymentSpec, s apiconversion.Scope) error {
return errors.New("cannot recover removed MachineDeploymentSpec Cluster Name")
}
Expand Down
85 changes: 42 additions & 43 deletions api/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions api/v1alpha3/cluster_types.go
Expand Up @@ -83,16 +83,16 @@ type ClusterStatus struct {
// +optional
APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"`

// ErrorReason indicates that there is a problem reconciling the
// FailureReason indicates that there is a fatal problem reconciling the
// state, and will be set to a token value suitable for
// programmatic interpretation.
// +optional
ErrorReason *capierrors.ClusterStatusError `json:"errorReason,omitempty"`
FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"`

// ErrorMessage indicates that there is a problem reconciling the
// FailureMessage indicates that there is a fatal problem reconciling the
// state, and will be set to a descriptive error message.
// +optional
ErrorMessage *string `json:"errorMessage,omitempty"`
FailureMessage *string `json:"failureMessage,omitempty"`

// Phase represents the current phase of cluster actuation.
// E.g. Pending, Running, Terminating, Failed etc.
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha3/machine_types.go
Expand Up @@ -95,7 +95,7 @@ type MachineStatus struct {
// +optional
Version *string `json:"version,omitempty"`

// ErrorReason will be set in the event that there is a terminal problem
// FailureReason will be set in the event that there is a terminal problem
// reconciling the Machine and will contain a succinct value suitable
// for machine interpretation.
//
Expand All @@ -112,9 +112,9 @@ type MachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"`
FailureReason *capierrors.MachineStatusError `json:"failureReason,omitempty"`

// ErrorMessage will be set in the event that there is a terminal problem
// FailureMessage will be set in the event that there is a terminal problem
// reconciling the Machine and will contain a more verbose string suitable
// for logging and human consumption.
//
Expand All @@ -131,7 +131,7 @@ type MachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
ErrorMessage *string `json:"errorMessage,omitempty"`
FailureMessage *string `json:"failureMessage,omitempty"`

// Addresses is a list of addresses assigned to the machine.
// This field is copied from the infrastructure provider reference.
Expand Down
14 changes: 7 additions & 7 deletions api/v1alpha3/machineset_types.go
Expand Up @@ -89,19 +89,19 @@ type MachineSetDeletePolicy string
const (
// RandomMachineSetDeletePolicy prioritizes both Machines that have the annotation
// "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy
// (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value).
// (Status.FailureReason or Status.FailureMessage are set to a non-empty value).
// Finally, it picks Machines at random to delete.
RandomMachineSetDeletePolicy MachineSetDeletePolicy = "Random"

// NewestMachineSetDeletePolicy prioritizes both Machines that have the annotation
// "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy
// (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value).
// (Status.FailureReason or Status.FailureMessage are set to a non-empty value).
// It then prioritizes the newest Machines for deletion based on the Machine's CreationTimestamp.
NewestMachineSetDeletePolicy MachineSetDeletePolicy = "Newest"

// OldestMachineSetDeletePolicy prioritizes both Machines that have the annotation
// "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy
// (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value).
// (Status.FailureReason or Status.FailureMessage are set to a non-empty value).
// It then prioritizes the oldest Machines for deletion based on the Machine's CreationTimestamp.
OldestMachineSetDeletePolicy MachineSetDeletePolicy = "Oldest"
)
Expand Down Expand Up @@ -136,9 +136,9 @@ type MachineSetStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// In the event that there is a terminal problem reconciling the
// replicas, both ErrorReason and ErrorMessage will be set. ErrorReason
// replicas, both FailureReason and FailureMessage will be set. FailureReason
// will be populated with a succinct value suitable for machine
// interpretation, while ErrorMessage will contain a more verbose
// interpretation, while FailureMessage will contain a more verbose
// string suitable for logging and human consumption.
//
// These fields should not be set for transitive errors that a
Expand All @@ -154,9 +154,9 @@ type MachineSetStatus struct {
// can be added as events to the MachineSet object and/or logged in the
// controller's output.
// +optional
ErrorReason *capierrors.MachineSetStatusError `json:"errorReason,omitempty"`
FailureReason *capierrors.MachineSetStatusError `json:"failureReason,omitempty"`
// +optional
ErrorMessage *string `json:"errorMessage,omitempty"`
FailureMessage *string `json:"failureMessage,omitempty"`
}

// ANCHOR_END: MachineSetStatus
Expand Down

0 comments on commit 4f52174

Please sign in to comment.