Created
December 29, 2020 19:33
-
-
Save consideRatio/61add81818f2d438df6b6dbe674b253a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- range .Values.netpol.namespaces }} | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: NetworkPolicy | |
metadata: | |
name: allow-egress-to-everything-but-specified-range | |
namespace: {{ . }} | |
spec: | |
# WARNING: targets all pods in the namespace | |
# If pods were already targetted by a netpol rule, this netpol | |
# will grant more permissions than wanted rather than restricting | |
# them. | |
podSelector: {} | |
policyTypes: | |
- Egress | |
egress: | |
- to: | |
- ipBlock: | |
cidr: 0.0.0.0/0 | |
except: | |
{{- range $.Values.netpol.except }} | |
- {{ . }} | |
{{- end }} | |
{{- end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment