Merge pull request #1114 from mrunalp/env_fix_1.8
Add HOSTNAME env var to container
This commit is contained in:
commit
19d90e7c23
3 changed files with 27 additions and 2 deletions
|
@ -47,8 +47,6 @@ jobs:
|
||||||
go: 1.9.x
|
go: 1.9.x
|
||||||
- script:
|
- script:
|
||||||
- make .gitvalidation
|
- make .gitvalidation
|
||||||
- make gofmt
|
|
||||||
- make lint
|
|
||||||
- make testunit
|
- make testunit
|
||||||
- make docs
|
- make docs
|
||||||
- make
|
- make
|
||||||
|
|
|
@ -1013,7 +1013,9 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
||||||
specgen.AddBindMount("/etc/hosts", "/etc/hosts", options)
|
specgen.AddBindMount("/etc/hosts", "/etc/hosts", options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set hostname and add env for hostname
|
||||||
specgen.SetHostname(sb.Hostname())
|
specgen.SetHostname(sb.Hostname())
|
||||||
|
specgen.AddProcessEnv("HOSTNAME", sb.Hostname())
|
||||||
|
|
||||||
specgen.AddAnnotation(annotations.Name, containerName)
|
specgen.AddAnnotation(annotations.Name, containerName)
|
||||||
specgen.AddAnnotation(annotations.ContainerID, containerID)
|
specgen.AddAnnotation(annotations.ContainerID, containerID)
|
||||||
|
|
|
@ -600,6 +600,31 @@ function teardown() {
|
||||||
stop_crio
|
stop_crio
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "ctr hostname env" {
|
||||||
|
start_crio
|
||||||
|
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
pod_id="$output"
|
||||||
|
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
ctr_id="$output"
|
||||||
|
run crioctl ctr execsync --id "$ctr_id" env
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" =~ "HOSTNAME" ]]
|
||||||
|
run crioctl pod stop --id "$pod_id"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
run crioctl pod remove --id "$pod_id"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
cleanup_ctrs
|
||||||
|
cleanup_pods
|
||||||
|
stop_crio
|
||||||
|
}
|
||||||
|
|
||||||
@test "ctr execsync failure" {
|
@test "ctr execsync failure" {
|
||||||
start_crio
|
start_crio
|
||||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||||
|
|
Loading…
Reference in a new issue