Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 429fa54

Browse files
authoredNov 12, 2019
Fix invalid json in log caused by fmt (MISSING) (#49)
1 parent b819592 commit 429fa54

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed
 

‎pkg/controller/controller.go

+22-22
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ func (c *FrameworkController) syncFramework(key string) (returnedErr error) {
484484
defer func() {
485485
if returnedErr != nil {
486486
// returnedErr is already prefixed with logPfx
487-
klog.Warningf(returnedErr.Error())
488-
klog.Warningf(logPfx +
487+
klog.Warning(returnedErr.Error())
488+
klog.Warning(logPfx +
489489
"Failed to due to Platform Transient Error. " +
490490
"Will enqueue it again after rate limited delay")
491491
}
@@ -715,9 +715,9 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
715715
// Ensure the FrameworkSnapshot is exposed before the deletion.
716716
logSfx = ci.GetFrameworkSnapshotLogTail(f)
717717
}
718-
klog.Infof(logPfx+"Framework will be deleted due to "+
719-
"FrameworkCompletedRetainSec %v is expired"+logSfx,
720-
common.SecToDuration(c.cConfig.FrameworkCompletedRetainSec))
718+
klog.Info(logPfx + fmt.Sprintf("Framework will be deleted due to "+
719+
"FrameworkCompletedRetainSec %v is expired",
720+
common.SecToDuration(c.cConfig.FrameworkCompletedRetainSec)) + logSfx)
721721
return c.deleteFramework(f, true)
722722
}
723723

@@ -739,7 +739,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
739739
if f.Spec.ExecutionType == ci.ExecutionStop {
740740
diag = fmt.Sprintf("User has requested to stop the Framework")
741741
code = ci.CompletionCodeStopFrameworkRequested
742-
klog.Infof(logPfx + diag)
742+
klog.Info(logPfx + diag)
743743
} else {
744744
if c.enqueueFrameworkAttemptCreationTimeoutCheck(f, true) {
745745
klog.Infof(logPfx +
@@ -752,7 +752,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
752752
"so consider it was deleted and explicitly delete it",
753753
common.SecToDuration(c.cConfig.ObjectLocalCacheCreationTimeoutSec))
754754
code = ci.CompletionCodeConfigMapCreationTimeout
755-
klog.Warningf(logPfx + diag)
755+
klog.Warning(logPfx + diag)
756756
}
757757

758758
// Ensure cm is deleted in remote to avoid managed cm leak after
@@ -770,7 +770,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
770770
if f.Status.State != ci.FrameworkAttemptCreationPending {
771771
if f.Status.AttemptStatus.CompletionStatus == nil {
772772
diag := fmt.Sprintf("ConfigMap was deleted by others")
773-
klog.Warningf(logPfx + diag)
773+
klog.Warning(logPfx + diag)
774774
c.completeFrameworkAttempt(f, true,
775775
ci.CompletionCodeConfigMapExternalDeleted.
776776
NewFrameworkAttemptCompletionStatus(diag, nil))
@@ -812,7 +812,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
812812
} else {
813813
if f.Status.AttemptStatus.CompletionStatus == nil {
814814
diag := fmt.Sprintf("ConfigMap is being deleted by others")
815-
klog.Warningf(logPfx + diag)
815+
klog.Warning(logPfx + diag)
816816
f.Status.AttemptStatus.CompletionStatus =
817817
ci.CompletionCodeConfigMapExternalDeleted.
818818
NewFrameworkAttemptCompletionStatus(diag, nil)
@@ -881,7 +881,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
881881
// also expose it as one history snapshot.
882882
logSfx = ci.GetFrameworkSnapshotLogTail(f)
883883
}
884-
klog.Infof(logPfx + "Framework will be retried" + logSfx)
884+
klog.Info(logPfx + "Framework will be retried" + logSfx)
885885

886886
f.Status.RetryPolicyStatus.TotalRetriedCount++
887887
if retryDecision.IsAccountable {
@@ -907,7 +907,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
907907

908908
if f.Spec.ExecutionType == ci.ExecutionStop {
909909
diag := fmt.Sprintf("User has requested to stop the Framework")
910-
klog.Infof(logPfx + diag)
910+
klog.Info(logPfx + diag)
911911

912912
// Ensure cm is deleted in remote to avoid managed cm leak after
913913
// FrameworkAttemptCompleted.
@@ -955,7 +955,7 @@ func (c *FrameworkController) syncFrameworkState(f *ci.Framework) (err error) {
955955
if !f.IsCompleting() {
956956
if f.Spec.ExecutionType == ci.ExecutionStop {
957957
diag := fmt.Sprintf("User has requested to stop the Framework")
958-
klog.Infof(logPfx + diag)
958+
klog.Info(logPfx + diag)
959959
c.completeFrameworkAttempt(f, false,
960960
ci.CompletionCodeStopFrameworkRequested.
961961
NewFrameworkAttemptCompletionStatus(diag, nil))
@@ -1220,7 +1220,7 @@ func (c *FrameworkController) syncTaskState(
12201220
"Pod does not appear in the local cache within timeout %v, "+
12211221
"so consider it was deleted and explicitly delete it",
12221222
common.SecToDuration(c.cConfig.ObjectLocalCacheCreationTimeoutSec))
1223-
klog.Warningf(logPfx + diag)
1223+
klog.Warning(logPfx + diag)
12241224

12251225
// Ensure pod is deleted in remote to avoid managed pod leak after
12261226
// TaskAttemptCompleted.
@@ -1238,7 +1238,7 @@ func (c *FrameworkController) syncTaskState(
12381238
if taskStatus.State != ci.TaskAttemptCreationPending {
12391239
if taskStatus.AttemptStatus.CompletionStatus == nil {
12401240
diag := fmt.Sprintf("Pod was deleted by others")
1241-
klog.Warningf(logPfx + diag)
1241+
klog.Warning(logPfx + diag)
12421242
c.completeTaskAttempt(f, taskRoleName, taskIndex, true,
12431243
ci.CompletionCodePodExternalDeleted.
12441244
NewTaskAttemptCompletionStatus(diag, nil))
@@ -1304,15 +1304,15 @@ func (c *FrameworkController) syncTaskState(
13041304
return nil
13051305
} else if pod.Status.Phase == core.PodSucceeded {
13061306
diag := fmt.Sprintf("Pod succeeded")
1307-
klog.Infof(logPfx + diag)
1307+
klog.Info(logPfx + diag)
13081308
c.completeTaskAttempt(f, taskRoleName, taskIndex, false,
13091309
ci.CompletionCodeSucceeded.NewTaskAttemptCompletionStatus(
13101310
diag, ci.ExtractPodCompletionStatus(pod)))
13111311
return nil
13121312
} else if pod.Status.Phase == core.PodFailed {
13131313
result := ci.MatchCompletionCodeInfos(pod)
13141314
diag := fmt.Sprintf("Pod failed: %v", result.Diagnostics)
1315-
klog.Infof(logPfx + diag)
1315+
klog.Info(logPfx + diag)
13161316
c.completeTaskAttempt(f, taskRoleName, taskIndex, false,
13171317
&ci.TaskAttemptCompletionStatus{
13181318
CompletionStatus: &ci.CompletionStatus{
@@ -1332,7 +1332,7 @@ func (c *FrameworkController) syncTaskState(
13321332
} else {
13331333
if taskStatus.AttemptStatus.CompletionStatus == nil {
13341334
diag := fmt.Sprintf("Pod is being deleted by others")
1335-
klog.Warningf(logPfx + diag)
1335+
klog.Warning(logPfx + diag)
13361336
taskStatus.AttemptStatus.CompletionStatus =
13371337
ci.CompletionCodePodExternalDeleted.
13381338
NewTaskAttemptCompletionStatus(diag, nil)
@@ -1387,7 +1387,7 @@ func (c *FrameworkController) syncTaskState(
13871387
// expose it as one history snapshot.
13881388
logSfx = ci.GetFrameworkSnapshotLogTail(f)
13891389
}
1390-
klog.Infof(logPfx + "Task will be retried" + logSfx)
1390+
klog.Info(logPfx + "Task will be retried" + logSfx)
13911391

13921392
taskStatus.RetryPolicyStatus.TotalRetriedCount++
13931393
if retryDecision.IsAccountable {
@@ -1416,7 +1416,7 @@ func (c *FrameworkController) syncTaskState(
14161416
if apiErrors.IsInvalid(apiErr) {
14171417
// Should be Framework Error instead of Platform Transient Error.
14181418
diag := fmt.Sprintf("%v", apiErr)
1419-
klog.Infof(logPfx + diag)
1419+
klog.Info(logPfx + diag)
14201420

14211421
// Ensure pod is deleted in remote to avoid managed pod leak after
14221422
// TaskAttemptCompleted.
@@ -1471,7 +1471,7 @@ func (c *FrameworkController) syncTaskState(
14711471
msg := fmt.Sprintf(
14721472
"FailedTaskCount %v has reached MinFailedTaskCount %v in the TaskRole",
14731473
failedTaskCount, minFailedTaskCount)
1474-
klog.Infof(logPfx + msg)
1474+
klog.Info(logPfx + msg)
14751475
c.completeFrameworkAttempt(f, false,
14761476
&ci.FrameworkAttemptCompletionStatus{
14771477
CompletionStatus: taskStatus.AttemptStatus.CompletionStatus.CompletionStatus,
@@ -1492,7 +1492,7 @@ func (c *FrameworkController) syncTaskState(
14921492
msg := fmt.Sprintf(
14931493
"SucceededTaskCount %v has reached MinSucceededTaskCount %v in the TaskRole",
14941494
succeededTaskCount, minSucceededTaskCount)
1495-
klog.Infof(logPfx + msg)
1495+
klog.Info(logPfx + msg)
14961496
c.completeFrameworkAttempt(f, false,
14971497
ci.CompletionCodeSucceeded.NewFrameworkAttemptCompletionStatus(
14981498
taskStatus.AttemptStatus.CompletionStatus.Diagnostics,
@@ -1515,7 +1515,7 @@ func (c *FrameworkController) syncTaskState(
15151515
"FrameworkAttemptCompletionPolicy have ever been triggered: "+
15161516
"TotalTaskCount: %v, FailedTaskCount: %v",
15171517
totalTaskCount, failedTaskCount)
1518-
klog.Infof(logPfx + msg)
1518+
klog.Info(logPfx + msg)
15191519
c.completeFrameworkAttempt(f, false,
15201520
ci.CompletionCodeSucceeded.NewFrameworkAttemptCompletionStatus(
15211521
taskStatus.AttemptStatus.CompletionStatus.Diagnostics,

0 commit comments

Comments
 (0)
Failed to load comments.