Skip to content

Commit 073a9ad

Browse files
authored
fix: Allow UDP traffic between coderd pods for TURN (#242)
This fixes TURN for larger-scale deployments which require high-availability.
1 parent 9716eb0 commit 073a9ad

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

templates/networkpolicies.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ spec:
4545
- Ingress
4646
# Deny all ingress traffic, except on our service ports
4747
ingress:
48-
- from: []
49-
ports:
50-
- protocol: TCP
51-
port: 8080
52-
- protocol: TCP
53-
port: 8443
48+
- {}
5449
{{- end }}
5550

5651
{{/* Policies for the built-in PostgreSQL database */}}

tests/network_policy_test.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,35 +81,13 @@ func TestNetworkPolicyCoder(t *testing.T) {
8181
require.Contains(t, policy.Spec.PolicyTypes, networkingv1.PolicyTypeIngress, "expected to restrict ingress")
8282
require.NotContains(t, policy.Spec.PolicyTypes, networkingv1.PolicyTypeEgress, "expected all egress to be allowed")
8383
require.Empty(t, policy.Spec.Egress, "expected empty egress rules")
84-
protocolTCP := corev1.ProtocolTCP
8584

8685
podSelector := &metav1.LabelSelector{}
8786
metav1.AddLabelToSelector(podSelector, "app.kubernetes.io/instance", "coder")
8887
metav1.AddLabelToSelector(podSelector, "app.kubernetes.io/component", "coderd")
8988
require.Equal(t, podSelector, &policy.Spec.PodSelector, "expected pod selectors to match")
9089

91-
expectedRules := []networkingv1.NetworkPolicyIngressRule{
92-
{
93-
From: []networkingv1.NetworkPolicyPeer{},
94-
Ports: []networkingv1.NetworkPolicyPort{
95-
{
96-
Protocol: &protocolTCP,
97-
Port: &intstr.IntOrString{
98-
Type: intstr.Int,
99-
IntVal: 8080,
100-
},
101-
},
102-
{
103-
Protocol: &protocolTCP,
104-
Port: &intstr.IntOrString{
105-
Type: intstr.Int,
106-
IntVal: 8443,
107-
},
108-
},
109-
},
110-
},
111-
}
112-
require.Equal(t, expectedRules, policy.Spec.Ingress, "expected ingress rules to match")
90+
require.Equal(t, []networkingv1.NetworkPolicyIngressRule{{}}, policy.Spec.Ingress, "expected ingress rules to match")
11391
}
11492

11593
policy, exist = FindNetworkPolicy(objs, "timescale")

0 commit comments

Comments
 (0)