Skip to content

Commit d3d9de5

Browse files
committed
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 <[email protected]>
1 parent a4cd5e3 commit d3d9de5

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

server/container_create.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,7 @@ func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, ociConfig *v1.
399399
return nil, fmt.Errorf("no command specified")
400400
}
401401

402-
// create entrypoint and args
403-
var entrypoint string
404-
var args []string
405-
if len(kubeCommands) != 0 {
406-
entrypoint = kubeCommands[0]
407-
args = append(kubeCommands[1:], kubeArgs...)
408-
} else {
409-
entrypoint = kubeArgs[0]
410-
args = kubeArgs[1:]
411-
}
412-
413-
processArgs := append([]string{entrypoint}, args...)
402+
processArgs := append(kubeCommands, kubeArgs...)
414403

415404
logrus.Debugf("OCI process args %v", processArgs)
416405

0 commit comments

Comments
 (0)