update dependencies (#6267)

Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
hongming
2024-11-06 10:27:06 +08:00
committed by GitHub
parent faf255a084
commit cfebd96a1f
4263 changed files with 341374 additions and 132036 deletions

View File

@@ -21,29 +21,40 @@ import (
)
// NewSimpleFakeResourceFinder builds a super simple ResourceFinder that just iterates over the objects you provided
func NewSimpleFakeResourceFinder(infos ...*resource.Info) ResourceFinder {
return &fakeResourceFinder{
func NewSimpleFakeResourceFinder(infos ...*resource.Info) *FakeResourceFinder {
return &FakeResourceFinder{
Infos: infos,
}
}
type fakeResourceFinder struct {
func (f *FakeResourceFinder) WithError(err error) *FakeResourceFinder {
f.err = err
return f
}
type FakeResourceFinder struct {
Infos []*resource.Info
err error
}
// Do implements the interface
func (f *fakeResourceFinder) Do() resource.Visitor {
func (f *FakeResourceFinder) Do() resource.Visitor {
return &fakeResourceResult{
Infos: f.Infos,
err: f.err,
}
}
type fakeResourceResult struct {
Infos []*resource.Info
err error
}
// Visit just iterates over info
func (r *fakeResourceResult) Visit(fn resource.VisitorFunc) error {
if r.err != nil {
return r.err
}
for _, info := range r.Infos {
err := fn(info, nil)
if err != nil {

View File

@@ -21,9 +21,9 @@ import (
"path/filepath"
"strings"
jsonpatch "github.com/evanphx/json-patch"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
jsonpatch "gopkg.in/evanphx/json-patch.v4"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"

View File

@@ -66,7 +66,7 @@ func (m *mapper) infoForData(data []byte, source string) (*Info, error) {
mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
if _, ok := err.(*meta.NoKindMatchError); ok {
return nil, fmt.Errorf("resource mapping not found for name: %q namespace: %q from %q: %v\nensure CRDs are installed first",
return nil, fmt.Errorf("resource mapping not found for name: %q namespace: %q from %q: %w\nensure CRDs are installed first",
name, namespace, source, err)
}
return nil, fmt.Errorf("unable to recognize %q: %v", source, err)