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

kubectl neat removes field from network policy #85

Closed
aoz-turk opened this issue Sep 29, 2022 · 1 comment
Closed

kubectl neat removes field from network policy #85

aoz-turk opened this issue Sep 29, 2022 · 1 comment

Comments

@aoz-turk
Copy link

aoz-turk commented Sep 29, 2022

Hi,

https://kubernetes.io/docs/concepts/services-networking/network-policies/#default-deny-all-egress-traffic
https://kubernetes.io/docs/concepts/services-networking/network-policies/#allow-all-egress-traffic

If we use kubectl neat with two yaml files above, the end results are the same. However for network policies, removing the block below changes the behaviour.

  egress:
  - {}

An example:

cat n.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  egress:
  - {}
  policyTypes:
  - Egress

kubectl neat -f n.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  policyTypes:
  - Egress

Expected output:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  egress:
  - {}
  policyTypes:
  - Egress

Thanks!

@itaysk
Copy link
Owner

itaysk commented Jul 12, 2024

duplicate of #18

@itaysk itaysk closed this as completed Jul 12, 2024
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