Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Jun 11, 2021
1 parent 12a291c commit 76fa6af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
7 changes: 7 additions & 0 deletions pkg/deploy/dev-workspace/dev_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/eclipse-che/che-operator/pkg/deploy"
"github.com/eclipse-che/che-operator/pkg/util"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/sirupsen/logrus"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -105,6 +106,12 @@ var (
)

func ReconcileDevWorkspace(deployContext *deploy.DeployContext) (bool, error) {
if !util.IsOpenShift && util.GetServerExposureStrategy(deployContext.CheCluster) == "single-host" {
logrus.Warn("DevWorkspace Che operator can't be enabled in 'single-host mode'. See https://github.com/eclipse/che/issues/19714 for more details.")
logrus.Warn("To enable DevWorkspace Che operator set 'spec.server.serverExposureStrategy' to 'multi-host'.")
return true, nil
}

for _, syncItem := range syncDwCheItems {
done, err := syncItem(deployContext)
if !util.IsTestMode() {
Expand Down
21 changes: 12 additions & 9 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,20 @@ func MergeMaps(first map[string]string, second map[string]string) map[string]str
return ret
}

func GetServerExposureStrategy(c *orgv1.CheCluster) string {
strategy := c.Spec.Server.ServerExposureStrategy
if strategy != "" {
return strategy
} else if c.Spec.DevWorkspace.Enable {
return "single-host"
} else if IsOpenShift {
func GetServerExposureStrategy(cheCluster *orgv1.CheCluster) string {
if cheCluster.Spec.Server.ServerExposureStrategy != "" {
return cheCluster.Spec.Server.ServerExposureStrategy
}

if IsOpenShift {
// Explicitly switch to `single-host` mode
if cheCluster.Spec.DevWorkspace.Enable {
return "single-host"
}
return "multi-host"
} else {
return GetValue(c.Spec.K8s.IngressStrategy, "multi-host")
}

return GetValue(cheCluster.Spec.K8s.IngressStrategy, "multi-host")
}

func IsTestMode() (isTesting bool) {
Expand Down

0 comments on commit 76fa6af

Please sign in to comment.