-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add ginkgo default-allow tests
Add some tests that create various mixtures of default-allow and default-deny policies. It is important that default-deny policies always take precedence over default-allow. It is also important that Deny rules take precedence over default-allow. These need to be integration tests, since they rely on specific interactions between the userspace and bpf policy engines. Signed-off-by: Casey Callendrello <cdc@isovalent.com>
- Loading branch information
Showing
6 changed files
with
186 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/k8s/manifests/ccnp-allow-apiserver-default-allow.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: "cilium.io/v2" | ||
kind: CiliumClusterwideNetworkPolicy | ||
metadata: | ||
name: ccnp-allow-apiserver-default-allow | ||
spec: | ||
endpointSelector: {} | ||
enableDefaultDeny: | ||
egress: false | ||
egress: | ||
- toEntities: | ||
- kube-apiserver | ||
- toEntities: | ||
- all | ||
toPorts: | ||
- ports: | ||
- port: "53" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: "cilium.io/v2" | ||
kind: CiliumNetworkPolicy | ||
metadata: | ||
name: deny-to-app1-default-allow | ||
spec: | ||
enableDefaultDeny: | ||
egress: false | ||
endpointSelector: | ||
matchLabels: | ||
id: app2 | ||
egressDeny: | ||
- toEndpoints: | ||
- matchLabels: | ||
id: app1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: "cilium.io/v2" | ||
kind: CiliumNetworkPolicy | ||
metadata: | ||
name: "l7-policy-default-allow" | ||
spec: | ||
description: "L7 policy for getting started using Kubernetes guide" | ||
endpointSelector: | ||
matchLabels: | ||
id: app1 | ||
enableDefaultDeny: | ||
ingress: false | ||
ingress: | ||
- fromEndpoints: | ||
- matchLabels: | ||
id: app2 | ||
toPorts: | ||
- ports: | ||
- port: "80" | ||
protocol: TCP | ||
rules: | ||
http: | ||
- method: "GET" | ||
path: "/public" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters