mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
04dc3ddfe3
* remove sample Dir and remove testcases form test_runner Signed-off-by: vyankatesh <vyankatesh@neualto.com> * change git URL for test Signed-off-by: vyankatesh <vyankatesh@neualto.com> * fix fmt issue Signed-off-by: vyankatesh <vyankatesh@neualto.com> * remove unused policy and test yamls Signed-off-by: vyankatesh <vyankatesh@neualto.com> * fix yaml path issue Signed-off-by: vyankatesh <vyankatesh@neualto.com> Co-authored-by: vyankatesh <vyankatesh@neualto.com>
39 lines
No EOL
1.2 KiB
YAML
39 lines
No EOL
1.2 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: add-networkpolicy
|
|
annotations:
|
|
policies.kyverno.io/category: Workload Management
|
|
policies.kyverno.io/description: By default, Kubernetes allows communications across
|
|
all pods within a cluster. Network policies and, a CNI that supports network policies,
|
|
must be used to restrict communinications. A default NetworkPolicy should be configured
|
|
for each namespace to default deny all ingress traffic to the pods in the namespace.
|
|
Application teams can then configure additional NetworkPolicy resources to allow
|
|
desired traffic to application pods from select sources.
|
|
spec:
|
|
validationFailureAction: audit
|
|
rules:
|
|
- name: default-deny-ingress
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Namespace
|
|
name: "*"
|
|
exclude:
|
|
resources:
|
|
namespaces:
|
|
- "kube-system"
|
|
- "default"
|
|
- "kube-public"
|
|
- "kyverno"
|
|
generate:
|
|
kind: NetworkPolicy
|
|
name: default-deny-ingress
|
|
namespace: "{{request.object.metadata.name}}"
|
|
synchronize : true
|
|
data:
|
|
spec:
|
|
# select all pods in the namespace
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Ingress |