-
Notifications
You must be signed in to change notification settings - Fork 66
🐛 Fix operator-controller not using updated registries configuration #1554
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import ( | |
"github.com/containers/image/v5/oci/layout" | ||
"github.com/containers/image/v5/pkg/blobinfocache/none" | ||
"github.com/containers/image/v5/pkg/compression" | ||
"github.com/containers/image/v5/pkg/sysregistriesv2" | ||
"github.com/containers/image/v5/signature" | ||
"github.com/containers/image/v5/types" | ||
"github.com/go-logr/logr" | ||
|
@@ -43,10 +44,14 @@ func (i *ContainersImageRegistry) Unpack(ctx context.Context, bundle *BundleSour | |
return nil, reconcile.TerminalError(fmt.Errorf("error parsing bundle, bundle %s has a nil image source", bundle.Name)) | ||
} | ||
|
||
// Reload registries cache in case of configuration update | ||
sysregistriesv2.InvalidateCache() | ||
|
||
srcCtx, err := i.SourceContextFunc(l) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
////////////////////////////////////////////////////// | ||
// | ||
// Resolve a canonical reference for the image. | ||
|
@@ -254,6 +259,11 @@ func (i *ContainersImageRegistry) unpackImage(ctx context.Context, unpackPath st | |
if err != nil { | ||
return fmt.Errorf("error creating image source: %w", err) | ||
} | ||
defer func() { | ||
if err := layoutSrc.Close(); err != nil { | ||
panic(err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a question - imho panicking here seems a little excessive, but I see it in multiple places, so I think it's getting caught There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just following convention here :) Not sure it's the right way to handle it either but I just noticed the source close was missing so I wanted to catch that while I was in here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe let's proceed with the convention for this PR, but create a discussion in upstream slack? I'm also a bit 🤔 about these panics. Maybe we should level set on a tenet for when to use it and why? |
||
} | ||
}() | ||
|
||
if err := os.MkdirAll(unpackPath, 0700); err != nil { | ||
return fmt.Errorf("error creating unpack directory: %w", err) | ||
|
Uh oh!
There was an error while loading. Please reload this page.