Skip to content
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

NPEP-230: Add dry-run mode. #276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

npinaeva
Copy link
Member

Tracking issue #230

Signed-off-by: Nadia Pinaeva <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 19, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: npinaeva
Once this PR has been reviewed and has the lgtm label, please assign aojea for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for kubernetes-sigs-network-policy-api ready!

Name Link
🔨 Latest commit 263054f
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-network-policy-api/deploys/673c6c53d246380008b6f6a6
😎 Deploy Preview https://deploy-preview-276--kubernetes-sigs-network-policy-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 19, 2024

## Goals

A dry-run mode should not affect any connections, and allow the networking plugin to provide feedback
Copy link

Choose a reason for hiding this comment

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

Let's be more clear on this:

  • A NetworkPolicy object in dry-run mode will not enforce any K8s network policy semantics e.g. it should be treated as if it did not exist. Controllers are free to interpret the contents of the object for purposes of observability/debugging however.


## TLDR

Add dry-run mode for (B)ANP to allow "disabling" policies without deleting them.
Copy link

Choose a reason for hiding this comment

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

Why is this not also a proposal for NetworkPolicy itself?

## References

Similar features:
- calico: https://docs.tigera.io/calico-cloud/network-policy/staged-network-policies
Copy link

Choose a reason for hiding this comment

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

I talked to the folks that designed Calico's staged policy and I asked why we added a second resource type StagedNetworkPolicy instead of an "enforced" flag. The answer was that it allows for staging a change to an existing policy as well as staging a completely new policy. You can have a staged network policy with name "foo" and order 123 as well as an unstaged one with the same name and order. Then the staged version should replace the active one when simulating the upcoming policy verdict.

That's not quite the same as creating a second policy at the same order with a different name; it wouldn't be clear if the user is asking us to simulate both policies being present or only the new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants