Skip to content

Commit f35e188

Browse files
Simon Emmsroboquat
Simon Emms
authored andcommitted
[installer]: allow the telemetry component to connect to the server
1 parent 58016cd commit f35e188

File tree

6 files changed

+100
-49
lines changed

6 files changed

+100
-49
lines changed

installer/go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,25 @@ replace github.com/gitpod-io/gitpod/content-service/api => ../components/content
242242

243243
replace github.com/gitpod-io/gitpod/gitpod-protocol => ../components/gitpod-protocol/go // leeway
244244

245+
replace github.com/gitpod-io/gitpod/image-builder/api => ../components/image-builder-api/go // leeway
246+
247+
replace github.com/gitpod-io/gitpod/openvsx-proxy => ../components/openvsx-proxy // leeway
248+
245249
replace github.com/gitpod-io/gitpod/registry-facade => ../components/registry-facade // leeway
246250

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

253+
replace github.com/gitpod-io/gitpod/supervisor/api => ../components/supervisor-api/go // leeway
254+
249255
replace github.com/gitpod-io/gitpod/ws-daemon => ../components/ws-daemon // leeway
250256

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

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

255-
replace github.com/gitpod-io/gitpod/supervisor/api => ../components/supervisor-api/go // leeway
261+
replace github.com/gitpod-io/gitpod/ws-proxy => ../components/ws-proxy // leeway
262+
263+
replace github.com/gitpod-io/gitpod/ws-scheduler => ../components/ee/ws-scheduler // leeway
256264

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

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"
@@ -60,14 +59,14 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
6059
"send",
6160
},
6261
Env: []v1.EnvVar{
63-
{
64-
Name: "GITPOD_DOMAIN_HASH",
65-
Value: fmt.Sprintf("%x", sha512.Sum512([]byte(ctx.Config.Domain))),
66-
},
6762
{
6863
Name: "GITPOD_INSTALLATION_VERSION",
6964
Value: ctx.VersionManifest.Version,
7065
},
66+
{
67+
Name: "SERVER_URL",
68+
Value: fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", common.ServerComponent, ctx.Namespace, common.ServerInstallationAdminPort),
69+
},
7170
},
7271
},
7372
},

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)