From 80a07c00937a3ac7a53af07fa0e8a4203678c28f Mon Sep 17 00:00:00 2001 From: Martin Weindel Date: Tue, 19 Nov 2019 10:42:57 +0100 Subject: [PATCH] fix "panic: runtime error: index out of range" if an ingress manifest does not provide tls hosts ```improvement operator fix for "Panic if ingress spec.tls.hosts not specified" (issue #6) ``` --- examples/40-ingress-echoheaders.yaml | 2 +- pkg/cert/source/reconciler.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/40-ingress-echoheaders.yaml b/examples/40-ingress-echoheaders.yaml index 50af4fc7..a31eb1f9 100644 --- a/examples/40-ingress-echoheaders.yaml +++ b/examples/40-ingress-echoheaders.yaml @@ -3,7 +3,7 @@ kind: Ingress metadata: name: echoheaders namespace: default - annotation: + annotations: cert.gardener.cloud/purpose: managed spec: tls: diff --git a/pkg/cert/source/reconciler.go b/pkg/cert/source/reconciler.go index d06209b9..705f2af8 100644 --- a/pkg/cert/source/reconciler.go +++ b/pkg/cert/source/reconciler.go @@ -311,7 +311,7 @@ func (this *sourceReconciler) createEntryFor(logger logger.LogContext, obj resou if this.targetclass != "" { resources.SetAnnotation(cert, ANNOT_CLASS, this.targetclass) } - if len(info.Domains) >= 0 { + if len(info.Domains) > 0 { cert.Spec.CommonName = &info.Domains[0] cert.Spec.DNSNames = info.Domains[1:] } @@ -371,7 +371,7 @@ func (this *sourceReconciler) updateEntry(logger logger.LogContext, info CertInf mod.Modify(changed) var cn *string var dnsNames []string - if len(info.Domains) >= 0 { + if len(info.Domains) > 0 { cn = &info.Domains[0] dnsNames = info.Domains[1:] }