Refactor setting of tlsSecretName in NewIngress (#193)

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
pull/194/head
Mykola Morhun 2020-03-13 12:43:44 +02:00 committed by GitHub
parent 347e4c9038
commit 716852f8a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -12,8 +12,6 @@
package deploy
import (
"strconv"
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
"github.com/eclipse/che-operator/pkg/util"
"k8s.io/api/extensions/v1beta1"
@ -31,15 +29,14 @@ func NewIngress(cr *orgv1.CheCluster, name string, serviceName string, port int)
ingressClass := util.GetValue(cr.Spec.K8s.IngressClass, DefaultIngressClass)
labels := GetLabels(cr, name)
tlsSecretName := cr.Spec.K8s.TlsSecretName
tls := "false"
if tlsSupport {
tls = "true"
}
tlsSecretName := cr.Spec.K8s.TlsSecretName
// If TLS is turned on but the secret is not set, try to use Che default value as k8s cluster defaults will not work.
tlsFlag, _ := strconv.ParseBool(tls)
if tlsFlag && tlsSecretName == "" {
tlsSecretName = "che-tls"
// If TLS is turned on but the secret name is not set, try to use Che default value as k8s cluster defaults will not work.
if tlsSecretName == "" {
tlsSecretName = "che-tls"
}
}
host := ""