Skip to content

Commit

Permalink
distro/multi: additional container storage
Browse files Browse the repository at this point in the history
Enable a custom storage path for containers to be pulled into.

Jira: https://issues.redhat.com/browse/HMS-3235
  • Loading branch information
kingsleyzissou committed Jan 5, 2024
1 parent 30d49a4 commit 9c72009
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/distro/fedora/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ func osCustomizations(
osc.ContainersStorage = &storagePath
}

if containerStorage := c.GetContainerStorage(); containerStorage != nil {
osc.ContainersStorage = containerStorage.StoragePath
}

customRepos, err := c.GetRepositories()
if err != nil {
// This shouldn't happen and since the repos
Expand Down
8 changes: 8 additions & 0 deletions pkg/distro/fedora/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
return nil, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name)
}

if len(bp.Containers) > 0 {
for _, container := range bp.Containers {
if err := container.Validate(); err != nil {
return nil, err
}
}
}

if options.OSTree != nil {
if err := options.OSTree.Validate(); err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/rhel8/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func osCustomizations(
osc.ContainersStorage = &storagePath
}

if containerStorage := c.GetContainerStorage(); containerStorage != nil {
osc.ContainersStorage = containerStorage.StoragePath
}

// set yum repos first, so it doesn't get overridden by
// imageConfig.YUMRepos
osc.YUMRepos = imageConfig.YUMRepos
Expand Down
8 changes: 8 additions & 0 deletions pkg/distro/rhel8/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
return warnings, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name)
}

if len(bp.Containers) > 0 {
for _, container := range bp.Containers {
if err := container.Validate(); err != nil {
return nil, err
}
}
}

if options.OSTree != nil {
if err := options.OSTree.Validate(); err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/rhel9/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func osCustomizations(
osc.ContainersStorage = &storagePath
}

if containerStorage := c.GetContainerStorage(); containerStorage != nil {
osc.ContainersStorage = containerStorage.StoragePath
}

// set yum repos first, so it doesn't get overridden by
// imageConfig.YUMRepos
osc.YUMRepos = imageConfig.YUMRepos
Expand Down
8 changes: 8 additions & 0 deletions pkg/distro/rhel9/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
return warnings, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name)
}

if len(bp.Containers) > 0 {
for _, container := range bp.Containers {
if err := container.Validate(); err != nil {
return nil, err
}
}
}

if options.OSTree != nil {
if err := options.OSTree.Validate(); err != nil {
return nil, err
Expand Down

0 comments on commit 9c72009

Please sign in to comment.