-
Notifications
You must be signed in to change notification settings - Fork 657
add soci to nerdctl image convert [DO NOT MERGE] #4300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Arjun Raja Yogidas <[email protected]>
c40ca4c
to
dda79d3
Compare
@@ -45,3 +45,18 @@ For images that already have SOCI indices, see https://gallery.ecr.aws/soci-work | |||
nerdctl push --snapshotter=soci --soci-span-size=2097152 --soci-min-layer-size=20971520 public.ecr.aws/my-registry/my-repo:latest | |||
``` | |||
--soci-span-size and --soci-min-layer-size are two properties to customize the SOCI index. See [Command Reference](https://github.com/containerd/nerdctl/blob/377b2077bb616194a8ef1e19ccde32aa1ffd6c84/docs/command-reference.md?plain=1#L773) for further details. | |||
|
|||
|
|||
## Enable SOCI for `nerdctl image convert` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs documentation to distinguish soci option with push vs convert and some details about v1, v2 indexes
@@ -960,6 +960,11 @@ Flags: | |||
- `--oci` : convert Docker media types to OCI media types | |||
- `--platform=<PLATFORM>` : convert content for a specific platform | |||
- `--all-platforms` : convert content for all platforms (default: false) | |||
- `--soci`: generate SOCI v2 Indices to oci images. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: format
@@ -960,6 +960,11 @@ Flags: | |||
- `--oci` : convert Docker media types to OCI media types | |||
- `--platform=<PLATFORM>` : convert content for a specific platform | |||
- `--all-platforms` : convert content for all platforms (default: false) | |||
- `--soci`: generate SOCI v2 Indices to oci images. | |||
*[**Note**: content is converted for all platforms by default when using this flag, use the `--platorm` flag to limit this behavior]* | |||
- `--soci-min-layer-size` : Span size in bytes that soci index uses to segment layer data. Default is 4 MiB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: soci-span-size?
@@ -89,6 +89,12 @@ func convertCommand() *cobra.Command { | |||
cmd.Flags().String("overlaybd-dbstr", "", "Database config string for overlaybd") | |||
// #endregion | |||
|
|||
// #region soci flags | |||
cmd.Flags().Bool("soci", false, "Convert image to SOCI Index V2 format.") | |||
cmd.Flags().Int64("soci-min-layer-size", -1, "The minimum size of layers that will be converted to SOCI Index V2 format") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set the default explicitly instead of passing -1? If we simply want to use SOCI defined defaults, can we simply not pass these options if not set?
|
||
// ConvertSociIndexV2 converts an image to SOCI format and returns the converted image reference with digest | ||
func ConvertSociIndexV2(ctx context.Context, client *client.Client, srcRef string, destRef string, gOpts types.GlobalCommandOptions, platforms []string, sOpts types.SociOptions) (string, error) { | ||
sociCmd, err := setupSociCommand(gOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will rely on the platform SOCI version to support the convert option as well. For compatibility, should we check the SOCI cli version first, before making the soci call. We should throw an appropriate error/warn message if the platform soci version does not support convert option.
This PR adds functionality to support
nerdctl image convert
using soci.This follows the new soci convert feature.
Note: the tests currently skip if the soci version is <0.10.0 (which is the expected version that will contain the convert feature) and this PR will be marked DO NOT MERGE till then.
cc: @Shubhranshu153 @swagatbora90 @AkihiroSuda