Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/v1alpha3/gcpmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type GCPMachineStatus struct {
// +optional
InstanceStatus *InstanceStatus `json:"instanceState,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 @@ -116,9 +116,9 @@ type GCPMachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
ErrorReason *errors.MachineStatusError `json:"errorReason,omitempty"`
FailureReason *errors.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 @@ -135,7 +135,7 @@ type GCPMachineStatus 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"`
}

// +kubebuilder:object:root=true
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha3/zz_generated.deepcopy.go

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

12 changes: 6 additions & 6 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ func (m *MachineScope) SetReady() {
m.GCPMachine.Status.Ready = true
}

// SetErrorMessage sets the GCPMachine status error message.
func (m *MachineScope) SetErrorMessage(v error) {
m.GCPMachine.Status.ErrorMessage = pointer.StringPtr(v.Error())
// SetFailureMessage sets the GCPMachine status failure message.
func (m *MachineScope) SetFailureMessage(v error) {
m.GCPMachine.Status.FailureMessage = pointer.StringPtr(v.Error())
}

// SetErrorReason sets the GCPMachine status error reason.
func (m *MachineScope) SetErrorReason(v capierrors.MachineStatusError) {
m.GCPMachine.Status.ErrorReason = &v
// SetFailureReason sets the GCPMachine status failure reason.
func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {
m.GCPMachine.Status.FailureReason = &v
}

// SetAnnotation sets a key value annotation on the GCPMachine.
Expand Down
40 changes: 20 additions & 20 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,27 @@ spec:
- type
type: object
type: array
errorMessage:
description: "ErrorMessage 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. \n This field should
not be set for transitive errors that a controller faces that are
expected to be fixed automatically over time (like service outages),
but instead indicate that something is fundamentally wrong with the
Machine's spec or the configuration of the controller, and that manual
intervention is required. Examples of terminal errors would be invalid
combinations of settings in the spec, values that are unsupported
by the controller, or the responsible controller itself being critically
misconfigured. \n Any transient errors that occur during the reconciliation
of Machines can be added as events to the Machine object and/or logged
in the controller's output."
failureMessage:
description: "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. \n This
field should not be set for transitive errors that a controller faces
that are expected to be fixed automatically over time (like service
outages), but instead indicate that something is fundamentally wrong
with the Machine's spec or the configuration of the controller, and
that manual intervention is required. Examples of terminal errors
would be invalid combinations of settings in the spec, values that
are unsupported by the controller, or the responsible controller itself
being critically misconfigured. \n Any transient errors that occur
during the reconciliation of Machines can be added as events to the
Machine object and/or logged in the controller's output."
type: string
errorReason:
description: "ErrorReason 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. \n This field should not be set
for transitive errors that a controller faces that are expected to
be fixed automatically over time (like service outages), but instead
failureReason:
description: "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. \n This field should not
be set for transitive errors that a controller faces that are expected
to be fixed automatically over time (like service outages), but instead
indicate that something is fundamentally wrong with the Machine's
spec or the configuration of the controller, and that manual intervention
is required. Examples of terminal errors would be invalid combinations
Expand Down
12 changes: 6 additions & 6 deletions controllers/gcpmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (r *GCPMachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, reter
func (r *GCPMachineReconciler) reconcile(ctx context.Context, machineScope *scope.MachineScope, clusterScope *scope.ClusterScope) (reconcile.Result, error) {
machineScope.Info("Reconciling GCPMachine")
// If the GCPMachine is in an error state, return early.
if machineScope.GCPMachine.Status.ErrorReason != nil || machineScope.GCPMachine.Status.ErrorMessage != nil {
if machineScope.GCPMachine.Status.FailureReason != nil || machineScope.GCPMachine.Status.FailureMessage != nil {
machineScope.Info("Error state detected, skipping reconciliation")
return reconcile.Result{}, nil
}
Expand Down Expand Up @@ -195,10 +195,10 @@ func (r *GCPMachineReconciler) reconcile(ctx context.Context, machineScope *scop
return reconcile.Result{}, err
}

// Set an error message if we couldn't find the instance.
// Set a failure message if we couldn't find the instance.
if instance == nil {
machineScope.SetErrorReason(capierrors.UpdateMachineError)
machineScope.SetErrorMessage(errors.New("GCE instance cannot be found"))
machineScope.SetFailureReason(capierrors.UpdateMachineError)
machineScope.SetFailureMessage(errors.New("GCE instance cannot be found"))
return reconcile.Result{}, nil
}

Expand Down Expand Up @@ -232,8 +232,8 @@ func (r *GCPMachineReconciler) reconcile(ctx context.Context, machineScope *scop
case infrav1.InstanceStatusProvisioning, infrav1.InstanceStatusStaging:
machineScope.Info("Machine instance is pending", "instance-id", *machineScope.GetInstanceID())
default:
machineScope.SetErrorReason(capierrors.UpdateMachineError)
machineScope.SetErrorMessage(errors.Errorf("GCE instance state %q is unexpected", instance.Status))
machineScope.SetFailureReason(capierrors.UpdateMachineError)
machineScope.SetFailureMessage(errors.Errorf("GCE instance state %q is unexpected", instance.Status))
}

if err := r.reconcileLBAttachment(machineScope, clusterScope, instance); err != nil {
Expand Down
1 change: 1 addition & 0 deletions examples/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ echo "Generated ${MACHINEDEPLOYMENT_GENERATED_FILE}"
# Generate Cluster API provider components file.
CAPI_BRANCH=${CAPI_BRANCH:-"master"}
if [[ ${CAPI_BRANCH} == "stable" ]]; then
# TODO: Fix the version once the first v0.3.x is released.
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.2.7/cluster-api-components.yaml > "${COMPONENTS_CLUSTER_API_GENERATED_FILE}"
echo "Downloaded ${COMPONENTS_CLUSTER_API_GENERATED_FILE} from cluster-api stable branch - v0.2.7"
else
Expand Down