Skip to content

Commit

Permalink
Use protocol from plugin definition for servers
Browse files Browse the repository at this point in the history
Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
  • Loading branch information
sleshchenko committed Apr 6, 2020
1 parent ce940d2 commit 84dd613
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/controller/workspace/runtime/runtime_annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 84dd613

Please sign in to comment.