Make CloudDNS service account errors debuggable

Improve logging in the case where the Service Account Secret is
loaded, but the Key is not found.

Previous behaviour was to fail without giving much help as to
why.

New behaviour confirms the key name and namespace/secret-name.

FIXES: 539
This commit is contained in:
Paul Tiplady 2018-05-10 19:26:30 -07:00
parent e6a9637d76
commit 1089667ceb

View File

@ -169,7 +169,13 @@ func (s *Solver) solverForIssuerProvider(providerName string) (solver, error) {
if err != nil {
return nil, fmt.Errorf("error getting clouddns service account: %s", err.Error())
}
saBytes := saSecret.Data[providerConfig.CloudDNS.ServiceAccount.Key]
saKey := providerConfig.CloudDNS.ServiceAccount.Key
saBytes := saSecret.Data[saKey]
if len(saBytes) == 0 {
return nil, fmt.Errorf("specfied key %q not found in secret %s/%s", saKey, saSecret.Namespace, saSecret.Name)
}
impl, err = s.dnsProviderConstructors.cloudDNS(providerConfig.CloudDNS.Project, saBytes)
if err != nil {