Set the container hostnames same as pod hostname
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
parent
7c6443c592
commit
4ccc5bbe7c
3 changed files with 7 additions and 0 deletions
|
@ -394,6 +394,10 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
||||||
specgen.AddBindMount(sb.resolvPath, "/etc/resolv.conf", []string{"ro"})
|
specgen.AddBindMount(sb.resolvPath, "/etc/resolv.conf", []string{"ro"})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sb.hostname != "" {
|
||||||
|
specgen.SetHostname(sb.hostname)
|
||||||
|
}
|
||||||
|
|
||||||
specgen.AddAnnotation("ocid/name", containerName)
|
specgen.AddAnnotation("ocid/name", containerName)
|
||||||
specgen.AddAnnotation("ocid/sandbox_id", sb.id)
|
specgen.AddAnnotation("ocid/sandbox_id", sb.id)
|
||||||
specgen.AddAnnotation("ocid/sandbox_name", sb.infraContainer.Name())
|
specgen.AddAnnotation("ocid/sandbox_name", sb.infraContainer.Name())
|
||||||
|
|
|
@ -141,6 +141,7 @@ type sandbox struct {
|
||||||
cgroupParent string
|
cgroupParent string
|
||||||
privileged bool
|
privileged bool
|
||||||
resolvPath string
|
resolvPath string
|
||||||
|
hostname string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -259,6 +259,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
g.AddAnnotation("ocid/shm_path", shmPath)
|
g.AddAnnotation("ocid/shm_path", shmPath)
|
||||||
g.AddAnnotation("ocid/privileged_runtime", fmt.Sprintf("%v", privileged))
|
g.AddAnnotation("ocid/privileged_runtime", fmt.Sprintf("%v", privileged))
|
||||||
g.AddAnnotation("ocid/resolv_path", resolvPath)
|
g.AddAnnotation("ocid/resolv_path", resolvPath)
|
||||||
|
g.AddAnnotation("ocid/hostname", hostname)
|
||||||
|
|
||||||
sb := &sandbox{
|
sb := &sandbox{
|
||||||
id: id,
|
id: id,
|
||||||
|
@ -273,6 +274,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
shmPath: shmPath,
|
shmPath: shmPath,
|
||||||
privileged: privileged,
|
privileged: privileged,
|
||||||
resolvPath: resolvPath,
|
resolvPath: resolvPath,
|
||||||
|
hostname: hostname,
|
||||||
}
|
}
|
||||||
|
|
||||||
s.addSandbox(sb)
|
s.addSandbox(sb)
|
||||||
|
|
Loading…
Reference in a new issue