Building images which specify a base as their origin is a good start to improving supply chain security, but over time organizations may want to build an allow list of specific base images which are allowed to be used when constructing containers. This policy ensures that a container's base, found in an OCI annotation, is in a cluster-wide allow list.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: allowed-base-imagesannotations:policies.kyverno.io/title: Allowed Base Imagespolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.7.0policies.kyverno.io/minversion: 1.7.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/subject: Podpolicies.kyverno.io/description: Building images which specify a base as their origin is a good start to improving supply chain security, but over time organizations may want to build an allow list of specific base images which are allowed to be used when constructing containers. This policy ensures that a container's base, found in an OCI annotation, is in a cluster-wide allow list.spec:validationFailureAction: Auditrules:- name: allowed-base-imagesmatch:any:- resources:kinds:- Podpreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: NotEqualsvalue: DELETEcontext:- name: baseimagesconfigMap:name: baseimagesnamespace: platformvalidate:message: This container image's base is not in the approved list or is not specified. Only pre-approved base images may be used. Please contact the platform team for assistance.foreach:- list: request.object.spec.[ephemeralContainers, initContainers, containers][]context:- name: imageDataimageRegistry:reference: "{{ element.image }}"- name: basenamevariable:jmesPath: imageData.manifest.annotations."org.opencontainers.image.base.name"default: ""deny:conditions:all:- key: "{{ basename }}"operator: AnyNotInvalue: "{{ baseimages.data.allowedbaseimages }}"
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.