Skip to content

Commit 192bedf

Browse files
author
Simon Emms
committed
[installer]: allow the telemetry component to connect to the server
1 parent 1f868f4 commit 192bedf

File tree

5 files changed

+79
-46
lines changed

5 files changed

+79
-46
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: 62 additions & 35 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"
@@ -16,40 +17,66 @@ import (
1617
func networkpolicy(ctx *common.RenderContext) ([]runtime.Object, error) {
1718
labels := common.DefaultLabels(Component)
1819

19-
return []runtime.Object{&networkingv1.NetworkPolicy{
20-
TypeMeta: common.TypeMetaNetworkPolicy,
21-
ObjectMeta: metav1.ObjectMeta{
22-
Name: Component,
23-
Namespace: ctx.Namespace,
24-
Labels: labels,
20+
return []runtime.Object{
21+
&networkingv1.NetworkPolicy{
22+
TypeMeta: common.TypeMetaNetworkPolicy,
23+
ObjectMeta: metav1.ObjectMeta{
24+
Name: Component,
25+
Namespace: ctx.Namespace,
26+
Labels: labels,
27+
},
28+
Spec: networkingv1.NetworkPolicySpec{
29+
PodSelector: metav1.LabelSelector{MatchLabels: labels},
30+
PolicyTypes: []networkingv1.PolicyType{"Ingress"},
31+
Ingress: []networkingv1.NetworkPolicyIngressRule{
32+
{
33+
Ports: []networkingv1.NetworkPolicyPort{
34+
{
35+
Protocol: common.TCPProtocol,
36+
Port: &intstr.IntOrString{IntVal: ContainerPort},
37+
},
38+
},
39+
From: []networkingv1.NetworkPolicyPeer{
40+
{
41+
PodSelector: &metav1.LabelSelector{
42+
MatchLabels: map[string]string{
43+
"component": common.ProxyComponent,
44+
},
45+
},
46+
},
47+
{
48+
PodSelector: &metav1.LabelSelector{
49+
MatchLabels: map[string]string{
50+
"component": gitpod.Component,
51+
},
52+
},
53+
},
54+
},
55+
},
56+
{
57+
Ports: []networkingv1.NetworkPolicyPort{
58+
{
59+
Protocol: common.TCPProtocol,
60+
Port: &intstr.IntOrString{IntVal: PrometheusPort},
61+
},
62+
},
63+
From: []networkingv1.NetworkPolicyPeer{
64+
{
65+
NamespaceSelector: &metav1.LabelSelector{
66+
MatchLabels: map[string]string{
67+
"chart": common.MonitoringChart,
68+
},
69+
},
70+
PodSelector: &metav1.LabelSelector{
71+
MatchLabels: map[string]string{
72+
"component": common.ProxyComponent,
73+
},
74+
},
75+
},
76+
},
77+
},
78+
},
79+
},
2580
},
26-
Spec: networkingv1.NetworkPolicySpec{
27-
PodSelector: metav1.LabelSelector{MatchLabels: labels},
28-
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-
}},
53-
},
54-
}}, nil
81+
}, nil
5582
}

0 commit comments

Comments
 (0)