Skip to content
Merged
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
23 changes: 23 additions & 0 deletions test/e2e/network_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ var denyAllPolicySpec = allowedPolicyDefinition{
denyAllEgressJustification: "Denies all egress traffic from pods selected by this policy by default, unless explicitly allowed by other policy rules, minimizing potential exfiltration paths.",
}

var prometheuSpec = allowedPolicyDefinition{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling error or intentional word play: prometheuSpec??

selector: metav1.LabelSelector{MatchLabels: map[string]string{"app.kubernetes.io/name": "prometheus"}},
policyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkingv1.PolicyTypeEgress},
ingressRule: ingressRule{
ports: []portWithJustification{
{
port: nil,
justification: "Allows access to the prometheus pod",
},
},
},
egressRule: egressRule{
ports: []portWithJustification{
{
port: nil,
justification: "Allows prometheus to access other pods",
},
},
},
}

// Ref: https://docs.google.com/document/d/1bHEEWzA65u-kjJFQRUY1iBuMIIM1HbPy4MeDLX4NI3o/edit?usp=sharing
var allowedNetworkPolicies = map[string]allowedPolicyDefinition{
"catalogd-controller-manager": {
Expand Down Expand Up @@ -163,6 +184,8 @@ func TestNetworkPolicyJustifications(t *testing.T) {
} else {
t.Log("Detected single-namespace configuration, expecting one 'default-deny-all-traffic' policy.")
allowedNetworkPolicies["default-deny-all-traffic"] = denyAllPolicySpec
t.Log("Detected single-namespace configuration, expecting 'prometheus' policy.")
allowedNetworkPolicies["prometheus"] = prometheuSpec
}

validatedRegistryPolicies := make(map[string]bool)
Expand Down