Cleanup comments
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
b839ff1093
commit
99a7a53309
1 changed files with 6 additions and 4 deletions
|
@ -55,7 +55,6 @@ func (s *Server) generatePodIDandName(name, namespace string) (string, string, e
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePodSandbox creates a pod-level sandbox.
|
// CreatePodSandbox creates a pod-level sandbox.
|
||||||
// The definition of PodSandbox is at https://k8s.io/kubernetes/pull/25899
|
|
||||||
func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxRequest) (*pb.CreatePodSandboxResponse, error) {
|
func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxRequest) (*pb.CreatePodSandboxResponse, error) {
|
||||||
// process req.Name
|
// process req.Name
|
||||||
name := req.GetConfig().GetMetadata().GetName()
|
name := req.GetConfig().GetMetadata().GetName()
|
||||||
|
@ -95,18 +94,19 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
g.SetRootReadonly(true)
|
g.SetRootReadonly(true)
|
||||||
g.SetProcessArgs([]string{"/pause"})
|
g.SetProcessArgs([]string{"/pause"})
|
||||||
|
|
||||||
// process req.Hostname
|
// set hostname
|
||||||
hostname := req.GetConfig().GetHostname()
|
hostname := req.GetConfig().GetHostname()
|
||||||
if hostname != "" {
|
if hostname != "" {
|
||||||
g.SetHostname(hostname)
|
g.SetHostname(hostname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// process req.LogDirectory
|
// set log directory
|
||||||
logDir := req.GetConfig().GetLogDirectory()
|
logDir := req.GetConfig().GetLogDirectory()
|
||||||
if logDir == "" {
|
if logDir == "" {
|
||||||
logDir = fmt.Sprintf("/var/log/ocid/pods/%s", id)
|
logDir = fmt.Sprintf("/var/log/ocid/pods/%s", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set DNS options
|
||||||
dnsServers := req.GetConfig().GetDnsOptions().GetServers()
|
dnsServers := req.GetConfig().GetDnsOptions().GetServers()
|
||||||
dnsSearches := req.GetConfig().GetDnsOptions().GetSearches()
|
dnsSearches := req.GetConfig().GetDnsOptions().GetSearches()
|
||||||
resolvPath := fmt.Sprintf("%s/resolv.conf", podSandboxDir)
|
resolvPath := fmt.Sprintf("%s/resolv.conf", podSandboxDir)
|
||||||
|
@ -122,6 +122,7 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
|
|
||||||
g.AddBindMount(resolvPath, "/etc/resolv.conf", "ro")
|
g.AddBindMount(resolvPath, "/etc/resolv.conf", "ro")
|
||||||
|
|
||||||
|
// add labels
|
||||||
labels := req.GetConfig().GetLabels()
|
labels := req.GetConfig().GetLabels()
|
||||||
labelsJSON, err := json.Marshal(labels)
|
labelsJSON, err := json.Marshal(labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -145,6 +146,7 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
g.AddAnnotation(k, v)
|
g.AddAnnotation(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup cgroup settings
|
||||||
cgroupParent := req.GetConfig().GetLinux().GetCgroupParent()
|
cgroupParent := req.GetConfig().GetLinux().GetCgroupParent()
|
||||||
if cgroupParent != "" {
|
if cgroupParent != "" {
|
||||||
g.SetLinuxCgroupsPath(cgroupParent)
|
g.SetLinuxCgroupsPath(cgroupParent)
|
||||||
|
@ -201,7 +203,7 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the network
|
// setup the network
|
||||||
podNamespace := ""
|
podNamespace := ""
|
||||||
netnsPath, err := container.NetNsPath()
|
netnsPath, err := container.NetNsPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue