All Policies

Enforce Istio Ambient Mode

In order for Istio to include namespaces in ambient mode, the label `istio.io/dataplane-mode` must be set to `ambient`. This policy ensures that all new Namespaces set `istio.io/dataplane-mode` to `ambient`.

Policy Definition

/istio/enforce-ambient-mode-namespace/enforce-ambient-mode-namespace.yaml

 1apiVersion: kyverno.io/v1
 2kind: ClusterPolicy
 3metadata:
 4  name: enforce-ambient-mode-namespace
 5  annotations:
 6    policies.kyverno.io/title: Enforce Istio Ambient Mode
 7    policies.kyverno.io/category: Istio
 8    policies.kyverno.io/severity: medium
 9    kyverno.io/kyverno-version: 1.8.0
10    policies.kyverno.io/minversion: 1.6.0
11    kyverno.io/kubernetes-version: "1.24"
12    policies.kyverno.io/subject: Namespace
13    policies.kyverno.io/description: >-
14      In order for Istio to include namespaces in ambient mode, the label
15      `istio.io/dataplane-mode` must be set to `ambient`. This policy ensures that all new Namespaces
16      set `istio.io/dataplane-mode` to `ambient`.
17spec:
18  validationFailureAction: Audit
19  background: true
20  rules:
21  - name: check-amblient-mode-enabled
22    match:
23      any:
24      - resources:
25          kinds:
26          - Namespace
27    validate:
28      message: "All new Namespaces must have Istio ambient mode enabled."
29      pattern:
30        metadata:
31          labels:
32            istio.io/dataplane-mode: ambient