Merge pull request #20261 from yifan-gu/rkt_cmd_args

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2016-01-30 09:12:25 -08:00
commit ef851cd7d1
2 changed files with 11 additions and 9 deletions

View File

@ -417,12 +417,12 @@ func setSupplementaryGIDs(app *appctypes.App, podCtx *api.PodSecurityContext) {
// setApp merges the container spec with the image's manifest.
func setApp(app *appctypes.App, c *api.Container, opts *kubecontainer.RunContainerOptions, ctx *api.SecurityContext, podCtx *api.PodSecurityContext) error {
// Override the exec.
if len(c.Command) > 0 {
app.Exec = c.Command
}
if len(c.Args) > 0 {
app.Exec = append(app.Exec, c.Args...)
// TODO(yifan): If ENTRYPOINT and CMD are both specified in the image,
// we cannot override just one of these at this point as they are already mixed.
command, args := kubecontainer.ExpandContainerCommandAndArgs(c, opts.Envs)
exec := append(command, args...)
if len(exec) > 0 {
app.Exec = exec
}
// Set UID and GIDs.

View File

@ -863,8 +863,8 @@ func TestSetApp(t *testing.T) {
// app should be changed. (env, mounts, ports, are overrided).
{
container: &api.Container{
Command: []string{"/bin/bar"},
Args: []string{"hello", "world"},
Command: []string{"/bin/bar", "$(env-foo)"},
Args: []string{"hello", "world", "$(env-bar)"},
WorkingDir: tmpDir,
Resources: api.ResourceRequirements{
Limits: api.ResourceList{"cpu": resource.MustParse("50m"), "memory": resource.MustParse("50M")},
@ -874,6 +874,7 @@ func TestSetApp(t *testing.T) {
opts: &kubecontainer.RunContainerOptions{
Envs: []kubecontainer.EnvVar{
{Name: "env-foo", Value: "foo"},
{Name: "env-bar", Value: "bar"},
},
Mounts: []kubecontainer.Mount{
{Name: "mnt-foo", ContainerPath: "/mnt-bar", ReadOnly: true},
@ -895,13 +896,14 @@ func TestSetApp(t *testing.T) {
FSGroup: &fsgid,
},
expect: &appctypes.App{
Exec: appctypes.Exec{"/bin/bar", "hello", "world"},
Exec: appctypes.Exec{"/bin/bar", "foo", "hello", "world", "bar"},
User: "42",
Group: "22",
SupplementaryGIDs: []int{1, 2, 3},
WorkingDirectory: tmpDir,
Environment: []appctypes.EnvironmentVariable{
{"env-foo", "foo"},
{"env-bar", "bar"},
},
MountPoints: []appctypes.MountPoint{
{Name: *appctypes.MustACName("mnt-foo"), Path: "/mnt-bar", ReadOnly: true},