Ingress hosts optionally accept a wildcard as an alternative to precise matching. In some cases, this may be too permissive as it would direct unintended traffic to the given Ingress resource. This policy enforces that any Ingress host does not contain a wildcard character.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: restrict-ingress-wildcardannotations:policies.kyverno.io/title: Restrict Ingress Host with Wildcardspolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.6.2policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/subject: Ingresspolicies.kyverno.io/description: Ingress hosts optionally accept a wildcard as an alternative to precise matching. In some cases, this may be too permissive as it would direct unintended traffic to the given Ingress resource. This policy enforces that any Ingress host does not contain a wildcard character.spec:validationFailureAction: Auditbackground: truerules:- name: block-ingress-wildcardmatch:any:- resources:kinds:- Ingresspreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: Wildcards are not permitted as hosts.foreach:- list: request.object.spec.rulesdeny:conditions:any:- key: "{{ contains(element.host, '*') }}"operator: Equalsvalue: true
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.