99 "path"
1010 "path/filepath"
1111 "reflect"
12- "strings"
1312 "time"
1413
1514 apitypes "github.com/alibaba/pouch/apis/types"
@@ -54,7 +53,7 @@ const (
5453 // Address and port of stream server.
5554 // TODO: specify them in the parameters of pouchd.
5655 streamServerAddress = ""
57- streamServerPort = "10010 "
56+ streamServerPort = "10011 "
5857
5958 namespaceModeHost = "host"
6059 namespaceModeNone = "none"
@@ -371,8 +370,8 @@ func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandbox
371370 }
372371 labels , annotations := extractLabels (sandbox .Config .Labels )
373372
374- securityContext := sandboxMeta .Config .GetLinux ().GetSecurityContext ()
375- hostNet := securityContext . GetNamespaceOptions () .GetNetwork () == runtime .NamespaceMode_NODE
373+ nsOpts := sandboxMeta .Config .GetLinux ().GetSecurityContext (). GetNamespaceOptions ()
374+ hostNet := nsOpts .GetNetwork () == runtime .NamespaceMode_NODE
376375
377376 var ip string
378377 // No need to get ip for host network mode.
@@ -392,7 +391,15 @@ func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandbox
392391 Labels : labels ,
393392 Annotations : annotations ,
394393 Network : & runtime.PodSandboxNetworkStatus {Ip : ip },
395- // TODO: linux specific pod status.
394+ Linux : & runtime.LinuxPodSandboxStatus {
395+ Namespaces : & runtime.Namespace {
396+ Options : & runtime.NamespaceOption {
397+ Network : nsOpts .GetNetwork (),
398+ Pid : nsOpts .GetPid (),
399+ Ipc : nsOpts .GetIpc (),
400+ },
401+ },
402+ },
396403 }
397404
398405 return & runtime.PodSandboxStatusResponse {Status : status }, nil
@@ -440,8 +447,7 @@ func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateConta
440447
441448 image := ""
442449 if iSpec := config .GetImage (); iSpec != nil {
443- temp := strings .Split (iSpec .Image , ":" )
444- image = temp [len (temp )- 1 ]
450+ image = iSpec .Image
445451 }
446452 createConfig := & apitypes.ContainerCreateConfig {
447453 ContainerConfig : apitypes.ContainerConfig {
@@ -638,7 +644,7 @@ func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerSt
638644 labels , annotations := extractLabels (container .Config .Labels )
639645
640646 imageRef := container .Image
641- imageInfo , err := c .ImageMgr .GetImage (ctx , strings . TrimPrefix ( imageRef , "sha256:" ) )
647+ imageInfo , err := c .ImageMgr .GetImage (ctx , imageRef )
642648 if err != nil {
643649 return nil , fmt .Errorf ("failed to get image %s: %v" , imageRef , err )
644650 }
@@ -689,23 +695,7 @@ func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.Up
689695// to either create a new log file and return nil, or return an error.
690696// Once it returns error, new container log file MUST NOT be created.
691697func (c * CriManager ) ReopenContainerLog (ctx context.Context , r * runtime.ReopenContainerLogRequest ) (* runtime.ReopenContainerLogResponse , error ) {
692- containerID := r .GetContainerId ()
693- container , err := c .ContainerMgr .Get (ctx , containerID )
694- if err != nil {
695- return nil , fmt .Errorf ("failed to get container of %q: %v" , containerID , err )
696- }
697- if container .State .Status != apitypes .StatusRunning {
698- return nil , fmt .Errorf ("container %q is not running" , containerID )
699- }
700- c .ContainerMgr .(* mgr.ContainerManager ).IOs .Remove (containerID )
701- if container .LogPath != "" {
702- logPath := container .LogPath
703- err := c .attachLog (logPath , containerID )
704- if err != nil {
705- return nil , err
706- }
707- }
708- return & runtime.ReopenContainerLogResponse {}, nil
698+ return nil , fmt .Errorf ("UpdateContainerResources Not Implemented Yet" )
709699}
710700
711701// ExecSync executes a command in the container, and returns the stdout output.
@@ -840,7 +830,7 @@ func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesReques
840830 continue
841831 }
842832 // NOTE: we should query image cache to get the correct image info.
843- imageInfo , err := c .ImageMgr .GetImage (ctx , strings . TrimPrefix ( i .ID , "sha256:" ) )
833+ imageInfo , err := c .ImageMgr .GetImage (ctx , i .ID )
844834 if err != nil {
845835 continue
846836 }
@@ -864,7 +854,7 @@ func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequ
864854 return nil , err
865855 }
866856
867- imageInfo , err := c .ImageMgr .GetImage (ctx , strings . TrimPrefix ( ref .String (), "sha256:" ))
857+ imageInfo , err := c .ImageMgr .GetImage (ctx , ref .String ())
868858 if err != nil {
869859 // TODO: separate ErrImageNotFound with others.
870860 // Now we just return empty if the error occurred.
@@ -908,7 +898,7 @@ func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest)
908898
909899// RemoveImage removes the image.
910900func (c * CriManager ) RemoveImage (ctx context.Context , r * runtime.RemoveImageRequest ) (* runtime.RemoveImageResponse , error ) {
911- imageRef := strings . TrimPrefix ( r .GetImage ().GetImage (), "sha256:" )
901+ imageRef := r .GetImage ().GetImage ()
912902
913903 if err := c .ImageMgr .RemoveImage (ctx , imageRef , false ); err != nil {
914904 if errtypes .IsNotfound (err ) {
0 commit comments