Add sandbox specs along with methods for serialization and deserialization into UVM options#2584
Open
rawahars wants to merge 1 commit intomicrosoft:feature/multiple_pods_in_sandboxfrom
Open
Conversation
In this commit, we are adding the proto definition used for passing along the parameters for sandbox to the shim. In addition to the proto, we are also adding few helper methods which take the runtime options along with the annotations and create the sandbox specs. We also have a method to convert the sandbox specs into appropriate UVM specs to be passed along to HCS. Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In this PR, we are adding the proto definition which declares the specs used to create a sandbox by shim. Additionally, we have added the methods
GenerateandBuildUVMOptionswhich are used for serialization and deserialization.In the
Generatemethod, all the annotations as passed by the client are parsed and the appropriate fields are set in the specs.In the
BuildUVMOptionsmethod, all the fields as set in theSpecsare parsed and are set into theOptionsLCOWorOptionsWCOWinstance which is then used to create the UVM.This will be the defacto method going forward-
Generatemethod inRunPodSandboxto generate the sandbox specs.Alternatively, for legacy workflows using pause sandbox where the sandbox is created via Task API, the shim will call
Generatemethod in theCreatecall.CreateSandboxcall will invokeBuildUVMOptionson the Specs to generate the UVMOptions.Alternatively, for legacy workflows, the same will be called in the
Createcall of Task API.These methods encapsulate the logic as present in
hcsshim/internal/oci/uvm.go
Line 349 in 73fdc96
We hope to deprecate the
SpecToUVMCreateOptsmethod and encapsulate the parsing logic in above methods.Changes introduced in this PR
Specssandbox_specs.gowhich includes theGeneratemethod to create the specs.uvm_specs.gowhich includes theBuildUVMOptionsmethod to create the UVM options from the specs.internal\ocipackage for code reusability in the new code.Tests