Removes extra GET calls for ACME order resource

In cases where a synced Order does not require any processing from this controller

Signed-off-by: irbekrm <irbekrm@gmail.com>
This commit is contained in:
irbekrm 2023-03-29 14:00:43 +01:00
parent 56b8656766
commit 0964d6d03d
2 changed files with 8 additions and 3 deletions

View File

@ -161,6 +161,14 @@ func (c *controller) Sync(ctx context.Context, o *cmacme.Order) (err error) {
return c.finalizeOrder(ctx, cl, o, genericIssuer)
}
// At this point, if no Challenges have failed or reached a final state,
// we can return without taking any action. This controller will resync
// the Order on any owned Challenge events.
if !anyChallengesFailed(challenges) && !allChallengesFinal(challenges) {
log.V(logf.DebugLevel).Info("No action taken")
return nil
}
// Note: each of the following code paths uses the ACME Order retrieved
// here. Be mindful when adding new code below this call to ACME server-
// if the new code does not need this ACME order, try to place it above

View File

@ -490,9 +490,6 @@ rUCGwbCUDI0mxadJ3Bz4WxR6fyNpBK2yAinWEsikxqEt
ExpectedActions: []testpkg.Action{},
},
acmeClient: &acmecl.FakeACME{
FakeGetOrder: func(_ context.Context, url string) (*acmeapi.Order, error) {
return testACMEOrderPending, nil
},
FakeHTTP01ChallengeResponse: func(s string) (string, error) {
// TODO: assert s = "token"
return "key", nil