Ingress resources should only allow secure traffic by disabling HTTP and therefore only allowing HTTPS. This policy requires that all Ingress resources set the annotation `kubernetes.io/ingress.allow-http` to `"false"` and specify TLS in the spec.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-ingress-httpsannotations:policies.kyverno.io/title: Require Ingress HTTPSpolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.9.0kyverno.io/kubernetes-version: "1.24"policies.kyverno.io/subject: Ingresspolicies.kyverno.io/description: Ingress resources should only allow secure traffic by disabling HTTP and therefore only allowing HTTPS. This policy requires that all Ingress resources set the annotation `kubernetes.io/ingress.allow-http` to `"false"` and specify TLS in the spec.spec:background: truevalidationFailureAction: Auditrules:- name: has-annotationmatch:any:- resources:kinds:- Ingresspreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: The kubernetes.io/ingress.allow-http annotation must be set to false.pattern:metadata:annotations:kubernetes.io/ingress.allow-http: "false"- name: has-tlsmatch:any:- resources:kinds:- Ingresspreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: TLS must be defined.deny:conditions:all:- key: tlsoperator: AnyNotInvalue: "{{ request.object.spec.keys(@) }}"
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.