Skip to content

Commit

Permalink
[service-waiter] use ide proxy for metric report (gitpod-io#19141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh authored Nov 28, 2023
1 parent fa4f79e commit dfb3dc2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion install/installer/pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ func componentWaiterContainer(ctx *RenderContext, component, labels, image strin
"--gitpod-host",
ctx.Config.Domain,
"--ide-metrics-host",
"http://" + IDEMetricsComponent + ":" + strconv.Itoa(IDEMetricsPort),
ClusterURL("http", IDEProxyComponent, ctx.Namespace, IDEProxyPort),
"--namespace",
ctx.Namespace,
"--component",
Expand Down
9 changes: 4 additions & 5 deletions install/installer/pkg/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package common_test

import (
"fmt"
"strconv"
"testing"

"github.com/gitpod-io/gitpod/common-go/baseserver"
Expand Down Expand Up @@ -59,8 +58,8 @@ func TestPublicApiServerComponentWaiterContainer(t *testing.T) {
container := common.PublicApiServerComponentWaiterContainer(ctx)
labels := common.DefaultLabelSelector(common.PublicApiComponent)
require.Equal(t, labels, "app=gitpod,component=public-api-server")
ideMetricsHost := "http://" + common.IDEMetricsComponent + ":" + strconv.Itoa(common.IDEMetricsPort)
require.Equal(t, []string{"-v", "component", "--gitpod-host", ctx.Config.Domain, "--ide-metrics-host", ideMetricsHost, "--namespace", "test_namespace", "--component", common.PublicApiComponent, "--labels", labels, "--image", ctx.Config.Repository + "/public-api-server:" + "happy_path_papi_image"}, container.Args)
ideProxyHost := common.ClusterURL("http", common.IDEProxyComponent, ctx.Namespace, common.IDEProxyPort)
require.Equal(t, []string{"-v", "component", "--gitpod-host", ctx.Config.Domain, "--ide-metrics-host", ideProxyHost, "--namespace", "test_namespace", "--component", common.PublicApiComponent, "--labels", labels, "--image", ctx.Config.Repository + "/public-api-server:" + "happy_path_papi_image"}, container.Args)
}

func TestServerComponentWaiterContainer(t *testing.T) {
Expand All @@ -73,6 +72,6 @@ func TestServerComponentWaiterContainer(t *testing.T) {
container := common.ServerComponentWaiterContainer(ctx)
labels := common.DefaultLabelSelector(common.ServerComponent)
require.Equal(t, labels, "app=gitpod,component=server")
ideMetricsHost := "http://" + common.IDEMetricsComponent + ":" + strconv.Itoa(common.IDEMetricsPort)
require.Equal(t, []string{"-v", "component", "--gitpod-host", ctx.Config.Domain, "--ide-metrics-host", ideMetricsHost, "--namespace", "test_namespace", "--component", common.ServerComponent, "--labels", labels, "--image", ctx.Config.Repository + "/server:" + "happy_path_server_image"}, container.Args)
ideProxyHost := common.ClusterURL("http", common.IDEProxyComponent, ctx.Namespace, common.IDEProxyPort)
require.Equal(t, []string{"-v", "component", "--gitpod-host", ctx.Config.Domain, "--ide-metrics-host", ideProxyHost, "--namespace", "test_namespace", "--component", common.ServerComponent, "--labels", labels, "--image", ctx.Config.Repository + "/server:" + "happy_path_server_image"}, container.Args)
}
2 changes: 2 additions & 0 deletions install/installer/pkg/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const (
DashboardComponent = "dashboard"
IDEMetricsComponent = "ide-metrics"
IDEMetricsPort = 3000
IDEProxyComponent = "ide-proxy"
IDEProxyPort = 80
)

var (
Expand Down
8 changes: 5 additions & 3 deletions install/installer/pkg/components/ide-proxy/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

package ide_proxy

import "github.com/gitpod-io/gitpod/installer/pkg/common"

const (
Component = "ide-proxy"
ContainerPort = 80
Component = common.IDEProxyComponent
ContainerPort = common.IDEProxyPort
PortName = "http"
ServicePort = 80
ServicePort = common.IDEProxyPort
ReadinessPort = 8080
)

0 comments on commit dfb3dc2

Please sign in to comment.