feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
28
vendor/k8s.io/cli-runtime/pkg/resource/visitor.go
generated
vendored
28
vendor/k8s.io/cli-runtime/pkg/resource/visitor.go
generated
vendored
@@ -28,6 +28,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/text/encoding/unicode"
|
||||
"golang.org/x/text/transform"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -201,6 +202,33 @@ func (l VisitorList) Visit(fn VisitorFunc) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ConcurrentVisitorList struct {
|
||||
visitors []Visitor
|
||||
concurrency int
|
||||
}
|
||||
|
||||
func (l ConcurrentVisitorList) Visit(fn VisitorFunc) error {
|
||||
g := errgroup.Group{}
|
||||
|
||||
// Concurrency 1 just runs the visitors sequentially, this is the default
|
||||
// as it preserves the previous behavior, but allows components to opt into
|
||||
// concurrency.
|
||||
concurrency := 1
|
||||
if l.concurrency > concurrency {
|
||||
concurrency = l.concurrency
|
||||
}
|
||||
g.SetLimit(concurrency)
|
||||
|
||||
for i := range l.visitors {
|
||||
i := i
|
||||
g.Go(func() error {
|
||||
return l.visitors[i].Visit(fn)
|
||||
})
|
||||
}
|
||||
|
||||
return g.Wait()
|
||||
}
|
||||
|
||||
// EagerVisitorList implements Visit for the sub visitors it contains. All errors
|
||||
// will be captured and returned at the end of iteration.
|
||||
type EagerVisitorList []Visitor
|
||||
|
||||
Reference in New Issue
Block a user