Velero allows on backup and restore operations and is designed to be run with full cluster admin permissions. It allows on cross namespace restore operations, which means you can restore backup of namespace A to namespace B. This policy protect restore operation into system or any protected namespaces, listed in deny condition section. It checks the Restore CRD object and its namespaceMapping field. If destination match protected namespace then operation fails and warning message is throw.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: block-velero-restoreannotations:policies.kyverno.io/title: Block Velero Restore to Protected Namespace in CEL expressionspolicies.kyverno.io/category: Velero in CELpolicies.kyverno.io/subject: Restorekyverno.io/kyverno-version: 1.11.0kyverno.io/kubernetes-version: 1.26-1.27policies.kyverno.io/description: Velero allows on backup and restore operations and is designed to be run with full cluster admin permissions. It allows on cross namespace restore operations, which means you can restore backup of namespace A to namespace B. This policy protect restore operation into system or any protected namespaces, listed in deny condition section. It checks the Restore CRD object and its namespaceMapping field. If destination match protected namespace then operation fails and warning message is throw.spec:validationFailureAction: Auditbackground: falserules:- name: block-velero-restore-to-protected-namespacematch:any:- resources:kinds:- velero.io/v1/Restoreoperations:- CREATE- UPDATEvalidate:cel:variables:- name: namespaceMappingValuesexpression: "has(object.spec.namespaceMapping) ? object.spec.namespaceMapping.map(nsmap, object.spec.namespaceMapping[nsmap]) : []"expressions:- expression: "!variables.namespaceMappingValues.exists(val, val in ['kube-system', 'kube-node-lease'])"messageExpression: "'Warning! Restore to protected namespace: ' + variables.namespaceMappingValues.join(', ') + ' is not allowed!'"
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.