Skip to content

Commit 2c1ff94

Browse files
authored
[server] Expose gRPC API port to public-api & usage (#17032)
1 parent cb2c148 commit 2c1ff94

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

install/installer/pkg/common/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const (
4343
SystemNodeCritical = "system-node-critical"
4444
PaymentEndpointComponent = "payment-endpoint"
4545
PublicApiComponent = "public-api-server"
46+
UsageComponent = "usage"
4647
WSManagerComponent = "ws-manager"
4748
WSManagerMk2Component = "ws-manager-mk2"
4849
WSManagerBridgeComponent = "ws-manager-bridge"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ const (
2929
AdminCredentialsSecretName = "admin-credentials"
3030
AdminCredentialsSecretMountPath = "/credentials/admin"
3131
AdminCredentialsSecretKey = "admin.json"
32+
33+
GRPCAPIName = "grpc"
34+
GRPCAPIPort = 9877
3235
)

install/installer/pkg/components/server/deployment.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
351351
}, {
352352
Name: DebugNodePortName,
353353
ContainerPort: common.DebugNodePort,
354+
}, {
355+
Name: GRPCAPIName,
356+
ContainerPort: GRPCAPIPort,
354357
},
355358
},
356359
// todo(sje): do we need to cater for serverContainer.env from values.yaml?

install/installer/pkg/components/server/networkpolicy.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ func Networkpolicy(ctx *common.RenderContext, component string) ([]runtime.Objec
121121
},
122122
},
123123
},
124+
{
125+
Ports: []networkingv1.NetworkPolicyPort{
126+
{
127+
Protocol: common.TCPProtocol,
128+
Port: &intstr.IntOrString{IntVal: GRPCAPIPort},
129+
},
130+
},
131+
From: []networkingv1.NetworkPolicyPeer{
132+
{
133+
PodSelector: &metav1.LabelSelector{
134+
MatchLabels: map[string]string{
135+
"app": "gitpod",
136+
"component": common.PublicApiComponent,
137+
},
138+
},
139+
},
140+
{
141+
PodSelector: &metav1.LabelSelector{
142+
MatchLabels: map[string]string{
143+
"app": "gitpod",
144+
"component": common.UsageComponent,
145+
},
146+
},
147+
},
148+
},
149+
},
124150
},
125151
},
126152
},

install/installer/pkg/components/server/objects.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ var Objects = common.CompositeRenderFunc(
5353
ContainerPort: common.DebugNodePort,
5454
ServicePort: common.DebugNodePort,
5555
},
56+
{
57+
Name: GRPCAPIName,
58+
ContainerPort: GRPCAPIPort,
59+
ServicePort: GRPCAPIPort,
60+
},
5661
}),
5762
common.DefaultServiceAccount(Component),
5863
)

0 commit comments

Comments
 (0)