From 84dd6135e7f777033ea1faec8d73a6dc585f9ade Mon Sep 17 00:00:00 2001 From: Sergii Leshchenko Date: Mon, 6 Apr 2020 16:33:38 +0300 Subject: [PATCH] Use protocol from plugin definition for servers Signed-off-by: Sergii Leshchenko --- .../workspace/runtime/runtime_annotation.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/controller/workspace/runtime/runtime_annotation.go b/pkg/controller/workspace/runtime/runtime_annotation.go index c444871d8..72e9206c1 100644 --- a/pkg/controller/workspace/runtime/runtime_annotation.go +++ b/pkg/controller/workspace/runtime/runtime_annotation.go @@ -16,6 +16,7 @@ import ( "encoding/json" "fmt" "github.com/che-incubator/che-workspace-operator/pkg/apis/workspace/v1alpha1" + "strings" ) func ConstructRuntimeAnnotation(components []v1alpha1.ComponentDescription, endpoints map[string][]v1alpha1.ExposedEndpoint) (string, error) { @@ -47,10 +48,18 @@ func getMachinesAnnotation(components []v1alpha1.ComponentDescription, endpoints for _, endpoint := range endpoints[containerName] { protocol := endpoint.Attributes[v1alpha1.PROTOCOL_ENDPOINT_ATTRIBUTE] + url := strings.SplitN(endpoint.Url, "://", 2) + var host string + if len(url) == 2 { + host = url[1] + } else { + //can't separate protocol from URL. fallthrough with full URL + host = endpoint.Url + } servers[endpoint.Name] = v1alpha1.CheWorkspaceServer{ Attributes: endpoint.Attributes, Status: v1alpha1.RunningServerStatus, // TODO: This is just set so the circles are green - URL: fmt.Sprintf("%s://%s", protocol, endpoint.Url), + URL: fmt.Sprintf("%s://%s", protocol, host), } } machines[containerName] = v1alpha1.CheWorkspaceMachine{