Skip to content

Commit e646c7e

Browse files
committed
Add npep-230 dry-run mode.
Signed-off-by: Nadia Pinaeva <[email protected]>
1 parent fd452b1 commit e646c7e

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

npeps/npep-230-dry-run.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# NPEP-95: NPEP template
2+
3+
* Issue: [#230](https://github.com/kubernetes-sigs/network-policy-api/issues/230)
4+
* Status: Provisional
5+
6+
## TLDR
7+
8+
Add dry-run mode for (B)ANP to allow "disabling" policies without deleting them.
9+
This should allow implementations add extra audit/monitoring/logging capabilities on top of this feature.
10+
11+
## Goals
12+
13+
A (B)ANP dry-run mode should not affect any connections, i.e. it should be treated as if did not exist.
14+
Networking plugins can interpret the contents of the object to provide feedback (e.g. via logging or observability tools)
15+
to see which connections will be dropped/allowed once this (B)ANP is enforced.
16+
17+
## Non-Goals
18+
19+
Define exact logging/observability formats for network plugins.
20+
21+
## Introduction
22+
23+
Users may want to ensure no unexpected connections will be denied by a new (B)ANP.
24+
A dry-run mode should not affect any connections, and allow the networking plugin to provide feedback
25+
(e.g. via logging or observability tools) to see which connections will be dropped/allowed once this (B)ANP is enforced.
26+
27+
## User-Stories/Use-Cases
28+
29+
As a cluster admin, I am designing new ANPs for my cluster and want to make sure applying them won't
30+
have any unexpected effects. To do so, I want to apply ANPs in a dry-run mode and get feedback from the network
31+
plugin on which connections would be dropped/allowed.
32+
33+
As a cluster admin, I want to get feedback from the network plugin for currently allowed/denied connections
34+
with (B)ANP.
35+
This one needs more discussion as it is already do-able with extra labels/annotations, because adding
36+
logging/audit/observability while enforcing (B)ANP is a side effect and doesn't break (B)ANP semantics.
37+
But since we are considering adding a new flag, it may be useful to add this option with vague description, like
38+
"Enables logging/audit/observability as defined by the networking plugin. May also have no effect is the plugin doesn't support it."
39+
40+
### Dry-run for changing an existing (B)ANP
41+
42+
Calico's StagedPolicy allows analyzing the effect of changing an existing policy. That approach requires a new CRD (StagedPolicy),
43+
that is an exact copy of the original policy, then you can create a StagedPolicy with the same name as an already existing policy,
44+
and that would meat that you intend to replace the existing policy with the staged one.
45+
46+
Besides a new CRD, this approach also requires some extra simulation logic, because existing policy should be applied on
47+
one hand, and be replaced in the simulation on the other hand.
48+
49+
Simulating the (B)ANP change is possible with the simple dry-run mode, but it requires creating a new (B)ANP representing
50+
the "diff" between existing and a new policy config. This approach is less user-friendly though.
51+
52+
## API
53+
54+
(... details, can point to PR with changes)
55+
56+
## Conformance Details
57+
58+
(This section describes the names to be used for the feature or
59+
features in conformance tests and profiles.
60+
61+
These should be `CamelCase` names that specify the feature as
62+
precisely as possible, and are particularly important for
63+
Extended features, since they may be surfaced to users.)
64+
65+
## Alternatives
66+
67+
- Use Policy Assistant https://github.com/kubernetes-sigs/network-policy-api/issues/221, may have some limitations. Needs additional discussion.
68+
- Leave it to be implementation-specific. This required a copy of ANP CRD that changes behaviour (doesn't really apply) with dry-run flag.
69+
70+
## References
71+
72+
Similar features:
73+
- calico: https://docs.tigera.io/calico-cloud/network-policy/staged-network-policies
74+
- cilium Issue: https://github.com/cilium/cilium/issues/9580
75+

0 commit comments

Comments
 (0)