mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: bump k8s.io/api in /api in the k8s-dependencies group
Bumps the k8s-dependencies group in /api with 1 update: [k8s.io/api](https://github.com/kubernetes/api). Updates `k8s.io/api` from 0.32.3 to 0.33.0 - [Commits](https://github.com/kubernetes/api/compare/v0.32.3...v0.33.0) --- updated-dependencies: - dependency-name: k8s.io/api dependency-version: 0.33.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: k8s-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
05e3827a4f
commit
af12c6bf1b
2
api/vendor/k8s.io/apimachinery/pkg/watch/doc.go
generated
vendored
2
api/vendor/k8s.io/apimachinery/pkg/watch/doc.go
generated
vendored
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// Package watch contains a generic watchable interface, and a fake for
|
||||
// testing code that uses the watch interface.
|
||||
package watch // import "k8s.io/apimachinery/pkg/watch"
|
||||
package watch
|
||||
|
15
api/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
15
api/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go
generated
vendored
@ -51,6 +51,7 @@ type Reporter interface {
|
||||
// StreamWatcher turns any stream for which you can write a Decoder interface
|
||||
// into a watch.Interface.
|
||||
type StreamWatcher struct {
|
||||
logger klog.Logger
|
||||
sync.Mutex
|
||||
source Decoder
|
||||
reporter Reporter
|
||||
@ -59,8 +60,16 @@ type StreamWatcher struct {
|
||||
}
|
||||
|
||||
// NewStreamWatcher creates a StreamWatcher from the given decoder.
|
||||
//
|
||||
// Contextual logging: NewStreamWatcherWithLogger should be used instead of NewStreamWatcher in code which supports contextual logging.
|
||||
func NewStreamWatcher(d Decoder, r Reporter) *StreamWatcher {
|
||||
return NewStreamWatcherWithLogger(klog.Background(), d, r)
|
||||
}
|
||||
|
||||
// NewStreamWatcherWithLogger creates a StreamWatcher from the given decoder and logger.
|
||||
func NewStreamWatcherWithLogger(logger klog.Logger, d Decoder, r Reporter) *StreamWatcher {
|
||||
sw := &StreamWatcher{
|
||||
logger: logger,
|
||||
source: d,
|
||||
reporter: r,
|
||||
// It's easy for a consumer to add buffering via an extra
|
||||
@ -98,7 +107,7 @@ func (sw *StreamWatcher) Stop() {
|
||||
|
||||
// receive reads result from the decoder in a loop and sends down the result channel.
|
||||
func (sw *StreamWatcher) receive() {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer utilruntime.HandleCrashWithLogger(sw.logger)
|
||||
defer close(sw.result)
|
||||
defer sw.Stop()
|
||||
for {
|
||||
@ -108,10 +117,10 @@ func (sw *StreamWatcher) receive() {
|
||||
case io.EOF:
|
||||
// watch closed normally
|
||||
case io.ErrUnexpectedEOF:
|
||||
klog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
|
||||
sw.logger.V(1).Info("Unexpected EOF during watch stream event decoding", "err", err)
|
||||
default:
|
||||
if net.IsProbableEOF(err) || net.IsTimeout(err) {
|
||||
klog.V(5).Infof("Unable to decode an event from the watch stream: %v", err)
|
||||
sw.logger.V(5).Info("Unable to decode an event from the watch stream", "err", err)
|
||||
} else {
|
||||
select {
|
||||
case <-sw.done:
|
||||
|
37
api/vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
37
api/vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
@ -23,6 +23,7 @@ import (
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// Interface can be implemented by anything that knows how to watch and report changes.
|
||||
@ -103,21 +104,34 @@ func (w emptyWatch) ResultChan() <-chan Event {
|
||||
|
||||
// FakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type FakeWatcher struct {
|
||||
logger klog.Logger
|
||||
result chan Event
|
||||
stopped bool
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
var _ Interface = &FakeWatcher{}
|
||||
|
||||
// Contextual logging: NewFakeWithOptions and a logger in the FakeOptions should be used instead in code which supports contextual logging.
|
||||
func NewFake() *FakeWatcher {
|
||||
return NewFakeWithOptions(FakeOptions{})
|
||||
}
|
||||
|
||||
// Contextual logging: NewFakeWithOptions and a logger in the FakeOptions should be used instead in code which supports contextual logging.
|
||||
func NewFakeWithChanSize(size int, blocking bool) *FakeWatcher {
|
||||
return NewFakeWithOptions(FakeOptions{ChannelSize: size})
|
||||
}
|
||||
|
||||
func NewFakeWithOptions(options FakeOptions) *FakeWatcher {
|
||||
return &FakeWatcher{
|
||||
result: make(chan Event),
|
||||
logger: ptr.Deref(options.Logger, klog.Background()),
|
||||
result: make(chan Event, options.ChannelSize),
|
||||
}
|
||||
}
|
||||
|
||||
func NewFakeWithChanSize(size int, blocking bool) *FakeWatcher {
|
||||
return &FakeWatcher{
|
||||
result: make(chan Event, size),
|
||||
}
|
||||
type FakeOptions struct {
|
||||
Logger *klog.Logger
|
||||
ChannelSize int
|
||||
}
|
||||
|
||||
// Stop implements Interface.Stop().
|
||||
@ -125,7 +139,7 @@ func (f *FakeWatcher) Stop() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if !f.stopped {
|
||||
klog.V(4).Infof("Stopping fake watcher.")
|
||||
f.logger.V(4).Info("Stopping fake watcher")
|
||||
close(f.result)
|
||||
f.stopped = true
|
||||
}
|
||||
@ -176,13 +190,22 @@ func (f *FakeWatcher) Action(action EventType, obj runtime.Object) {
|
||||
|
||||
// RaceFreeFakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type RaceFreeFakeWatcher struct {
|
||||
logger klog.Logger
|
||||
result chan Event
|
||||
Stopped bool
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
var _ Interface = &RaceFreeFakeWatcher{}
|
||||
|
||||
// Contextual logging: RaceFreeFakeWatcherWithLogger should be used instead of NewRaceFreeFake in code which supports contextual logging.
|
||||
func NewRaceFreeFake() *RaceFreeFakeWatcher {
|
||||
return NewRaceFreeFakeWithLogger(klog.Background())
|
||||
}
|
||||
|
||||
func NewRaceFreeFakeWithLogger(logger klog.Logger) *RaceFreeFakeWatcher {
|
||||
return &RaceFreeFakeWatcher{
|
||||
logger: logger,
|
||||
result: make(chan Event, DefaultChanSize),
|
||||
}
|
||||
}
|
||||
@ -192,7 +215,7 @@ func (f *RaceFreeFakeWatcher) Stop() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if !f.Stopped {
|
||||
klog.V(4).Infof("Stopping fake watcher.")
|
||||
f.logger.V(4).Info("Stopping fake watcher")
|
||||
close(f.result)
|
||||
f.Stopped = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user