Skip to content
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

Introduce k0s airgap bundle-artifacts #5360

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

twz123
Copy link
Member

@twz123 twz123 commented Dec 13, 2024

Description

This sub-command introduces a "k0s native" way to create airgap artifact bundles. The current way to do this requires either a Docker or containerd daemon. Even then, there are certain scenarios where the created bundles don't contain all the necessary tags, i.e. when images are referenced by both their tag and their digest.

Replace image-bundler with k0s airgap bundle-artifacts. Dog-food the new sub-command in the k0s build itself.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@twz123 twz123 added enhancement New feature or request area/cli labels Dec 13, 2024
@twz123 twz123 marked this pull request as ready for review December 13, 2024 20:52
@twz123 twz123 requested review from a team as code owners December 13, 2024 20:52
Copy link
Contributor

This pull request has merge conflicts that need to be resolved.

This sub-command introduces a "k0s native" way to create airgap
artifact bundles. The current way to do this requires either a Docker
or containerd daemon. Even then, there are certain scenarios where the
created bundles don't contain all the necessary tags, i.e. when images
are referenced by both their tag and their digest.

Signed-off-by: Tom Wieczorek <[email protected]>
Dog-food the new sub-command in the k0s build itself.

Signed-off-by: Tom Wieczorek <[email protected]>
return refs, nil
}

func parseArtifactRefsFromSeq(refs iter.Seq[string]) (collected []reference.Named, _ error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _ error kind of looks like the return value can be ignored.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I can follow. What would you suggest?


buffered := bufio.NewWriter(out)
if err := bundler.Run(ctx, refs, out); err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error not wrapped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change this to return fmt.Errorf("failed to bundle artifacts: %w", err), but I'm not sure if that adds any additional insights 🤔

@@ -25,12 +25,12 @@ import (
"github.com/spf13/cobra"
)

func NewAirgapListImagesCmd() *cobra.Command {
func newAirgapListImagesCmd() *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other commands are exposed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are. But why?

Copy link
Contributor

This pull request has merge conflicts that need to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants