1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/samples/best_practices/disallow_default_namespace.yaml

31 lines
794 B
YAML
Raw Normal View History

2019-10-10 10:34:49 -07:00
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: validate-namespace
2019-10-11 18:57:16 -07:00
annotations:
policies.kyverno.io/category: Workload Isolation
2019-10-14 16:33:19 -07:00
policies.kyverno.io/description: With many users spread across multiple teams, restricting
use of the default namespace and subdividing the cluster by namesoace isolates workloads.
2019-10-10 10:34:49 -07:00
spec:
rules:
- name: check-default-namespace
match:
resources:
kinds:
- Pod
validate:
2019-10-14 10:47:54 -07:00
message: "Using 'default' namespace is restricted"
2019-10-10 10:34:49 -07:00
pattern:
metadata:
namespace: "!default"
- name: check-namespace-exist
match:
resources:
kinds:
- Pod
validate:
message: "A namespace is required"
pattern:
metadata:
namespace: "?*"