-
Notifications
You must be signed in to change notification settings - Fork 32
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
✨ Add PullSecret controller to save pull secret data locally #425
✨ Add PullSecret controller to save pull secret data locally #425
Conversation
6119a87
to
8375843
Compare
Test performed: Created:
Controller logs:
Log line to note from the Unpacker:
Final result 🎉 :
|
8375843
to
2605514
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 35.28% 37.31% +2.02%
==========================================
Files 14 15 +1
Lines 802 922 +120
==========================================
+ Hits 283 344 +61
- Misses 472 529 +57
- Partials 47 49 +2 ☔ View full report in Codecov by Sentry. |
err := r.Get(ctx, req.NamespacedName, secret) | ||
if err != nil { | ||
if apierrors.IsNotFound(err) { | ||
logger.Info("secret not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a warn or error saying it will be unable to pull from pvt registries ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there's no WARN for this particular logger we're using, only Info
or Error
. I don't think this needs to be an Error, especially since the function we're calling logs additional messages about the auth file being deleted.
2605514
to
d8159ec
Compare
cmd/manager/main.go
Outdated
@@ -105,6 +113,7 @@ func main() { | |||
flag.StringVar(&keyFile, "tls-key", "", "The key file used for serving catalog contents over HTTPS. Requires tls-cert.") | |||
flag.IntVar(&webhookPort, "webhook-server-port", 9443, "The port that the mutating webhook server serves at.") | |||
flag.StringVar(&caCertDir, "ca-certs-dir", "", "The directory of CA certificate to use for verifying HTTPS connections to image registries.") | |||
flag.StringVar(&globalPullSecret, "global-pull-secret", "", "The namespace/name of the global pull secret that is going to be used to pull bundle images.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a bit confusing at a glance. One could read this as the namespace OR the name. Could format it like the error message below "/"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, changed.
// https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md | ||
err := os.WriteFile(r.AuthFilePath, dockerConfigJSON, 0600) | ||
if err != nil { | ||
return ctrl.Result{}, fmt.Errorf("failed to write secret data to file: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment here as Sid's below re: revealing file location
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the other ones, but I have the urge to keep this one. We'd want to see the specific error message for this when we get a must-gather (logs) for a bug report related to this.
@@ -49,12 +49,13 @@ func (i *ContainersImageRegistry) Unpack(ctx context.Context, catalog *catalogdv | |||
return nil, reconcile.TerminalError(fmt.Errorf("error parsing catalog, catalog %s has a nil image source", catalog.Name)) | |||
} | |||
|
|||
srcCtx, err := i.SourceContextFunc(l) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linter pointed this out, but no err check here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops missed this, thanks for pointing it out. Added an error check below.
71bb7a0
to
ad9c5b0
Compare
cmd/manager/main.go
Outdated
storageDir = "catalogs" | ||
authFilePath = "/etc/catalogd/auth.json" | ||
storageDir = "catalogs" | ||
authFilePrefix = "catalogd-global-pull-secret.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the .json
extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see the confusion. It says "prefix" there but it's actually the suffix. Changing it. Also I just noticed the fmt.Sprintf already has the .json
, thanks for pointing it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now. Here's what it looks like https://go.dev/play/p/FJlQgd_KS5R
ad9c5b0
to
c1bf01a
Compare
Should this have changes that match operator-framework/operator-controller#1322 ? |
@tmshort do you mean this? Am I missing any changes? I've been trying to keep both of them in sync and I don't see anything that I missed. |
c1bf01a
to
2427c8a
Compare
b1b145a
RFC: https://docs.google.com/document/d/1BXD6kj5zXHcGiqvJOikU2xs8kV26TPnzEKp6n7TKD4M/edit#heading=h.x3tfh25grvnv