-
Notifications
You must be signed in to change notification settings - Fork 64
🌱 Add logging to certpoolwatcher and client #1684
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
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.70% -0.54%
==========================================
Files 58 59 +1
Lines 4988 5128 +140
==========================================
+ Hits 3404 3472 +68
- Misses 1342 1403 +61
- 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
7da2528
to
5a10b3d
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]>
5a10b3d
to
3773bb6
Compare
@@ -133,6 +135,7 @@ func (c *Client) doRequest(ctx context.Context, catalog *catalogd.ClusterCatalog | |||
|
|||
resp, err := client.Do(req) | |||
if err != nil { | |||
_ = httputil.LogCertificateVerificationError(err, ctrl.Log.WithName("catalog-client")) |
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.
Why are we ignoring the return here?
// This function unwraps the given error to find an CertificateVerificationError.
// It then logs the list of certificates found in the unwrapped error
// Returns:
// * true if a CertificateVerificationError is found
// * false if no CertificateVerificationError is found
func LogCertificateVerificationError(err error, log logr.Logger) bool {
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.
Because we don't need to log certs in /etc/docker
here, because this is used for catalogd connections, not pulling images, The other places this is called, the return is used to determine if we want to look at /etc/docker
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 see, so we just called the function to log error in to the logfile.
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
c451127
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: