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:
28
vendor/sigs.k8s.io/kustomize/kyaml/fn/runtime/container/container.go
generated
vendored
28
vendor/sigs.k8s.io/kustomize/kyaml/fn/runtime/container/container.go
generated
vendored
@@ -5,10 +5,12 @@ package container
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
runtimeexec "sigs.k8s.io/kustomize/kyaml/fn/runtime/exec"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/runtime/runtimeutil"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
|
||||
@@ -139,19 +141,30 @@ func (c Filter) GetExit() error {
|
||||
}
|
||||
|
||||
func (c *Filter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
c.setupExec()
|
||||
if err := c.setupExec(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Exec.Filter(nodes)
|
||||
}
|
||||
|
||||
func (c *Filter) setupExec() {
|
||||
func (c *Filter) setupExec() error {
|
||||
// don't init 2x
|
||||
if c.Exec.Path != "" {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.Exec.WorkingDir == "" {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
c.Exec.WorkingDir = wd
|
||||
}
|
||||
|
||||
path, args := c.getCommand()
|
||||
c.Exec.Path = path
|
||||
c.Exec.Args = args
|
||||
return nil
|
||||
}
|
||||
|
||||
// getArgs returns the command + args to run to spawn the container
|
||||
@@ -174,13 +187,16 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
// note: don't make fs readonly because things like heredoc rely on writing tmp files
|
||||
}
|
||||
|
||||
// TODO(joncwong): Allow StorageMount fields to have default values.
|
||||
for _, storageMount := range c.StorageMounts {
|
||||
// convert declarative relative paths to absolute (otherwise docker will throw an error)
|
||||
if !filepath.IsAbs(storageMount.Src) {
|
||||
storageMount.Src = filepath.Join(c.Exec.WorkingDir, storageMount.Src)
|
||||
}
|
||||
args = append(args, "--mount", storageMount.String())
|
||||
}
|
||||
|
||||
args = append(args, runtimeutil.NewContainerEnvFromStringSlice(c.Env).GetDockerFlags()...)
|
||||
a := append(args, c.Image)
|
||||
a := append(args, c.Image) //nolint:gocritic
|
||||
return "docker", a
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user