Skip to content

fix: Allow UDP traffic between coderd pods for TURN #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions templates/networkpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ spec:
- Ingress
# Deny all ingress traffic, except on our service ports
ingress:
- from: []
ports:
- protocol: TCP
port: 8080
- protocol: TCP
port: 8443
- {}
{{- end }}

{{/* Policies for the built-in PostgreSQL database */}}
Expand Down
24 changes: 1 addition & 23 deletions tests/network_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,13 @@ func TestNetworkPolicyCoder(t *testing.T) {
require.Contains(t, policy.Spec.PolicyTypes, networkingv1.PolicyTypeIngress, "expected to restrict ingress")
require.NotContains(t, policy.Spec.PolicyTypes, networkingv1.PolicyTypeEgress, "expected all egress to be allowed")
require.Empty(t, policy.Spec.Egress, "expected empty egress rules")
protocolTCP := corev1.ProtocolTCP

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

expectedRules := []networkingv1.NetworkPolicyIngressRule{
{
From: []networkingv1.NetworkPolicyPeer{},
Ports: []networkingv1.NetworkPolicyPort{
{
Protocol: &protocolTCP,
Port: &intstr.IntOrString{
Type: intstr.Int,
IntVal: 8080,
},
},
{
Protocol: &protocolTCP,
Port: &intstr.IntOrString{
Type: intstr.Int,
IntVal: 8443,
},
},
},
},
}
require.Equal(t, expectedRules, policy.Spec.Ingress, "expected ingress rules to match")
require.Equal(t, []networkingv1.NetworkPolicyIngressRule{{}}, policy.Spec.Ingress, "expected ingress rules to match")
}

policy, exist = FindNetworkPolicy(objs, "timescale")
Expand Down