One way sidecar injection in an Istio service mesh may be accomplished is by defining an annotation at the Pod level. Pods not receiving a sidecar cannot participate in the mesh thereby reducing visibility. This policy ensures that Pods cannot set the annotation `sidecar.istio.io/inject` to a value of `false`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: prevent-disabling-injection-podsannotations:policies.kyverno.io/title: Prevent Disabling Istio Sidecar Injectionpolicies.kyverno.io/category: Istiopolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.8.0policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.24"policies.kyverno.io/subject: Podpolicies.kyverno.io/description: One way sidecar injection in an Istio service mesh may be accomplished is by defining an annotation at the Pod level. Pods not receiving a sidecar cannot participate in the mesh thereby reducing visibility. This policy ensures that Pods cannot set the annotation `sidecar.istio.io/inject` to a value of `false`.spec:validationFailureAction: Auditbackground: truerules:- name: prohibit-inject-annotationmatch:any:- resources:kinds:- Podvalidate:message: Pods may not disable sidecar injection by setting the annotation sidecar.istio.io/inject to a value of false.pattern:metadata:"=(annotations)":"=(sidecar.istio.io/inject)": "!false"
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.