Upgrade k8s package verison (#5358)

* upgrade k8s package version

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

* Script upgrade and code formatting.

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
hongzhouzi
2022-11-15 14:56:38 +08:00
committed by GitHub
parent 5f91c1663a
commit 44167aa47a
3106 changed files with 321340 additions and 172080 deletions

View File

@@ -4,12 +4,14 @@
package kio
import (
"errors"
"os"
"path/filepath"
"strings"
"github.com/monochromegane/go-gitignore"
gitignore "github.com/monochromegane/go-gitignore"
"sigs.k8s.io/kustomize/kyaml/ext"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
// ignoreFilesMatcher handles `.krmignore` files, which allows for ignoring
@@ -32,6 +34,7 @@ import (
// is set to true
type ignoreFilesMatcher struct {
matchers []matcher
fs filesys.FileSystemOrOnDisk
}
// readIgnoreFile checks whether there is a .krmignore file in the path, and
@@ -39,9 +42,9 @@ type ignoreFilesMatcher struct {
// we just add a matcher that match nothing.
func (i *ignoreFilesMatcher) readIgnoreFile(path string) error {
i.verifyPath(path)
m, err := gitignore.NewGitIgnore(filepath.Join(path, ext.IgnoreFileName()))
f, err := i.fs.Open(filepath.Join(path, ext.IgnoreFileName()))
if err != nil {
if os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist) {
i.matchers = append(i.matchers, matcher{
matcher: gitignore.DummyIgnoreMatcher(false),
basePath: path,
@@ -50,8 +53,10 @@ func (i *ignoreFilesMatcher) readIgnoreFile(path string) error {
}
return err
}
defer f.Close()
i.matchers = append(i.matchers, matcher{
matcher: m,
matcher: gitignore.NewGitIgnoreFromReader(path, f),
basePath: path,
})
return nil