Merge pull request #992 from aledbf/fix-nil-ssl

Check errors generating pem files
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-07-18 16:53:19 -04:00 committed by GitHub
commit bfd60ac7c9

View file

@ -89,10 +89,16 @@ func (ic *GenericController) getPemCertificate(secretName string) (*ingress.SSLC
var s *ingress.SSLCert
if okcert && okkey {
s, err = ssl.AddOrUpdateCertAndKey(nsSecName, cert, key, ca)
if err != nil {
return nil, fmt.Errorf("unexpected error creating pem file %v", err)
}
glog.V(3).Infof("found certificate and private key, configuring %v as a TLS Secret (CN: %v)", secretName, s.CN)
} else if ca != nil {
glog.V(3).Infof("found only ca.crt, configuring %v as an Certificate Authentication secret", secretName)
s, err = ssl.AddCertAuth(nsSecName, ca)
if err != nil {
return nil, fmt.Errorf("unexpected error creating pem file %v", err)
}
} else {
return nil, fmt.Errorf("no keypair or CA cert could be found in %v", secretName)
}