Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit 7c1f99d

Browse files
author
Matthew Fisher
committed
fix(model): check if CertMapping exists
This way we're not performing a needless API call to kubernetes.
1 parent 9a0d3c8 commit 7c1f99d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

model/model.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,17 +369,19 @@ func buildAppConfig(kubeClient *kubernetes.Clientset, service v1.Service, router
369369
for _, domain := range appConfig.Domains {
370370
if strings.Contains(domain, ".") {
371371
// Look for a cert-bearing secret for this domain.
372-
secretName := fmt.Sprintf("%s-cert", appConfig.CertMappings[domain])
373-
certSecret, err := getSecret(kubeClient, secretName, service.Namespace)
374-
if err != nil {
375-
return nil, err
376-
}
377-
if certSecret != nil {
378-
certificate, err := buildCertificate(certSecret, domain)
372+
if certMapping, ok := appConfig.CertMappings[domain]; ok {
373+
secretName := fmt.Sprintf("%s-cert", certMapping)
374+
certSecret, err := getSecret(kubeClient, secretName, service.Namespace)
379375
if err != nil {
380376
return nil, err
381377
}
382-
appConfig.Certificates[domain] = certificate
378+
if certSecret != nil {
379+
certificate, err := buildCertificate(certSecret, domain)
380+
if err != nil {
381+
return nil, err
382+
}
383+
appConfig.Certificates[domain] = certificate
384+
}
383385
}
384386
} else {
385387
appConfig.Certificates[domain] = routerConfig.PlatformCertificate

0 commit comments

Comments
 (0)