Kubernetes managed non-letsencrypt certificates have to be renewed in every 100 days.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: cert-manager-limit-durationannotations:policies.kyverno.io/title: Certificate max duration 100 dayspolicies.kyverno.io/category: Cert-Managerpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/subject: Certificatepolicies.kyverno.io/description: Kubernetes managed non-letsencrypt certificates have to be renewed in every 100 days.spec:validationFailureAction: Auditbackground: falserules:- name: certificate-duration-max-100daysmatch:any:- resources:kinds:- Certificatepreconditions:all:- key: "{{ contains(request.object.spec.issuerRef.name, 'letsencrypt') }}"operator: Equalsvalue: false- key: "{{ request.object.spec.duration }}"operator: NotEqualsvalue: ""validate:message: certificate duration must be < than 2400h (100 days)deny:conditions:all:- key: "{{ max( [ to_number(regex_replace_all('h.*',request.object.spec.duration,'')), to_number('2400') ] ) }}"operator: NotEqualsvalue: 2400
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.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.