From 26c69782bd68fa6efb14b3e6a850fa5601bca879 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Thu, 16 Jul 2020 11:16:02 +0300 Subject: [PATCH] Use the default ingress strategy if there is no value in CR (#346) Signed-off-by: Anatoliy Bazko --- pkg/deploy/devfile_registry.go | 3 ++- pkg/deploy/ingress.go | 2 +- pkg/deploy/plugin_registry.go | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/deploy/devfile_registry.go b/pkg/deploy/devfile_registry.go index 1da838306..3a9a794a4 100644 --- a/pkg/deploy/devfile_registry.go +++ b/pkg/deploy/devfile_registry.go @@ -49,7 +49,8 @@ func SyncDevfileRegistryToCluster(checluster *orgv1.CheCluster, clusterAPI Clust } } - if checluster.Spec.K8s.IngressStrategy == "multi-host" { + ingressStrategy := util.GetValue(checluster.Spec.K8s.IngressStrategy, DefaultIngressStrategy) + if ingressStrategy == "multi-host" { host = DevfileRegistry + "-" + checluster.Namespace + "." + checluster.Spec.K8s.IngressDomain } else { host = checluster.Spec.K8s.IngressDomain + "/" + DevfileRegistry diff --git a/pkg/deploy/ingress.go b/pkg/deploy/ingress.go index 53edba32c..dae25ddd7 100644 --- a/pkg/deploy/ingress.go +++ b/pkg/deploy/ingress.go @@ -111,7 +111,7 @@ func getClusterIngress(name string, namespace string, client runtimeClient.Clien func getSpecIngress(checluster *orgv1.CheCluster, name string, serviceName string, port int, clusterAPI ClusterAPI) (*v1beta1.Ingress, error) { tlsSupport := checluster.Spec.Server.TlsSupport - ingressStrategy := checluster.Spec.K8s.IngressStrategy + ingressStrategy := util.GetValue(checluster.Spec.K8s.IngressStrategy,DefaultIngressStrategy) if len(ingressStrategy) < 1 { ingressStrategy = "multi-host" } diff --git a/pkg/deploy/plugin_registry.go b/pkg/deploy/plugin_registry.go index 74bd563c7..4292e01a0 100644 --- a/pkg/deploy/plugin_registry.go +++ b/pkg/deploy/plugin_registry.go @@ -49,7 +49,8 @@ func SyncPluginRegistryToCluster(checluster *orgv1.CheCluster, clusterAPI Cluste } } - if checluster.Spec.K8s.IngressStrategy == "multi-host" { + ingressStrategy := util.GetValue(checluster.Spec.K8s.IngressStrategy, DefaultIngressStrategy) + if ingressStrategy == "multi-host" { host = PluginRegistry + "-" + checluster.Namespace + "." + checluster.Spec.K8s.IngressDomain } else { host = checluster.Spec.K8s.IngressDomain + "/" + PluginRegistry