Some registries, both public and private, require credentials in order to pull images from them. This policy checks those images and if they come from a registry other than ghcr.io or quay.io an `imagePullSecret` is required.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-imagepullsecretsannotations:policies.kyverno.io/title: Require imagePullSecretspolicies.kyverno.io/category: Samplepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/subject: Podpolicies.kyverno.io/description: Some registries, both public and private, require credentials in order to pull images from them. This policy checks those images and if they come from a registry other than ghcr.io or quay.io an `imagePullSecret` is required.spec:validationFailureAction: Auditbackground: truerules:- name: check-for-image-pull-secretsmatch:any:- resources:kinds:- Podpreconditions:all:- key: "{{ images.containers.*.registry }}"operator: AnyNotInvalue:- ghcr.io- quay.iovalidate:message: An `imagePullSecret` is required when pulling from this registry.pattern:spec:imagePullSecrets:- name: "?*"
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.