mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
30 lines
794 B
YAML
30 lines
794 B
YAML
apiVersion: kyverno.io/v1alpha1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: validate-namespace
|
|
annotations:
|
|
policies.kyverno.io/category: Workload Isolation
|
|
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.
|
|
spec:
|
|
rules:
|
|
- name: check-default-namespace
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "Using 'default' namespace is restricted"
|
|
pattern:
|
|
metadata:
|
|
namespace: "!default"
|
|
- name: check-namespace-exist
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "A namespace is required"
|
|
pattern:
|
|
metadata:
|
|
namespace: "?*"
|