Merge pull request #420 from mrunalp/fix_hostname

Set the container hostname same as pod hostname
This commit is contained in:
Mrunal Patel 2017-03-31 07:35:49 -07:00 committed by GitHub
commit fa467a30f1
3 changed files with 7 additions and 0 deletions

View file

@ -435,6 +435,10 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
specgen.AddBindMount(sb.resolvPath, "/etc/resolv.conf", []string{"ro"})
}
if sb.hostname != "" {
specgen.SetHostname(sb.hostname)
}
specgen.AddAnnotation("ocid/name", containerName)
specgen.AddAnnotation("ocid/sandbox_id", sb.id)
specgen.AddAnnotation("ocid/sandbox_name", sb.infraContainer.Name())

View file

@ -141,6 +141,7 @@ type sandbox struct {
cgroupParent string
privileged bool
resolvPath string
hostname string
}
const (

View file

@ -259,6 +259,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
g.AddAnnotation("ocid/shm_path", shmPath)
g.AddAnnotation("ocid/privileged_runtime", fmt.Sprintf("%v", privileged))
g.AddAnnotation("ocid/resolv_path", resolvPath)
g.AddAnnotation("ocid/hostname", hostname)
sb := &sandbox{
id: id,
@ -273,6 +274,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
shmPath: shmPath,
privileged: privileged,
resolvPath: resolvPath,
hostname: hostname,
}
s.addSandbox(sb)