-
Notifications
You must be signed in to change notification settings - Fork 275
Fix flaky e2e tests #4844
Fix flaky e2e tests #4844
Changes from 11 commits
5297e12
1be6968
434a876
9e1ade9
e7bd74a
3e86f96
8a147fc
882dab8
14e3371
1eed0a2
a0322e5
75fb48b
16865c8
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 | ||||
---|---|---|---|---|---|---|
|
@@ -17,14 +17,14 @@ import ( | |||||
) | ||||||
|
||||||
// NewManager creates a new CertificateManager with the passed MRCClient and options | ||||||
func NewManager(ctx context.Context, mrcClient MRCClient, getServiceCertValidityPeriod func() time.Duration, getIngressCertValidityDuration func() time.Duration, msgBroker *messaging.Broker, checkInterval time.Duration) (*Manager, error) { | ||||||
func NewManager(ctx context.Context, mrcClient MRCClient, getServiceCertValidityPeriod func() time.Duration, getIngressCertValidityDuration func() time.Duration, msgBroker *messaging.Broker, checkInterval time.Duration, ns string) (*Manager, error) { | ||||||
m := &Manager{ | ||||||
serviceCertValidityDuration: getServiceCertValidityPeriod, | ||||||
ingressCertValidityDuration: getIngressCertValidityDuration, | ||||||
msgBroker: msgBroker, | ||||||
} | ||||||
|
||||||
err := m.start(ctx, mrcClient) | ||||||
err := m.start(ctx, mrcClient, ns) | ||||||
if err != nil { | ||||||
return nil, err | ||||||
} | ||||||
|
@@ -49,7 +49,7 @@ func (m *Manager) startRotationTicker(ctx context.Context, checkInterval time.Du | |||||
}() | ||||||
} | ||||||
|
||||||
func (m *Manager) start(ctx context.Context, mrcClient MRCClient) error { | ||||||
func (m *Manager) start(ctx context.Context, mrcClient MRCClient, ns string) error { | ||||||
keithmattix marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// start a watch and we wait until the manager is initialized so that | ||||||
// the caller gets a manager that's ready to be used | ||||||
var once sync.Once | ||||||
|
@@ -129,15 +129,23 @@ func (m *Manager) handleMRCEvent(mrcClient MRCClient, event MRCEvent) error { | |||||
c := &issuer{Issuer: client, ID: clientID, CertificateAuthority: ca} | ||||||
switch { | ||||||
case mrc.Status.State == constants.MRCStateActive: | ||||||
m.mu.Lock() | ||||||
m.signingIssuer = c | ||||||
m.validatingIssuer = c | ||||||
m.mu.Unlock() | ||||||
case mrc.Status.State == constants.MRCStateIssuingRollback || mrc.Status.State == constants.MRCStateIssuingRollout: | ||||||
m.mu.Lock() | ||||||
m.signingIssuer = c | ||||||
m.mu.Unlock() | ||||||
case mrc.Status.State == constants.MRCStateValidatingRollback || mrc.Status.State == constants.MRCStateValidatingRollout: | ||||||
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 believe if a MRC is in a state of IssuingRollback it should only be used for validating. I define the IssuingRollback state as the rollback of using this issuer to sign certificates.
Suggested change
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. Ah, I just got a chance to look at the state-machine logic here. Isn't there a scenario where there's no signing issuer on startup? If you get an MRC with status IssuingRollback and an MRC with status ValidatingRollout, there's no signing issuer. At least for startup purposes, IssuingRollback seems to imply that the MRC in question was the de-facto issuer 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 IssuingRollback state is set when an MRC enters the issuingRollout state. I don't think there should ever be a case where MRCs have the IssuingRollback and ValidatingRollout states. 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. This comment is not blocking and can be addressed in a follow up PR. 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. Hmmm so what does it mean of one MRC is active, and the other is ValidatingRollout? Keep in mind that the control plane could restart between status updates of two different MRCs |
||||||
m.mu.Lock() | ||||||
m.validatingIssuer = c | ||||||
m.mu.Unlock() | ||||||
default: | ||||||
m.mu.Lock() | ||||||
m.signingIssuer = c | ||||||
m.validatingIssuer = c | ||||||
m.mu.Unlock() | ||||||
} | ||||||
case MRCEventUpdated: | ||||||
// TODO | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.