Skip to content

Commit 7719042

Browse files
author
Simon Emms
committed
[installer]: allow the telemetry component to connect to the server
1 parent 168b2c5 commit 7719042

File tree

5 files changed

+66
-35
lines changed

5 files changed

+66
-35
lines changed

installer/go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@ require (
225225

226226
replace github.com/gitpod-io/gitpod/image-builder => ../components/image-builder-mk3 // leeway
227227

228-
replace github.com/gitpod-io/gitpod/image-builder/api => ../components/image-builder-api/go // leeway
229-
230-
replace github.com/gitpod-io/gitpod/openvsx-proxy => ../components/openvsx-proxy // leeway
231-
232-
replace github.com/gitpod-io/gitpod/ws-scheduler => ../components/ee/ws-scheduler // leeway
233-
234-
replace github.com/gitpod-io/gitpod/ws-proxy => ../components/ws-proxy // leeway
235-
236228
replace github.com/gitpod-io/gitpod/agent-smith => ../components/ee/agent-smith // leeway
237229

238230
replace github.com/gitpod-io/gitpod/blobserve => ../components/blobserve // leeway
@@ -245,17 +237,25 @@ replace github.com/gitpod-io/gitpod/content-service/api => ../components/content
245237

246238
replace github.com/gitpod-io/gitpod/gitpod-protocol => ../components/gitpod-protocol/go // leeway
247239

240+
replace github.com/gitpod-io/gitpod/image-builder/api => ../components/image-builder-api/go // leeway
241+
242+
replace github.com/gitpod-io/gitpod/openvsx-proxy => ../components/openvsx-proxy // leeway
243+
248244
replace github.com/gitpod-io/gitpod/registry-facade => ../components/registry-facade // leeway
249245

250246
replace github.com/gitpod-io/gitpod/registry-facade/api => ../components/registry-facade-api/go // leeway
251247

248+
replace github.com/gitpod-io/gitpod/supervisor/api => ../components/supervisor-api/go // leeway
249+
252250
replace github.com/gitpod-io/gitpod/ws-daemon => ../components/ws-daemon // leeway
253251

254252
replace github.com/gitpod-io/gitpod/ws-daemon/api => ../components/ws-daemon-api/go // leeway
255253

256254
replace github.com/gitpod-io/gitpod/ws-manager/api => ../components/ws-manager-api/go // leeway
257255

258-
replace github.com/gitpod-io/gitpod/supervisor/api => ../components/supervisor-api/go // leeway
256+
replace github.com/gitpod-io/gitpod/ws-proxy => ../components/ws-proxy // leeway
257+
258+
replace github.com/gitpod-io/gitpod/ws-scheduler => ../components/ee/ws-scheduler // leeway
259259

260260
replace k8s.io/api => k8s.io/api v0.22.2 // leeway indirect from components/common-go:lib
261261

installer/pkg/common/constants.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
package common
66

77
import (
8-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"time"
9+
10+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
)
1112

1213
// This file exists to break cyclic-dependency errors
@@ -37,6 +38,7 @@ const (
3738
RegistryFacadeServicePort = 30000
3839
RegistryFacadeTLSCertSecret = "builtin-registry-facade-cert"
3940
ServerComponent = "server"
41+
ServerServicePort = 3000
4042
SystemNodeCritical = "system-node-critical"
4143
WSManagerComponent = "ws-manager"
4244
WSManagerBridgeComponent = "ws-manager-bridge"

installer/pkg/components/gitpod/cronjob.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
6363
Name: "GITPOD_INSTALLATION_VERSION",
6464
Value: ctx.VersionManifest.Version,
6565
},
66+
{
67+
Name: "SERVER_URL",
68+
Value: fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", common.ServerComponent, ctx.Namespace, common.ServerServicePort),
69+
},
6670
},
6771
},
6872
},

installer/pkg/components/server/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ const (
1616
licenseFilePath = "/gitpod/license"
1717
PrometheusPort = 9500
1818
PrometheusPortName = "metrics"
19-
ServicePort = 3000
19+
ServicePort = common.ServerServicePort
2020
)

installer/pkg/components/server/networkpolicy.go

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package server
66

77
import (
88
"github.com/gitpod-io/gitpod/installer/pkg/common"
9+
"github.com/gitpod-io/gitpod/installer/pkg/components/gitpod"
910

1011
networkingv1 "k8s.io/api/networking/v1"
1112
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -26,30 +27,54 @@ func networkpolicy(ctx *common.RenderContext) ([]runtime.Object, error) {
2627
Spec: networkingv1.NetworkPolicySpec{
2728
PodSelector: metav1.LabelSelector{MatchLabels: labels},
2829
PolicyTypes: []networkingv1.PolicyType{"Ingress"},
29-
Ingress: []networkingv1.NetworkPolicyIngressRule{{
30-
Ports: []networkingv1.NetworkPolicyPort{{
31-
Protocol: common.TCPProtocol,
32-
Port: &intstr.IntOrString{IntVal: ContainerPort},
33-
}},
34-
From: []networkingv1.NetworkPolicyPeer{{
35-
PodSelector: &metav1.LabelSelector{MatchLabels: map[string]string{
36-
"component": common.ProxyComponent,
37-
}},
38-
}},
39-
}, {
40-
Ports: []networkingv1.NetworkPolicyPort{{
41-
Protocol: common.TCPProtocol,
42-
Port: &intstr.IntOrString{IntVal: PrometheusPort},
43-
}},
44-
From: []networkingv1.NetworkPolicyPeer{{
45-
NamespaceSelector: &metav1.LabelSelector{MatchLabels: map[string]string{
46-
"chart": common.MonitoringChart,
47-
}},
48-
PodSelector: &metav1.LabelSelector{MatchLabels: map[string]string{
49-
"component": common.ProxyComponent,
50-
}},
51-
}},
52-
}},
30+
Ingress: []networkingv1.NetworkPolicyIngressRule{
31+
{
32+
Ports: []networkingv1.NetworkPolicyPort{
33+
{
34+
Protocol: common.TCPProtocol,
35+
Port: &intstr.IntOrString{IntVal: ContainerPort},
36+
},
37+
},
38+
From: []networkingv1.NetworkPolicyPeer{
39+
{
40+
PodSelector: &metav1.LabelSelector{
41+
MatchLabels: map[string]string{
42+
"component": common.ProxyComponent,
43+
},
44+
},
45+
},
46+
{
47+
PodSelector: &metav1.LabelSelector{
48+
MatchLabels: map[string]string{
49+
"component": gitpod.Component,
50+
},
51+
},
52+
},
53+
},
54+
},
55+
{
56+
Ports: []networkingv1.NetworkPolicyPort{
57+
{
58+
Protocol: common.TCPProtocol,
59+
Port: &intstr.IntOrString{IntVal: PrometheusPort},
60+
},
61+
},
62+
From: []networkingv1.NetworkPolicyPeer{
63+
{
64+
NamespaceSelector: &metav1.LabelSelector{
65+
MatchLabels: map[string]string{
66+
"chart": common.MonitoringChart,
67+
},
68+
},
69+
PodSelector: &metav1.LabelSelector{
70+
MatchLabels: map[string]string{
71+
"component": common.ProxyComponent,
72+
},
73+
},
74+
},
75+
},
76+
},
77+
},
5378
},
5479
}}, nil
5580
}

0 commit comments

Comments
 (0)