mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
code review
This commit is contained in:
@@ -164,7 +164,7 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
args := []string{"run",
|
||||
"--rm", // delete the container afterward
|
||||
"-i", "-a", "STDIN", "-a", "STDOUT", "-a", "STDERR", // attach stdin, stdout, stderr
|
||||
"--network", c.ContainerSpec.Network.Name.String(),
|
||||
"--network", string(c.ContainerSpec.Network.Name),
|
||||
|
||||
// added security options
|
||||
"--user", c.User.String(),
|
||||
@@ -194,7 +194,7 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
return "docker", a
|
||||
}
|
||||
|
||||
// NewContainer returns a new container instance
|
||||
// NewContainer returns a new container filter
|
||||
func NewContainer(spec runtimeutil.ContainerSpec) Filter {
|
||||
f := Filter{ContainerSpec: spec}
|
||||
// default user is nobody
|
||||
@@ -203,7 +203,7 @@ func NewContainer(spec runtimeutil.ContainerSpec) Filter {
|
||||
}
|
||||
|
||||
// default network name is none
|
||||
if f.ContainerSpec.Network.Name.IsEmpty() {
|
||||
if f.ContainerSpec.Network.Name == "" {
|
||||
f.ContainerSpec.Network.Name = runtimeutil.NetworkNameNone
|
||||
}
|
||||
|
||||
|
||||
@@ -36,18 +36,6 @@ const (
|
||||
// ContainerNetworkName is a type for network name used in container
|
||||
type ContainerNetworkName string
|
||||
|
||||
func (n *ContainerNetworkName) String() string {
|
||||
return string(*n)
|
||||
}
|
||||
|
||||
func (n *ContainerNetworkName) IsEmpty() bool {
|
||||
return string(*n) == ""
|
||||
}
|
||||
|
||||
func (n *ContainerNetworkName) Set(s string) {
|
||||
*n = ContainerNetworkName(s)
|
||||
}
|
||||
|
||||
const (
|
||||
NetworkNameNone ContainerNetworkName = "none"
|
||||
NetworkNameEmpty ContainerNetworkName = ""
|
||||
|
||||
@@ -280,7 +280,7 @@ func (r RunFns) getFunctionFilters(global bool, fns ...*yaml.RNode) (
|
||||
// TODO(eddiezane): Provide error info about which function needs the network
|
||||
return fltrs, errors.Errorf("network required but not enabled with --network")
|
||||
}
|
||||
spec.Container.Network.Name.Set(r.NetworkName)
|
||||
spec.Container.Network.Name = runtimeutil.ContainerNetworkName(r.NetworkName)
|
||||
}
|
||||
// command line username has higher priority
|
||||
if r.User != "" {
|
||||
|
||||
Reference in New Issue
Block a user