I broke out the error retry logic into a named function that could be
tested independently of the rest of the event processing framework. This
allows the test to know when the retry logic is done.
The problem with the original test was there was no reliable way to know
when it was done trying record an event. A sentinal event was being
used, but there is no ordering guarantee. I could have added
synchronization around attempts tracking to fix the data race, but the
test case was still fundamentally flawed and would error occasionally.
When the server rejects an event because it has already been created, log it
at a very high level (debug) instead of the default level. Duplicate events
typically only occur due to programmer error or failure conditions, so they
can safely be ignored in production environments.
Updating may fail because the item was removed from apiserver. This
patch makes sure to retry using creation instead of update.
Fixes#6289
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Dependency chain is now api -> api/rest -> apiserver. Makes the
interfaces much cleaner to read, and cleans up some inconsistenties
that crept in along the way.
# *** ERROR: *** Some API files are missing the required field descriptions
# Add description tags to all non-inline fields in the following files:
# pkg/api/v1beta1/types.go
# pkg/api/v1beta2/types.go
#
# Your commit will be aborted unless you fix these.
# COMMIT_BLOCKED_ON_DESCRIPTION
# *** ERROR: *** Some files have not been gofmt'd. To fix these
# errors, run gofmt -s -w <file>, or cut and paste the following:
# gofmt -s -w pkg/kubecfg/resource_printer.go pkg/proxy/config/config.go pkg/runtime/types.go
#
# Your commit will be aborted unless you override this warning. To
# commit in spite of these format errors, delete the following line:
# COMMIT_BLOCKED_ON_GOFMT
(1) less likely to drop events if the master is unavailable
(2) less likely to have goroutines block while trying to record an
event.
Done as part of #3163 to ensure that minions operate well even while the
master is down.