@@ -246,7 +246,7 @@ func getControlPlaneComponents(podMap map[string]*v1.Pod, addressAPIServer strin
246
246
247
247
// WaitForControlPlaneComponents waits for all control plane components to report "ok".
248
248
func (w * KubeWaiter ) WaitForControlPlaneComponents (podMap map [string ]* v1.Pod , apiSeverAddress string ) error {
249
- fmt .Printf ( "[control-plane-check] Waiting for healthy control plane components." +
249
+ _ , _ = fmt .Fprintf ( w . writer , "[control-plane-check] Waiting for healthy control plane components." +
250
250
" This can take up to %v\n " , w .timeout )
251
251
252
252
components , err := getControlPlaneComponents (podMap , apiSeverAddress )
@@ -259,7 +259,7 @@ func (w *KubeWaiter) WaitForControlPlaneComponents(podMap map[string]*v1.Pod, ap
259
259
260
260
for _ , comp := range components {
261
261
url := fmt .Sprintf ("https://%s/%s" , comp .addressPort , comp .endpoint )
262
- fmt .Printf ( "[control-plane-check] Checking %s at %s\n " , comp .name , url )
262
+ _ , _ = fmt .Fprintf ( w . writer , "[control-plane-check] Checking %s at %s\n " , comp .name , url )
263
263
264
264
go func (comp controlPlaneComponent ) {
265
265
tr := & http.Transport {
@@ -305,11 +305,11 @@ func (w *KubeWaiter) WaitForControlPlaneComponents(podMap map[string]*v1.Pod, ap
305
305
return true , nil
306
306
})
307
307
if err != nil {
308
- fmt .Printf ( "[control-plane-check] %s is not healthy after %v\n " , comp .name , time .Since (start ))
308
+ _ , _ = fmt .Fprintf ( w . writer , "[control-plane-check] %s is not healthy after %v\n " , comp .name , time .Since (start ))
309
309
errChan <- lastError
310
310
return
311
311
}
312
- fmt .Printf ( "[control-plane-check] %s is healthy after %v\n " , comp .name , time .Since (start ))
312
+ _ , _ = fmt .Fprintf ( w . writer , "[control-plane-check] %s is healthy after %v\n " , comp .name , time .Since (start ))
313
313
errChan <- nil
314
314
}(comp )
315
315
}
@@ -324,7 +324,7 @@ func (w *KubeWaiter) WaitForControlPlaneComponents(podMap map[string]*v1.Pod, ap
324
324
325
325
// WaitForAPI waits for the API Server's /healthz endpoint to report "ok"
326
326
func (w * KubeWaiter ) WaitForAPI () error {
327
- fmt .Printf ( "[api-check] Waiting for a healthy API server. This can take up to %v\n " , w .timeout )
327
+ _ , _ = fmt .Fprintf ( w . writer , "[api-check] Waiting for a healthy API server. This can take up to %v\n " , w .timeout )
328
328
329
329
start := time .Now ()
330
330
err := wait .PollUntilContextTimeout (
@@ -340,11 +340,11 @@ func (w *KubeWaiter) WaitForAPI() error {
340
340
return true , nil
341
341
})
342
342
if err != nil {
343
- fmt .Printf ( "[api-check] The API server is not healthy after %v\n " , time .Since (start ))
343
+ _ , _ = fmt .Fprintf ( w . writer , "[api-check] The API server is not healthy after %v\n " , time .Since (start ))
344
344
return err
345
345
}
346
346
347
- fmt .Printf ( "[api-check] The API server is healthy after %v\n " , time .Since (start ))
347
+ _ , _ = fmt .Fprintf ( w . writer , "[api-check] The API server is healthy after %v\n " , time .Since (start ))
348
348
return nil
349
349
}
350
350
@@ -359,12 +359,12 @@ func (w *KubeWaiter) WaitForPodsWithLabel(kvLabel string) error {
359
359
listOpts := metav1.ListOptions {LabelSelector : kvLabel }
360
360
pods , err := w .client .CoreV1 ().Pods (metav1 .NamespaceSystem ).List (context .TODO (), listOpts )
361
361
if err != nil {
362
- fmt .Fprintf (w .writer , "[apiclient] Error getting Pods with label selector %q [%v]\n " , kvLabel , err )
362
+ _ , _ = fmt .Fprintf (w .writer , "[apiclient] Error getting Pods with label selector %q [%v]\n " , kvLabel , err )
363
363
return false , nil
364
364
}
365
365
366
366
if lastKnownPodNumber != len (pods .Items ) {
367
- fmt .Fprintf (w .writer , "[apiclient] Found %d Pods for label selector %s\n " , len (pods .Items ), kvLabel )
367
+ _ , _ = fmt .Fprintf (w .writer , "[apiclient] Found %d Pods for label selector %s\n " , len (pods .Items ), kvLabel )
368
368
lastKnownPodNumber = len (pods .Items )
369
369
}
370
370
@@ -391,10 +391,10 @@ func (w *KubeWaiter) WaitForKubelet(healthzAddress string, healthzPort int32) er
391
391
)
392
392
393
393
if healthzPort == 0 {
394
- fmt .Println ( "[kubelet-check] Skipping the kubelet health check because the healthz port is set to 0" )
394
+ _ , _ = fmt .Fprintln ( w . writer , "[kubelet-check] Skipping the kubelet health check because the healthz port is set to 0" )
395
395
return nil
396
396
}
397
- fmt .Printf ( "[kubelet-check] Waiting for a healthy kubelet at %s. This can take up to %v\n " ,
397
+ _ , _ = fmt .Fprintf ( w . writer , "[kubelet-check] Waiting for a healthy kubelet at %s. This can take up to %v\n " ,
398
398
healthzEndpoint , w .timeout )
399
399
400
400
formatError := func (cause string ) error {
@@ -429,11 +429,11 @@ func (w *KubeWaiter) WaitForKubelet(healthzAddress string, healthzPort int32) er
429
429
return true , nil
430
430
})
431
431
if err != nil {
432
- fmt .Printf ( "[kubelet-check] The kubelet is not healthy after %v\n " , time .Since (start ))
432
+ _ , _ = fmt .Fprintf ( w . writer , "[kubelet-check] The kubelet is not healthy after %v\n " , time .Since (start ))
433
433
return lastError
434
434
}
435
435
436
- fmt .Printf ( "[kubelet-check] The kubelet is healthy after %v\n " , time .Since (start ))
436
+ _ , _ = fmt .Fprintf ( w . writer , "[kubelet-check] The kubelet is healthy after %v\n " , time .Since (start ))
437
437
return nil
438
438
}
439
439
@@ -540,10 +540,10 @@ func PrintControlPlaneErrorHelpScreen(outputWriter io.Writer, criSocket string)
540
540
Socket : criSocket ,
541
541
}
542
542
_ = controlPlaneFailTempl .Execute (outputWriter , context )
543
- fmt .Println ( "" )
543
+ _ , _ = fmt .Fprintln ( outputWriter , "" )
544
544
}
545
545
546
546
// PrintKubeletErrorHelpScreen prints help text on kubelet errors.
547
547
func PrintKubeletErrorHelpScreen (outputWriter io.Writer ) {
548
- fmt .Fprintln (outputWriter , kubeletFailMsg )
548
+ _ , _ = fmt .Fprintln (outputWriter , kubeletFailMsg )
549
549
}
0 commit comments