Skip to content

Commit a82e73b

Browse files
Complete update status
1 parent 674e4b7 commit a82e73b

15 files changed

+1204
-240
lines changed

api/v1beta1/machine_types.go

+21-6
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ const (
135135
// MachineBootstrapDataSecretDataSecretUserProvidedV1Beta2Reason surfaces when a bootstrap data secret is provided by the user (without a ConfigRef).
136136
MachineBootstrapDataSecretDataSecretUserProvidedV1Beta2Reason = "DataSecretUserProvided"
137137

138-
// MachineBootstrapInvalidConfigV1Beta2Reason surfaces when MachineBootstrap doesn't have the Boostrap.ConfigRef nor a
139-
// Bootstrap.DataSecretName specified by the users.
138+
// MachineBootstrapInvalidConfigV1Beta2Reason surfaces when Machine's spec.bootstrap doesn't have configRef nor a
139+
// dataSecretName set.
140140
MachineBootstrapInvalidConfigV1Beta2Reason = "InvalidConfig"
141141

142142
// MachineBootstrapConfigInvalidConditionReportedV1Beta2Reason surfaces a BootstrapConfig Ready condition (read from a bootstrap config object) which is invalid.
@@ -146,9 +146,12 @@ const (
146146
// MachineBootstrapConfigReadyNoV1Beta2ReasonReported applies to a BootstrapConfig Ready condition (read from a bootstrap config object) that reports no reason.
147147
MachineBootstrapConfigReadyNoV1Beta2ReasonReported = NoV1Beta2ReasonReported
148148

149-
// MachineBootstrapConfigNotFoundV1Beta2Reason surfaces when a referenced bootstrap config object cannot be found.
149+
// MachineBootstrapConfigInternalErrorV1Beta2Reason surfaces unexpected failures when reading a BootstrapConfig object.
150+
MachineBootstrapConfigInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
151+
152+
// MachineBootstrapConfigDoesNotExistV1Beta2Reason surfaces when a referenced bootstrap config object does not exist.
150153
// Note: this could happen when creating the machine. However, this state should be treated as an error if it last indefinitely.
151-
MachineBootstrapConfigNotFoundV1Beta2Reason = RefObjectNotFoundV1Beta2Reason
154+
MachineBootstrapConfigDoesNotExistV1Beta2Reason = RefObjectDoesNotExistV1Beta2Reason
152155

153156
// MachineBootstrapConfigDeletedV1Beta2Reason surfaces when a referenced bootstrap config object has been deleted.
154157
// Note: controllers can't identify if the deletion process has been initiated by the controller itself, e.g.
@@ -169,9 +172,12 @@ const (
169172
// MachineInfrastructureReadyNoV1Beta2ReasonReported applies to a infrastructure Ready condition (read from an infra machine object) that reports no reason.
170173
MachineInfrastructureReadyNoV1Beta2ReasonReported = NoV1Beta2ReasonReported
171174

172-
// MachineInfrastructureNotFoundV1Beta2Reason surfaces when a referenced infrastructure object cannot be found.
175+
// MachineInfrastructureInternalErrorV1Beta2Reason surfaces unexpected failures when reading a BootstrapConfig object.
176+
MachineInfrastructureInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
177+
178+
// MachineInfrastructureDoesNotExistV1Beta2Reason surfaces when a referenced infrastructure object does not exist.
173179
// Note: this could happen when creating the machine. However, this state should be treated as an error if it last indefinitely.
174-
MachineInfrastructureNotFoundV1Beta2Reason = RefObjectNotFoundV1Beta2Reason
180+
MachineInfrastructureDoesNotExistV1Beta2Reason = RefObjectDoesNotExistV1Beta2Reason
175181

176182
// MachineInfrastructureDeletedV1Beta2Reason surfaces when a referenced infrastructure object has been deleted.
177183
// Note: controllers can't identify if the deletion process has been initiated by the controller itself, e.g.
@@ -188,6 +194,9 @@ const (
188194
// MachineNodeReadyV1Beta2Condition is true if the Machine's Node is ready.
189195
MachineNodeReadyV1Beta2Condition = "NodeReady"
190196

197+
// MachineNodeConditionNotYetReportedV1Beta2Reason surfaces when a Machine's Node doesn't have a condition reported yet.
198+
MachineNodeConditionNotYetReportedV1Beta2Reason = "NodeConditionNotYetReported"
199+
191200
// MachineNodeNotFoundV1Beta2Reason surfaces when the node hosted on the machine cannot be found.
192201
// Note: this could happen when creating the machine. However, this state should be treated as an error if it last indefinitely.
193202
MachineNodeNotFoundV1Beta2Reason = "NodeNotFound"
@@ -220,6 +229,12 @@ const (
220229
const (
221230
// MachinePausedV1Beta2Condition is true if the Machine or the Cluster it belongs to are paused.
222231
MachinePausedV1Beta2Condition = PausedV1Beta2Condition
232+
233+
// MachineNotPausedV1Beta2Reason surfaces when a Machine is not paused.
234+
MachineNotPausedV1Beta2Reason = NotPausedV1Beta2Reason
235+
236+
// MachineObjectPausedV1Beta2Reason surfaces when a Machine is paused.
237+
MachineObjectPausedV1Beta2Reason = ObjectPausedV1Beta2Reason
223238
)
224239

225240
// ANCHOR: MachineSpec

api/v1beta1/v1beta2_condition_consts.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,26 @@ const (
9595
// Note: this could happen e.g. when an external object still uses Cluster API v1beta1 Conditions.
9696
NoV1Beta2ReasonReported = "NoReasonReported"
9797

98-
// RefObjectNotFoundV1Beta2Reason surfaces when a referenced object cannot be found.
99-
RefObjectNotFoundV1Beta2Reason = "RefObjectNotFound"
98+
// InternalErrorV1Beta2Reason surfaces unexpected errors reporting by controllers.
99+
// In most cases, it will be required to look at controllers logs to proper triage those issues.
100+
InternalErrorV1Beta2Reason = "InternalError"
101+
102+
// RefObjectDoesNotExistV1Beta2Reason surfaces when a referenced object does not exist.
103+
RefObjectDoesNotExistV1Beta2Reason = "RefObjectDoesNotExist"
100104

101105
// RefObjectDeletedV1Beta2Reason surfaces when a referenced object has been deleted.
102106
// Note: controllers can't identify if the deletion process has been initiated by the controller itself, e.g.
103107
// during the deletion workflow, or by a users.
104108
RefObjectDeletedV1Beta2Reason = "RefObjectDeleted"
109+
110+
// NotPausedV1Beta2Reason surfaces when an object is not paused.
111+
NotPausedV1Beta2Reason = "NotPaused"
112+
113+
// ClusterPausedV1Beta2Reason surfaces when an Cluster is paused.
114+
ClusterPausedV1Beta2Reason = "ClusterPaused"
115+
116+
// ObjectPausedV1Beta2Reason surfaces when an object is paused.
117+
ObjectPausedV1Beta2Reason = "ObjectPaused"
105118
)
106119

107120
// Conditions that will be used for the MachineSet object in v1Beta2 API version.

internal/controllers/machine/machine_controller.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,17 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
189189
m.Spec.ClusterName, m.Name, m.Namespace)
190190
}
191191

192-
// Return early if the object or Cluster is paused.
193-
if annotations.IsPaused(cluster, m) {
194-
log.Info("Reconciliation is paused for this object")
195-
return ctrl.Result{}, nil
196-
}
197-
198192
s := &scope{
199193
cluster: cluster,
200194
machine: m,
201195
}
202196

197+
// Return early if the object or Cluster is paused.
198+
if annotations.IsPaused(cluster, m) {
199+
log.Info("Reconciliation is paused for this object")
200+
return ctrl.Result{}, setPausedCondition(ctx, r.Client, s)
201+
}
202+
203203
// Initialize the patch helper
204204
patchHelper, err := patch.NewHelper(m, r.Client)
205205
if err != nil {

0 commit comments

Comments
 (0)