Skip to content

Commit e946837

Browse files
author
Andrew Farries
committed
Add gRPC config to usage configmap
1 parent dd669a6 commit e946837

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

install/installer/pkg/components/usage/configmap.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ package usage
55

66
import (
77
"fmt"
8-
"github.com/gitpod-io/gitpod/usage/pkg/server"
98
"time"
109

10+
"github.com/gitpod-io/gitpod/common-go/baseserver"
11+
"github.com/gitpod-io/gitpod/usage/pkg/server"
12+
1113
"github.com/gitpod-io/gitpod/installer/pkg/common"
1214
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
1315
corev1 "k8s.io/api/core/v1"
@@ -18,6 +20,13 @@ import (
1820
func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
1921
cfg := server.Config{
2022
ControllerSchedule: time.Hour.String(),
23+
Server: &baseserver.Configuration{
24+
Services: baseserver.ServicesConfiguration{
25+
GRPC: &baseserver.ServerConfiguration{
26+
Address: fmt.Sprintf(":%d", gRPCContainerPort),
27+
},
28+
},
29+
},
2130
}
2231

2332
_ = ctx.WithExperimental(func(ucfg *experimental.Config) error {

install/installer/pkg/components/usage/configmap_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,19 @@ func TestConfigMap_ContainsSchedule(t *testing.T) {
2020
cfgmap, ok := objs[0].(*corev1.ConfigMap)
2121
require.True(t, ok)
2222

23-
require.JSONEq(t, cfgmap.Data[configJSONFilename], `{"controllerSchedule": "2m", "stripeCredentialsFile": "stripe-secret/apikeys"}`)
23+
require.JSONEq(t,
24+
`{
25+
"controllerSchedule": "2m",
26+
"stripeCredentialsFile": "stripe-secret/apikeys",
27+
"server": {
28+
"services": {
29+
"grpc": {
30+
"address": ":9001",
31+
"tls": null
32+
}
33+
}
34+
}
35+
}`,
36+
cfgmap.Data[configJSONFilename],
37+
)
2438
}

install/installer/pkg/components/usage/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package usage
66

77
const (
88
Component = "usage"
9+
gRPCContainerPort = 9001
910
stripeSecretMountPath = "stripe-secret"
1011
stripeKeyFilename = "apikeys"
1112
configJSONFilename = "config.json"

0 commit comments

Comments
 (0)