Fix getting exposure strategy in case of k8s (#766)
* Fix getting exposure strategy in case of k8s Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/767/head
parent
236f7ab5de
commit
268899efa6
|
|
@ -994,7 +994,7 @@ func getDefaultCheHost(deployContext *deploy.DeployContext) (string, error) {
|
|||
}
|
||||
|
||||
func getServerExposingServiceName(cr *orgv1.CheCluster) string {
|
||||
if util.GetValue(cr.Spec.Server.ServerExposureStrategy, deploy.DefaultServerExposureStrategy) == "single-host" && deploy.GetSingleHostExposureType(cr) == "gateway" {
|
||||
if util.GetServerExposureStrategy(cr) == "single-host" && deploy.GetSingleHostExposureType(cr) == "gateway" {
|
||||
return gateway.GatewayServiceName
|
||||
}
|
||||
return deploy.CheServiceName
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func Expose(
|
|||
routeCustomSettings orgv1.RouteCustomSettings,
|
||||
ingressCustomSettings orgv1.IngressCustomSettings,
|
||||
component string) (endpont string, done bool, err error) {
|
||||
exposureStrategy := util.GetValue(deployContext.CheCluster.Spec.Server.ServerExposureStrategy, deploy.DefaultServerExposureStrategy)
|
||||
exposureStrategy := util.GetServerExposureStrategy(deployContext.CheCluster)
|
||||
var domain string
|
||||
var endpoint string
|
||||
var pathPrefix string
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ var (
|
|||
|
||||
// SyncGatewayToCluster installs or deletes the gateway based on the custom resource configuration
|
||||
func SyncGatewayToCluster(deployContext *deploy.DeployContext) error {
|
||||
if util.GetValue(deployContext.CheCluster.Spec.Server.ServerExposureStrategy, deploy.DefaultServerExposureStrategy) == "single-host" &&
|
||||
if util.GetServerExposureStrategy(deployContext.CheCluster) == "single-host" &&
|
||||
(deploy.GetSingleHostExposureType(deployContext.CheCluster) == "gateway") {
|
||||
return syncAll(deployContext)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func GetIngressSpec(
|
|||
component string) *v1beta1.Ingress {
|
||||
|
||||
tlsSupport := deployContext.CheCluster.Spec.Server.TlsSupport
|
||||
ingressStrategy := util.GetValue(deployContext.CheCluster.Spec.Server.ServerExposureStrategy, DefaultServerExposureStrategy)
|
||||
ingressStrategy := util.GetServerExposureStrategy(deployContext.CheCluster)
|
||||
ingressDomain := deployContext.CheCluster.Spec.K8s.IngressDomain
|
||||
ingressClass := util.GetValue(deployContext.CheCluster.Spec.K8s.IngressClass, DefaultIngressClass)
|
||||
labels := GetLabels(deployContext.CheCluster, component)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ func GetCheConfigMapData(deployContext *deploy.DeployContext) (cheEnv map[string
|
|||
chePostgresDb := util.GetValue(deployContext.CheCluster.Spec.Database.ChePostgresDb, deploy.DefaultChePostgresDb)
|
||||
keycloakRealm := util.GetValue(deployContext.CheCluster.Spec.Auth.IdentityProviderRealm, cheFlavor)
|
||||
keycloakClientId := util.GetValue(deployContext.CheCluster.Spec.Auth.IdentityProviderClientId, cheFlavor+"-public")
|
||||
ingressStrategy := util.GetValue(deployContext.CheCluster.Spec.Server.ServerExposureStrategy, deploy.DefaultServerExposureStrategy)
|
||||
ingressStrategy := util.GetServerExposureStrategy(deployContext.CheCluster)
|
||||
ingressClass := util.GetValue(deployContext.CheCluster.Spec.K8s.IngressClass, deploy.DefaultIngressClass)
|
||||
devfileRegistryURL := deployContext.CheCluster.Status.DevfileRegistryURL
|
||||
pluginRegistryURL := deployContext.CheCluster.Status.PluginRegistryURL
|
||||
|
|
|
|||
|
|
@ -482,6 +482,26 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry.eclipse-che.svc:8080",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Kubernetes strategy should be set correctly",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
K8s: orgv1.CheClusterSpecK8SOnly{
|
||||
IngressStrategy: "single-host",
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_INFRA_KUBERNETES_SERVER__STRATEGY": "single-host",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
|
|
|||
Loading…
Reference in New Issue