dependencies: bump k8s.io/utils

This includes a fix for a race condition.
This commit is contained in:
Patrick Ohly
2023-04-06 13:11:47 +02:00
parent f70c26d495
commit 83fb5a50bc
62 changed files with 110 additions and 91 deletions

19
vendor/k8s.io/utils/trace/trace.go generated vendored
View File

@@ -65,6 +65,11 @@ func durationToMilliseconds(timeDuration time.Duration) int64 {
}
type traceItem interface {
// rLock must be called before invoking time or writeItem.
rLock()
// rUnlock must be called after processing the item is complete.
rUnlock()
// time returns when the trace was recorded as completed.
time() time.Time
// writeItem outputs the traceItem to the buffer. If stepThreshold is non-nil, only output the
@@ -79,6 +84,10 @@ type traceStep struct {
fields []Field
}
// rLock doesn't need to do anything because traceStep instances are immutable.
func (s traceStep) rLock() {}
func (s traceStep) rUnlock() {}
func (s traceStep) time() time.Time {
return s.stepTime
}
@@ -106,6 +115,14 @@ type Trace struct {
traceItems []traceItem
}
func (t *Trace) rLock() {
t.lock.RLock()
}
func (t *Trace) rUnlock() {
t.lock.RUnlock()
}
func (t *Trace) time() time.Time {
if t.endTime != nil {
return *t.endTime
@@ -231,8 +248,10 @@ func (t *Trace) logTrace() {
func (t *Trace) writeTraceSteps(b *bytes.Buffer, formatter string, stepThreshold *time.Duration) {
lastStepTime := t.startTime
for _, stepOrTrace := range t.traceItems {
stepOrTrace.rLock()
stepOrTrace.writeItem(b, formatter, lastStepTime, stepThreshold)
lastStepTime = stepOrTrace.time()
stepOrTrace.rUnlock()
}
}

2
vendor/modules.txt vendored
View File

@@ -2358,7 +2358,7 @@ k8s.io/sample-apiserver/pkg/registry/wardle/flunder
# k8s.io/system-validators v1.8.0
## explicit; go 1.16
k8s.io/system-validators/validators
# k8s.io/utils v0.0.0-20230313181309-38a27ef9d749
# k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
## explicit; go 1.18
k8s.io/utils/buffer
k8s.io/utils/clock