-
Notifications
You must be signed in to change notification settings - Fork 276
ref(cert): update Manager to support mult clients #4705
Conversation
Supports multiple clients in Manager struct. Refactoring as a part of the root cert rotation work. During root cert rotation, there will be 2 CertManagers - the CertManager being rotated in and the CertManager being rotated out as specified in the MeshRootCertificates. Part of openservicemesh#4502 Signed-off-by: jaellio <[email protected]>
6c09513
to
bdb3e5f
Compare
Signed-off-by: jaellio <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #4705 +/- ##
==========================================
+ Coverage 69.45% 69.56% +0.10%
==========================================
Files 217 218 +1
Lines 15490 15595 +105
==========================================
+ Hits 10759 10848 +89
- Misses 4681 4697 +16
Partials 50 50
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -30,6 +30,21 @@ const ( | |||
|
|||
// New constructs a new certificate client using Vault's cert-manager | |||
func New(vaultAddr, token, role string) (*CertManager, error) { |
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.
not a big deal, but you could keep these as one function
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 split this up in order to make the client creation (without adding the root certificate) testable. Do you have any suggestions for how to keep this a single function without requiring too much refactoring of the tests?
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.
oh i see. Ya you can leave as is.
Alternatively you could do something like
// package level
type getRootCAFunc func(c *CertManager)
var getRootCA = func() {...} // fill in with current getRootCa (not a function not a method)
then in tests, before running:
getRootCA = func(){...} // overridden for testing
Up to you!
Signed-off-by: jaellio <[email protected]>
Signed-off-by: jaellio <[email protected]>
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.
Is pkg/certificate/temp necessary to keep? I didn't see it referenced in the diff and it looks like unit tests pass without it.
Signed-off-by: jaellio <[email protected]>
Description:
Supports multiple clients in Manager struct. Refactoring
as a part of the root cert rotation work. During root cert
rotation, there will be 2 CertManagers - the CertManager
being rotated in and the CertManager being rotated out as
specified in the MeshRootCertificates.
The ca is moved from the Manager to the CertManagers
for each cert provider.
Part of #4502
Testing done:
Affected area:
Please answer the following questions with yes/no.
Does this change contain code from or inspired by another project? no
Is this a breaking change? no
Has documentation corresponding to this change been updated in the osm-docs repo (if applicable)?