<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi, <o:p></o:p></p>
<p class="MsoNormal"><br>
I have been working on some slight code cleanup/refactoring within the kata-runtime, but I feel like there is not an extremely straight forward answer for fixing the issue of converting sandboxID and containerID to distinct types:
<a href="https://github.com/kata-containers/runtime/issues/1024">https://github.com/kata-containers/runtime/issues/1024</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The rest of this can be found as the most recent comment within the issue (with prettier formatting
<span style="font-family:Wingdings">J</span>)<o:p></o:p></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">There looks to be a few instances within the runtime/cli that containerID and sandboxID are used interchangeably, mostly seemingly due to the OCI spec being unaware of the sandbox. I think we may need to have a discussion about how we want
 to handle these specific situations (I'll post below some that I found). I am still trying to learn the code base and project, so please correct me where I'm wrong, or give advice in any way :)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">First, a few clarifying questions I had:<o:p></o:p></p>
<p class="MsoNormal">1. In the docker case, are sandbox ID and container ID [always|usually|never] the same value?<o:p></o:p></p>
<p class="MsoNormal">2. In the kubernetes case, is the sandbox ID the pod ID or the "dummy/pause" container ID, or both?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">### instances<o:p></o:p></p>
<p class="MsoNormal">from `cli/run.go`<o:p></o:p></p>
<p class="MsoNormal">`func run(ctx context.Context, containerID ContainerID, bundle, console, consoleSocket, pidFile string, detach, systemdCgroup bool,`<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">```go<o:p></o:p></p>
<p class="MsoNormal">// delete container's resources<o:p></o:p></p>
<p class="MsoNormal">if err := delete(ctx, sandbox.ID(), true); err != nil {<o:p></o:p></p>
<p class="MsoNormal">    return err<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">however, in `cli/delete.go`, the delete function takes a container ID, not a sandbox ID.<o:p></o:p></p>
<p class="MsoNormal">Within the delete function it checks the `containerType`, and either performs a delete sandbox, or delete container depending on the type.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There is a similar situation in `cli/start.go` where sandboxID is being passed where ContainerID is expected to run the hook:<o:p></o:p></p>
<p class="MsoNormal">```go<o:p></o:p></p>
<p class="MsoNormal">return katautils.PostStartHooks(ctx, ociSpec, sandboxID, status.Annotations[vcAnnot.BundlePathKey])`<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal">---<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A final instance I'm slightly confused on (also probably with my inexperience with all of this, so bear with me) is with the `getExistingContainerInfo` func within oci.go. It seems to be returning the ID of a sandbox, yet is eluding that
 it is getting container information. I'm not sure if this is a naming thing, or if it goes along with the question of whether these variables should be implicitly called.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">which leads me to ask. do you think we should:<o:p></o:p></p>
<p class="MsoNormal">1. keep things how they are and implicitly pass strings for container ID and sandbox ID<o:p></o:p></p>
<p class="MsoNormal">2. make the modifications to have container ID and sandbox ID be explicit types and then<o:p></o:p></p>
<p class="MsoNormal">          a. cast sandboxID to be containerID in situations where they can be the same value
<o:p></o:p></p>
<p class="MsoNormal">          b. have different functionalities depending on whether sandboxID or containerID is is being used
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you in advanced for the clarifications and helping me out :)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Gabi<o:p></o:p></p>
</div>
</body>
</html>