-
Notifications
You must be signed in to change notification settings - Fork 199
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
Koperator can handle intermediate and leaf certificates in generated kafkaUser's TLS certificate #843
Koperator can handle intermediate and leaf certificates in generated kafkaUser's TLS certificate #843
Changes from 2 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 |
---|---|---|
|
@@ -94,10 +94,13 @@ type UserCertificate struct { | |
} | ||
|
||
// DN returns the Distinguished Name of a TLS certificate | ||
func (u *UserCertificate) DN() string { | ||
func (u *UserCertificate) DN() (string, error) { | ||
// cert has already been validated so we can assume no error | ||
cert, _ := certutil.DecodeCertificate(u.Certificate) | ||
return cert.Subject.String() | ||
cert, err := certutil.DecodeCertificate(u.Certificate) | ||
if err != nil { | ||
return "", 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. Question: wouldn't it be better to wrap the error with some content information (we are doing this in KafkaUser DistinguishedName retrieval), IMO it would help with debug clarification. 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. I'm not sure if any useful information is available here that could be added to the error context. The caller can add more details to the error like the Maybe a more descriptive error message could help 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. Yeah, I meant an error message to narrow the context from generic certificate error to KafkaUser DistringuishedName determination certificate error 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. The error log message already contains the kafkauser name, namespace. 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. Reconciler dumps the stacktrace. |
||
} | ||
return cert.Subject.String(), nil | ||
} | ||
|
||
// GetInternalDNSNames returns all potential DNS names for a kafka cluster - including brokers | ||
|
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.
Note: we need to rename that function for public interface clarity purposes....