Forecastle is a control panel which dynamically discovers and provides a launchpad to access applications deployed on Kubernetes – [✩Star] if you're using it!
In pkg/kube/wrappers/ingress.go the tryGetTLSHost method accesses ingress.Spec.TLS[0].Hosts[0] without ensuring that the Hosts slice is non-empty. This causes a runtime panic if an Ingress object with empty TLS is encountered as given below:
Description
In
pkg/kube/wrappers/ingress.go
thetryGetTLSHost
method accessesingress.Spec.TLS[0].Hosts[0]
without ensuring that theHosts
slice is non-empty. This causes a runtime panic if an Ingress object with emptyTLS
is encountered as given below:This PR introduces a new method on the
IngressWrapper
to fetch TLS HostsThe output of this method is used as a check in the
tryGetTLSHosts
method to ensure that out of index access panic does not occur.Closes https://github.com/stakater/Forecastle/issues/345
Test cases
A new test case has been introduced to simulate an Ingress with empty TLS.