-
Notifications
You must be signed in to change notification settings - Fork 58
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 logging to certpoolwatcher and client #1684
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1684 +/- ##
==========================================
- Coverage 68.24% 67.55% -0.70%
==========================================
Files 58 59 +1
Lines 4988 5128 +140
==========================================
+ Hits 3404 3464 +60
- Misses 1342 1411 +69
- Partials 242 253 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
lgtm ^^
you may need to rebase to pick up the upgrade-e2e mitigations =S |
906bb34
to
d20ad5f
Compare
Would you mind adding some example output to the description of the PR? |
d20ad5f
to
9eebd85
Compare
Example logging at start:
|
Example logging of an unknown certificate:
|
0d53099
to
cf71d8f
Compare
c80561b
to
01f38e7
Compare
catalogd/internal/controllers/core/clustercatalog_controller.go
Outdated
Show resolved
Hide resolved
de4fe9d
to
b778a9f
Compare
228010b
to
3405fad
Compare
catalogd/internal/controllers/core/clustercatalog_controller.go
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,157 @@ | |||
package httputil |
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.
it kind if weird that the certlog is in httputil pkg. Should we keep outside of httputil? Same comment for internal/httputil/certutil.go.
It is nit pick and not blocker for this PR.
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 was thinking of moving the cert utility stuff into it's own package, but that can be done later.
a48c266
to
7da2528
Compare
Logging now indicates what certificate (by file and X.509 name) is being watched When an unverified certificate error is returned to the client, log the cert Signed-off-by: Todd Short <[email protected]>
7da2528
to
5a10b3d
Compare
@@ -37,6 +39,23 @@ type ContainersImageRegistry struct { | |||
} | |||
|
|||
func (i *ContainersImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1.ClusterCatalog) (*Result, error) { | |||
res, err := i.unpack(ctx, catalog) |
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.
Lines 59-75 (the first lines of unpack
should be moved into Unpack
to:
- Get a common logger to use (we should get it from the context, not from the root
ctrl.Log
) - Only have to call i.SourceContextFunc(l) once
Then we could just pass the logger and the SystemContext
to unpack()
.
log.V(defaultLogLevel).V(1).Info("skip directory", "name", e.Name()) | ||
continue | ||
} | ||
log.Info("load certificate", "name", e.Name()) | ||
log.V(defaultLogLevel).V(1).Info("load certificate", "name", e.Name()) |
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.
Just checking that you are intending to use V(defaultLogLevel).V(1)
here (which is the same as V(defaultLogLevel+1)
)? If so, maybe use the latter construction?
Logging now indicates what certificate (by file and X.509 name) is being watched
Update:
firstExpiration
as it's no longer calculatedV(4)
, using a constantLog when an unknown server cert is encountered:
Loading and Watching certificates: