Skip to content

Commit

Permalink
feat: add support for -insecure-schematic-service-repository flag
Browse files Browse the repository at this point in the history
Allow usage of an insecure schematics repository.

Signed-off-by: Mattias Cockburn <mattias.cockburn@posteo.net>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
mattiascockburn authored and smira committed Apr 4, 2024
1 parent 5d779bb commit c0981e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/image-factory/cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Options struct { //nolint:govet
// Schematic service OCI registry prefix.
// It stores schematics for the image factory as blobs under that path.
SchematicServiceRepository string
// Allow insecure connection to the schematic service repository.
InsecureSchematicRepository bool

// OCI registry to store installer images has two endpoints:
// - one for the image factory to push images to
Expand Down
8 changes: 7 additions & 1 deletion cmd/image-factory/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,13 @@ func buildAssetBuilder(logger *zap.Logger, artifactsManager *artifacts.Manager,
}

func buildSchematicFactory(logger *zap.Logger, opts Options) (*schematic.Factory, error) {
repo, err := name.NewRepository(opts.SchematicServiceRepository)
var repoOpts []name.Option

if opts.InsecureSchematicRepository {
repoOpts = append(repoOpts, name.Insecure)
}

repo, err := name.NewRepository(opts.SchematicServiceRepository, repoOpts...)
if err != nil {
return nil, fmt.Errorf("failed to parse repository: %w", err)
}
Expand Down
6 changes: 6 additions & 0 deletions cmd/image-factory/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func initFlags() cmd.Options {
flag.StringVar(&opts.ExternalPXEURL, "external-pxe-url", cmd.DefaultOptions.ExternalPXEURL, "factory external PXE endpoint URL, if not set defaults to --external-url")

flag.StringVar(&opts.SchematicServiceRepository, "schematic-service-repository", cmd.DefaultOptions.SchematicServiceRepository, "image repository for the schematic service")
flag.BoolVar(
&opts.InsecureSchematicRepository,
"insecure-schematic-service-repository",
cmd.DefaultOptions.InsecureSchematicRepository,
"allow an insecure connection to the schematics repository",
)

flag.StringVar(&opts.InstallerExternalRepository, "installer-external-repository", cmd.DefaultOptions.InstallerExternalRepository, "image repository for the installer (external)")
flag.StringVar(&opts.InstallerInternalRepository, "installer-internal-repository", cmd.DefaultOptions.InstallerInternalRepository, "image repository for the installer (internal)")
Expand Down

0 comments on commit c0981e8

Please sign in to comment.