server/container_create: Simplify command/args join
The old code was needlessly splitting either kubeCommands or kubeArgs into [0] and [1:]. The new code doesn't bother with that. From [1,2], all we need to do is append kubeArgs to kubeCommands, and we can do that in one line. [1]: https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact [2]: https://github.com/opencontainers/image-spec/blob/v1.0.1/conversion.md#verbatim-fields Signed-off-by: W. Trevor King <wking@tremily.us>
This commit is contained in:
parent
cff96ecf5c
commit
c93ca853f3
1 changed files with 1 additions and 12 deletions
|
@ -399,18 +399,7 @@ func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, ociConfig *v1.
|
||||||
return nil, fmt.Errorf("no command specified")
|
return nil, fmt.Errorf("no command specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
// create entrypoint and args
|
processArgs := append(kubeCommands, kubeArgs...)
|
||||||
var entrypoint string
|
|
||||||
var args []string
|
|
||||||
if len(kubeCommands) != 0 {
|
|
||||||
entrypoint = kubeCommands[0]
|
|
||||||
args = append(kubeCommands[1:], kubeArgs...)
|
|
||||||
} else {
|
|
||||||
entrypoint = kubeArgs[0]
|
|
||||||
args = kubeArgs[1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
processArgs := append([]string{entrypoint}, args...)
|
|
||||||
|
|
||||||
logrus.Debugf("OCI process args %v", processArgs)
|
logrus.Debugf("OCI process args %v", processArgs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue