Fix bugs in http challenge solver

This commit is contained in:
James Munnelly 2018-03-22 22:26:15 +00:00
parent 36c825fa48
commit cfc11f324b
3 changed files with 6 additions and 6 deletions

View File

@ -73,10 +73,10 @@ func (s *Solver) ensureIngress(crt *v1alpha1.Certificate, svcName, domain, token
if err != nil {
return nil, err
}
if len(existingIngresses) > 0 {
errMsg := fmt.Sprintf("multiple challenge solver pods found for certificate '%s/%s'. Cleaning up existing pods.", crt.Namespace, crt.Name)
if len(existingIngresses) > 1 {
errMsg := fmt.Sprintf("multiple challenge solver ingresses found for certificate '%s/%s'. Cleaning up existing pods.", crt.Namespace, crt.Name)
glog.Infof(errMsg)
err := s.cleanupPods(crt, domain)
err := s.cleanupIngresses(crt, domain, token)
if err != nil {
return nil, err
}
@ -85,7 +85,7 @@ func (s *Solver) ensureIngress(crt *v1alpha1.Certificate, svcName, domain, token
if len(existingIngresses) == 1 {
return existingIngresses[0], nil
}
glog.Infof("No existing HTTP01 challenge solver pod found for Certificate %q. One will be created.")
glog.Infof("No existing HTTP01 challenge solver ingress found for Certificate %q. One will be created.")
return s.createIngress(crt, svcName, domain, token, *httpDomainCfg)
}

View File

@ -27,7 +27,7 @@ func (s *Solver) ensurePod(crt *v1alpha1.Certificate, domain, token, key string)
return nil, err
}
var pod *corev1.Pod
if len(existingPods) > 0 {
if len(existingPods) > 1 {
errMsg := fmt.Sprintf("multiple challenge solver pods found for certificate '%s/%s'. Cleaning up existing pods.", crt.Namespace, crt.Name)
glog.Infof(errMsg)
err := s.cleanupPods(crt, domain)

View File

@ -20,7 +20,7 @@ func (s *Solver) ensureService(crt *v1alpha1.Certificate, domain, token, key str
return nil, err
}
var service *corev1.Service
if len(existingServices) > 0 {
if len(existingServices) > 1 {
errMsg := fmt.Sprintf("multiple challenge solver services found for certificate '%s/%s'. Cleaning up existing services.", crt.Namespace, crt.Name)
glog.Infof(errMsg)
err := s.cleanupServices(crt, domain)