Skip to content

Commit

Permalink
Move conflict messaged to Debug Logging
Browse files Browse the repository at this point in the history
Conflicts when attempting to update Kubernetes resources is expected and
will happen frequently in Agones.

Currently they are reported as errors, and (a) produce a lot of noise,
and (b) are reported as errors, which can often be seen as potential
issues by end users, as well as red-herring reasons for actual issues.

We may want to wait until googleforgames#1220 is complete before merging.

Will help with issues also raised in googleforgames#1218.
  • Loading branch information
markmandel committed Dec 13, 2019
1 parent eac79fa commit a16bf28
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/util/workerqueue/workerqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"agones.dev/agones/pkg/util/runtime"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
k8serror "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
Expand Down Expand Up @@ -150,8 +151,14 @@ func (wq *WorkerQueue) processNextWorkItem() bool {
}

if err := wq.SyncHandler(key); err != nil {
// Conflicts are expected, so only show them in debug operations.
if k8serror.IsConflict(err) {
wq.logger.WithField(wq.keyName, obj).Debug(err)
} else {
runtime.HandleError(wq.logger.WithField(wq.keyName, obj), err)
}

// we don't forget here, because we want this to be retried via the queue
runtime.HandleError(wq.logger.WithField(wq.keyName, obj), err)
wq.queue.AddRateLimited(obj)
return true
}
Expand Down

0 comments on commit a16bf28

Please sign in to comment.