rebase: update controller-runtime package to v0.9.2

This commit updates controller-runtime to v0.9.2 and
makes changes in persistentvolume.go to add context to
various functions and function calls made here instead of
context.TODO().

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2021-06-25 10:32:01 +05:30
committed by mergify[bot]
parent 1b23d78113
commit 9eaa55506f
238 changed files with 19614 additions and 10805 deletions

26
vendor/k8s.io/utils/io/read.go generated vendored
View File

@ -30,6 +30,9 @@ var ErrLimitReached = errors.New("the read limit is reached")
// ConsistentRead repeatedly reads a file until it gets the same content twice.
// This is useful when reading files in /proc that are larger than page size
// and kernel may modify them between individual read() syscalls.
// It returns InconsistentReadError when it cannot get a consistent read in
// given nr. of attempts. Caller should retry, kernel is probably under heavy
// mount/unmount load.
func ConsistentRead(filename string, attempts int) ([]byte, error) {
return consistentReadSync(filename, attempts, nil)
}
@ -56,7 +59,28 @@ func consistentReadSync(filename string, attempts int, sync func(int)) ([]byte,
// Files are different, continue reading
oldContent = newContent
}
return nil, fmt.Errorf("could not get consistent content of %s after %d attempts", filename, attempts)
return nil, InconsistentReadError{filename, attempts}
}
// InconsistentReadError is returned from ConsistentRead when it cannot get
// a consistent read in given nr. of attempts. Caller should retry, kernel is
// probably under heavy mount/unmount load.
type InconsistentReadError struct {
filename string
attempts int
}
func (i InconsistentReadError) Error() string {
return fmt.Sprintf("could not get consistent content of %s after %d attempts", i.filename, i.attempts)
}
var _ error = InconsistentReadError{}
func IsInconsistentReadError(err error) bool {
if _, ok := err.(InconsistentReadError); ok {
return true
}
return false
}
// ReadAtMost reads up to `limit` bytes from `r`, and reports an error