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

Add other network policy options #797

Merged
merged 1 commit into from
Mar 8, 2021
Merged

Conversation

Sean-Holcomb
Copy link
Contributor

@Sean-Holcomb Sean-Holcomb commented Feb 25, 2021

Tested flags with helm template
networkPolicy:
enabled: true
denyEgress: true

Source: cost-analyzer/templates/cost-analyzer-network-policy.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-egress
labels:
app.kubernetes.io/name: cost-analyzer
helm.sh/chart: cost-analyzer-1.75.1
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app: cost-analyzer
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: cost-analyzer
app.kubernetes.io/instance: RELEASE-NAME
app: cost-analyzer
policyTypes:

  • Egress
    egress:
  • to:
    • namespaceSelector: {}

networkPolicy:
enabled: true
denyEgress: false
sameNamespace: true

Source: cost-analyzer/templates/cost-analyzer-network-policy.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: shared-namespace
namespace: kubecost
spec:
podSelector:
matchLabels:
app: prometheus
component: server
policyTypes:

  • Ingress
    ingress:
  • from:
    • podSelector:
      matchLabels:
      app.kubernetes.io/name: cost-analyzer
    • namespaceSelector:
      matchLabels:
      name: k8s-kubecost

networkPolicy:
enabled: true
denyEgress: false
sameNamespace: false
namespace: test


Source: cost-analyzer/templates/cost-analyzer-network-policy.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: closed-traffic
namespace: test
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: cost-analyzer
policyTypes:

  • Ingress
    ingress:
  • from:
    • podSelector:
      matchLabels:
      app.kubernetes.io/name: cost-analyzer
    • namespaceSelector:
      matchLabels:
      name: k8s-kubecost

@Sean-Holcomb Sean-Holcomb merged commit 3a2b234 into develop Mar 8, 2021
@pierluigilenoci
Copy link

Works 👍🏻

@Sean-Holcomb Sean-Holcomb deleted the sean/egress-policy branch March 15, 2021 15:58
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

Successfully merging this pull request may close these issues.

4 participants