Skip to content

Commit 6c4a975

Browse files
author
Simon Emms
committed
[installer]: allow the telemetry component to connect to the server
1 parent 6bd3ff7 commit 6c4a975

File tree

6 files changed

+100
-57
lines changed

6 files changed

+100
-57
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const (
3838
RegistryFacadeServicePort = 30000
3939
RegistryFacadeTLSCertSecret = "builtin-registry-facade-cert"
4040
ServerComponent = "server"
41+
ServerInstallationAdminPort = 9000
4142
SystemNodeCritical = "system-node-critical"
4243
WSManagerComponent = "ws-manager"
4344
WSManagerBridgeComponent = "ws-manager-bridge"

installer/pkg/components/gitpod/cronjob.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package gitpod
66

77
import (
8-
"crypto/sha512"
98
"fmt"
109

1110
"github.com/gitpod-io/gitpod/installer/pkg/common"
@@ -55,14 +54,14 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
5554
"send",
5655
},
5756
Env: []v1.EnvVar{
58-
{
59-
Name: "GITPOD_DOMAIN_HASH",
60-
Value: fmt.Sprintf("%x", sha512.Sum512([]byte(ctx.Config.Domain))),
61-
},
6257
{
6358
Name: "GITPOD_INSTALLATION_VERSION",
6459
Value: ctx.VersionManifest.Version,
6560
},
61+
{
62+
Name: "SERVER_URL",
63+
Value: fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", common.ServerComponent, ctx.Namespace, common.ServerInstallationAdminPort),
64+
},
6665
},
6766
},
6867
},

installer/pkg/components/server/constants.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import (
99
)
1010

1111
const (
12-
Component = common.ServerComponent
13-
ContainerPort = 3000
14-
ContainerPortName = "http"
15-
authProviderFilePath = "/gitpod/auth-providers"
16-
licenseFilePath = "/gitpod/license"
17-
PrometheusPort = 9500
18-
PrometheusPortName = "metrics"
19-
ServicePort = 3000
12+
Component = common.ServerComponent
13+
ContainerPort = 3000
14+
ContainerPortName = "http"
15+
authProviderFilePath = "/gitpod/auth-providers"
16+
licenseFilePath = "/gitpod/license"
17+
PrometheusPort = 9500
18+
PrometheusPortName = "metrics"
19+
InstallationAdminPort = common.ServerInstallationAdminPort
20+
InstallationAdminName = "installation-admin"
21+
ServicePort = 3000
2022
)

installer/pkg/components/server/networkpolicy.go

Lines changed: 72 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,76 @@ 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+
},
49+
{
50+
Ports: []networkingv1.NetworkPolicyPort{
51+
{
52+
Protocol: common.TCPProtocol,
53+
Port: &intstr.IntOrString{IntVal: PrometheusPort},
54+
},
55+
},
56+
From: []networkingv1.NetworkPolicyPeer{
57+
{
58+
NamespaceSelector: &metav1.LabelSelector{
59+
MatchLabels: map[string]string{
60+
"chart": common.MonitoringChart,
61+
},
62+
},
63+
PodSelector: &metav1.LabelSelector{
64+
MatchLabels: map[string]string{
65+
"component": common.ProxyComponent,
66+
},
67+
},
68+
},
69+
},
70+
},
71+
{
72+
Ports: []networkingv1.NetworkPolicyPort{
73+
{
74+
Protocol: common.TCPProtocol,
75+
Port: &intstr.IntOrString{IntVal: InstallationAdminPort},
76+
},
77+
},
78+
From: []networkingv1.NetworkPolicyPeer{
79+
{
80+
PodSelector: &metav1.LabelSelector{
81+
MatchLabels: map[string]string{
82+
"component": gitpod.Component,
83+
},
84+
},
85+
},
86+
},
87+
},
88+
},
89+
},
2590
},
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
91+
}, nil
5592
}

installer/pkg/components/server/objects.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ var Objects = common.CompositeRenderFunc(
2525
ContainerPort: PrometheusPort,
2626
ServicePort: PrometheusPort,
2727
},
28+
InstallationAdminName: {
29+
ContainerPort: InstallationAdminPort,
30+
ServicePort: InstallationAdminPort,
31+
},
2832
}),
2933
common.DefaultServiceAccount(Component),
3034
)

0 commit comments

Comments
 (0)