feat: provide insecure flag to imager

provides flag for imager to pull images insecurely from private registries

Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Niklas Wik 2024-03-27 10:28:58 +02:00 committed by Andrey Smirnov
parent a6b2f54564
commit 0fc24eeb09
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811

View File

@ -29,10 +29,12 @@ import (
)
var cmdFlags struct {
Platform string
Arch string
Board string
ImageDiskSize string
Platform string
Arch string
Board string
ImageDiskSize string
// Insecure can be set to true to force pull from insecure registry.
Insecure bool
ExtraKernelArgs []string
MetaValues install.MetaValues
SystemExtensionImages []string
@ -128,7 +130,8 @@ var rootCmd = &cobra.Command{
cmdFlags.SystemExtensionImages,
func(imageRef string) profile.ContainerAsset {
return profile.ContainerAsset{
ImageRef: imageRef,
ImageRef: imageRef,
ForceInsecure: cmdFlags.Insecure,
}
},
)
@ -148,6 +151,10 @@ var rootCmd = &cobra.Command{
}
}
if cmdFlags.Insecure {
prof.Input.BaseInstaller.ForceInsecure = cmdFlags.Insecure
}
if cmdFlags.ImageDiskSize != "" {
size, err := humanize.ParseBytes(cmdFlags.ImageDiskSize)
if err != nil {
@ -206,6 +213,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cmdFlags.Arch, "arch", runtime.GOARCH, "The target architecture")
rootCmd.PersistentFlags().StringVar(&cmdFlags.BaseInstallerImage, "base-installer-image", "", "Base installer image to use")
rootCmd.PersistentFlags().StringVar(&cmdFlags.Board, "board", "", "The value of "+constants.KernelParamBoard)
rootCmd.PersistentFlags().BoolVar(&cmdFlags.Insecure, "insecure", false, "Pull assets from insecure registry")
rootCmd.PersistentFlags().StringVar(&cmdFlags.ImageDiskSize, "image-disk-size", "", "Set custom disk image size (accepts human readable values, e.g. 6GiB)")
rootCmd.PersistentFlags().StringArrayVar(&cmdFlags.ExtraKernelArgs, "extra-kernel-arg", []string{}, "Extra argument to pass to the kernel")
rootCmd.PersistentFlags().Var(&cmdFlags.MetaValues, "meta", "A key/value pair for META")