Add more descriptive logging in certificate loading

Currently a log "secret %v has no private key" is provided for
cert and "secret %v has no cert" is provided for key. They are in
the wrong place. This PR corrects the ordering and adds a
description as to what is actually missing.
This commit is contained in:
Fernando Diaz 2017-09-22 15:21:16 -05:00
parent 37bd14dcd2
commit 073241e341

View file

@ -66,11 +66,11 @@ func (t *apiServerTLSLoader) load(ing *extensions.Ingress) (*loadbalancers.TLSCe
} }
cert, ok := secret.Data[api_v1.TLSCertKey] cert, ok := secret.Data[api_v1.TLSCertKey]
if !ok { if !ok {
return nil, fmt.Errorf("secret %v has no private key", secretName) return nil, fmt.Errorf("secret %v has no 'tls.crt'", secretName)
} }
key, ok := secret.Data[api_v1.TLSPrivateKeyKey] key, ok := secret.Data[api_v1.TLSPrivateKeyKey]
if !ok { if !ok {
return nil, fmt.Errorf("secret %v has no cert", secretName) return nil, fmt.Errorf("secret %v has no 'tls.key'", secretName)
} }
certs := &loadbalancers.TLSCerts{Key: string(key), Cert: string(cert)} certs := &loadbalancers.TLSCerts{Key: string(key), Cert: string(cert)}
if err := t.validate(certs); err != nil { if err := t.validate(certs); err != nil {