@@ -102,7 +102,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
102
102
cluster , err := util .GetOwnerCluster (ctx , r .Client , tcp .ObjectMeta )
103
103
if err != nil {
104
104
if ! apierrors .IsNotFound (err ) {
105
- logger .Error (err , "Failed to retrieve owner Cluster from the API Server" )
105
+ logger .Error (err , "failed to retrieve owner Cluster from the API Server" )
106
106
107
107
return ctrl.Result {}, err
108
108
}
@@ -111,27 +111,27 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
111
111
}
112
112
113
113
if cluster == nil {
114
- logger .Info ("Cluster Controller has not yet set OwnerRef" )
114
+ logger .Info ("cluster Controller has not yet set OwnerRef" )
115
115
return ctrl.Result {Requeue : true }, nil
116
116
}
117
117
logger = logger .WithValues ("cluster" , cluster .Name )
118
118
119
119
if annotations .IsPaused (cluster , tcp ) {
120
- logger .Info ("Reconciliation is paused for this object" )
120
+ logger .Info ("reconciliation is paused for this object" )
121
121
return ctrl.Result {Requeue : true }, nil
122
122
}
123
123
124
124
// Wait for the cluster infrastructure to be ready before creating machines
125
125
if ! cluster .Status .InfrastructureReady {
126
- logger .Info ("Cluster infra not ready" )
126
+ logger .Info ("cluster infra not ready" )
127
127
128
128
return ctrl.Result {Requeue : true }, nil
129
129
}
130
130
131
131
// Initialize the patch helper.
132
132
patchHelper , err := patch .NewHelper (tcp , r .Client )
133
133
if err != nil {
134
- logger .Error (err , "Failed to configure the patch helper" )
134
+ logger .Error (err , "failed to configure the patch helper" )
135
135
return ctrl.Result {Requeue : true }, nil
136
136
}
137
137
@@ -143,7 +143,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
143
143
// because the main defer may take too much time to get cluster status
144
144
145
145
if err := patchTalosControlPlane (ctx , patchHelper , tcp , patch.WithStatusObservedGeneration {}); err != nil {
146
- logger .Error (err , "Failed to add finalizer to TalosControlPlane" )
146
+ logger .Error (err , "failed to add finalizer to TalosControlPlane" )
147
147
return ctrl.Result {}, err
148
148
}
149
149
@@ -158,18 +158,18 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
158
158
}
159
159
160
160
defer func () {
161
- r .Log .Info ("Attempting to set control plane status" )
161
+ r .Log .Info ("attempting to set control plane status" )
162
162
163
163
// Always attempt to update status.
164
164
if err := r .updateStatus (ctx , tcp , cluster ); err != nil {
165
- logger .Error (err , "Failed to update TalosControlPlane Status" )
165
+ logger .Error (err , "failed to update TalosControlPlane Status" )
166
166
167
167
reterr = kerrors .NewAggregate ([]error {reterr , err })
168
168
}
169
169
170
170
// Always attempt to Patch the TalosControlPlane object and status after each reconciliation.
171
171
if err := patchTalosControlPlane (ctx , patchHelper , tcp , patch.WithStatusObservedGeneration {}); err != nil {
172
- logger .Error (err , "Failed to patch TalosControlPlane" )
172
+ logger .Error (err , "failed to patch TalosControlPlane" )
173
173
reterr = kerrors .NewAggregate ([]error {reterr , err })
174
174
}
175
175
@@ -182,7 +182,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
182
182
}
183
183
}
184
184
185
- r .Log .Info ("Successfully updated control plane status" )
185
+ r .Log .Info ("successfully updated control plane status" )
186
186
}()
187
187
188
188
// Update ownerrefs on infra templates
@@ -192,7 +192,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
192
192
193
193
// If ControlPlaneEndpoint is not set, return early
194
194
if cluster .Spec .ControlPlaneEndpoint .IsZero () {
195
- logger .Info ("Cluster does not yet have a ControlPlaneEndpoint defined" )
195
+ logger .Info ("cluster does not yet have a ControlPlaneEndpoint defined" )
196
196
return ctrl.Result {}, nil
197
197
}
198
198
@@ -251,7 +251,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
251
251
// We are creating the first replica
252
252
case numMachines < desiredReplicas && numMachines == 0 :
253
253
// Create new Machine w/ init
254
- logger .Info ("Initializing control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
254
+ logger .Info ("initializing control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
255
255
256
256
return r .bootControlPlane (ctx , cluster , tcp , controlPlane , true )
257
257
// We are scaling up
@@ -261,7 +261,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
261
261
desiredReplicas , numMachines )
262
262
263
263
// Create a new Machine w/ join
264
- logger .Info ("Scaling up control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
264
+ logger .Info ("scaling up control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
265
265
266
266
return r .bootControlPlane (ctx , cluster , tcp , controlPlane , false )
267
267
// We are scaling down
@@ -279,23 +279,23 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
279
279
}
280
280
281
281
if err := r .ensureNodesBooted (ctx , cluster , ownedMachines ); err != nil {
282
- logger .Info ("Waiting for all nodes to finish boot sequence" , "error" , err )
282
+ logger .Info ("waiting for all nodes to finish boot sequence" , "error" , err )
283
283
284
284
return ctrl.Result {RequeueAfter : 10 * time .Second }, nil
285
285
}
286
286
287
287
if ! conditions .IsTrue (tcp , controlplanev1 .EtcdClusterHealthyCondition ) {
288
- logger .Info ("Waiting for etcd to become healthy before scaling down" )
288
+ logger .Info ("waiting for etcd to become healthy before scaling down" )
289
289
290
290
return ctrl.Result {RequeueAfter : 10 * time .Second }, nil
291
291
}
292
292
293
- logger .Info ("Scaling down control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
293
+ logger .Info ("scaling down control plane" , "Desired" , desiredReplicas , "Existing" , numMachines )
294
294
295
295
res , err = r .scaleDownControlPlane (ctx , util .ObjectKey (cluster ), controlPlane .TCP .Name , ownedMachines )
296
296
if err != nil {
297
297
if res .Requeue || res .RequeueAfter > 0 {
298
- logger .Info ("Failed to scale down control plane" , "error" , err )
298
+ logger .Info ("failed to scale down control plane" , "error" , err )
299
299
300
300
return res , nil
301
301
}
@@ -307,7 +307,9 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
307
307
if err := r .bootstrapCluster (ctx , cluster , ownedMachines ); err != nil {
308
308
conditions .MarkFalse (tcp , controlplanev1 .MachinesBootstrapped , controlplanev1 .WaitingForTalosBootReason , clusterv1 .ConditionSeverityInfo , err .Error ())
309
309
310
- return ctrl.Result {}, err
310
+ logger .Info ("bootstrap failed, retrying in 20 seconds" , "error" , err )
311
+
312
+ return ctrl.Result {RequeueAfter : time .Second * 20 }, nil
311
313
}
312
314
313
315
conditions .MarkTrue (tcp , controlplanev1 .MachinesBootstrapped )
@@ -336,7 +338,7 @@ func (r *TalosControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Re
336
338
func (r * TalosControlPlaneReconciler ) ClusterToTalosControlPlane (o client.Object ) []ctrl.Request {
337
339
c , ok := o .(* clusterv1.Cluster )
338
340
if ! ok {
339
- r .Log .Error (nil , fmt .Sprintf ("Expected a Cluster but got a %T" , o ))
341
+ r .Log .Error (nil , fmt .Sprintf ("expected a Cluster but got a %T" , o ))
340
342
return nil
341
343
}
342
344
@@ -352,7 +354,7 @@ func (r *TalosControlPlaneReconciler) reconcileDelete(ctx context.Context, clust
352
354
// Get list of all control plane machines
353
355
ownedMachines , err := r .getControlPlaneMachinesForCluster (ctx , util .ObjectKey (cluster ), tcp .Name )
354
356
if err != nil {
355
- r .Log .Error (err , "Failed to retrieve control plane machines for cluster" )
357
+ r .Log .Error (err , "failed to retrieve control plane machines for cluster" )
356
358
357
359
return ctrl.Result {}, err
358
360
}
@@ -370,7 +372,7 @@ func (r *TalosControlPlaneReconciler) reconcileDelete(ctx context.Context, clust
370
372
}
371
373
// Submit deletion request
372
374
if err := r .Client .Delete (ctx , & ownedMachine ); err != nil && ! apierrors .IsNotFound (err ) {
373
- r .Log .Error (err , "Failed to cleanup owned machine" )
375
+ r .Log .Error (err , "failed to cleanup owned machine" )
374
376
return ctrl.Result {}, err
375
377
}
376
378
}
@@ -822,7 +824,7 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con
822
824
conditions .MarkTrue (tcp , controlplanev1 .AvailableCondition )
823
825
}
824
826
} else {
825
- r .Log .Error (err , "Failed attempt to contact workload cluster" )
827
+ r .Log .Error (err , "failed attempt to contact workload cluster" )
826
828
}
827
829
828
830
conditions .SetAggregate (tcp , controlplanev1 .MachinesReadyCondition , conditionGetters , conditions .AddSourceRef (), conditions .WithStepCounterIf (false ))
0 commit comments