Only construct ACME client once Issuer resource is Ready
Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
parent
ef55bd5807
commit
e0e4f9b5ea
@ -12,6 +12,7 @@ go_library(
|
||||
deps = [
|
||||
"//pkg/acme/client:go_default_library",
|
||||
"//pkg/acme/client/middleware:go_default_library",
|
||||
"//pkg/api/util:go_default_library",
|
||||
"//pkg/apis/acme/v1alpha2:go_default_library",
|
||||
"//pkg/apis/certmanager/v1alpha2:go_default_library",
|
||||
"//pkg/apis/meta/v1:go_default_library",
|
||||
|
||||
@ -22,6 +22,7 @@ import (
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
|
||||
acme "github.com/jetstack/cert-manager/pkg/acme/client"
|
||||
apiutil "github.com/jetstack/cert-manager/pkg/api/util"
|
||||
cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2"
|
||||
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
|
||||
cmerrors "github.com/jetstack/cert-manager/pkg/util/errors"
|
||||
@ -95,6 +96,12 @@ func (h *helperImpl) ClientForIssuer(iss cmapi.GenericIssuer) (acme.Interface, e
|
||||
if acmeSpec == nil {
|
||||
return nil, fmt.Errorf("issuer %q is not an ACME issuer. Ensure the 'acme' stanza is correctly specified on your Issuer resource", iss.GetObjectMeta().Name)
|
||||
}
|
||||
if !apiutil.IssuerHasCondition(iss, cmapi.IssuerCondition{
|
||||
Type: cmapi.IssuerConditionReady,
|
||||
Status: cmmeta.ConditionTrue,
|
||||
}) {
|
||||
return nil, fmt.Errorf("issuer %q is not in a 'Ready' state. not constructing client until issuer is ready", iss.GetObjectMeta().Name)
|
||||
}
|
||||
|
||||
ns := iss.GetObjectMeta().Namespace
|
||||
if ns == "" {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user