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

[DISCUSSION] add a name or description to a NetworkPolicy rule #28

Open
jianjuns opened this issue Sep 10, 2020 · 2 comments
Open

[DISCUSSION] add a name or description to a NetworkPolicy rule #28

jianjuns opened this issue Sep 10, 2020 · 2 comments

Comments

@jianjuns
Copy link

I want to add an name or description string to a single NetworkPolicy rule in the NetworkPolicy spec, which helps me to remember the rule, and also helps visualization and analytics of NetworkPolicy rules from an external console or policy/traffic analyzer.

A readable string can help users to remember and understand the rules, and can also be used to identify a rule in the exported policy metrics and network flows (when the NetworkPolicy and rule information is appended to the metrics or flow records).

@McCodeman @abhiraut

@jayunit100
Copy link
Owner

jayunit100 commented Sep 15, 2020

So you could always make an annotation on the object right? :)

Lets discuss further in this thread if you think annotations aren't good enough for this use case

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  annotations:
    casey: calico
    jayunit100: everything
    jiunjen: antrea
spec:
  ingress:
  - {}
  podSelector:
    matchLabels:
      unique: "8"
  policyTypes:
  - Ingress

@jayunit100 jayunit100 changed the title [User story proposal] add a name or description to a NetworkPolicy rule [DISCUSSION] add a name or description to a NetworkPolicy rule Sep 15, 2020
@jianjuns
Copy link
Author

jianjuns commented Sep 15, 2020

I meant a single rule, but not the whole NetworkPolicy, something like this:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  spec:
    ingress:
      - name: allow-172.17-block
      from:
        ipBlock:
          cidr: 172.17.0.0/16
      - name: allow-frontend
      from:
        podSelector:
          matchLabels:
            role: frontend
    podSelector:
      matchLabels:
        unique: "8"

It helps when you have a large number of rules (esp. when the rules are with complex source/destination definitions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants