From e2123ccbb3d23db808b28947221eafe8ba6fbcee Mon Sep 17 00:00:00 2001 From: Daniel Morsing Date: Thu, 24 Jan 2019 15:41:11 +0000 Subject: [PATCH] clear acme client cache whenever an acme issuer is changed This is a very in-elegant solution to the problem, but it avoids having to look at other extant issuers and having background processes. Signed-off-by: Daniel Morsing --- pkg/acme/acme.go | 6 ++++++ pkg/issuer/acme/setup.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/pkg/acme/acme.go b/pkg/acme/acme.go index 273c6f866..154a90b67 100644 --- a/pkg/acme/acme.go +++ b/pkg/acme/acme.go @@ -193,6 +193,12 @@ func lookupClient(spec *cmapi.ACMEIssuer, status *cmapi.ACMEIssuerStatus, pk *rs return acmeCl } +func ClearClientCache() { + clientRepoMu.Lock() + defer clientRepoMu.Unlock() + clientRepo = nil +} + // buildHTTPClient returns an HTTP client to be used by the ACME client. // For the time being, we construct a new HTTP client on each invocation. // This is because we need to set the 'skipTLSVerify' flag on the HTTP client diff --git a/pkg/issuer/acme/setup.go b/pkg/issuer/acme/setup.go index 734a6d042..c6960d4d9 100644 --- a/pkg/issuer/acme/setup.go +++ b/pkg/issuer/acme/setup.go @@ -96,6 +96,8 @@ func (a *Acme) Setup(ctx context.Context) error { } + acme.ClearClientCache() + cl, err := acme.ClientWithKey(a.issuer, pk) if err != nil { s := messageAccountVerificationFailed + err.Error()