Skip to content

Commit

Permalink
feat: provide insecure flag to imager
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
salkin authored and smira committed Apr 1, 2024
1 parent a6b2f54 commit 0fc24ee
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmd/installer/cmd/imager/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
},
)
Expand All @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 0fc24ee

Please sign in to comment.