add kyverno no latest

Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
gwg313 2026-05-17 17:14:37 -04:00
parent adc6cdb0bc
commit a39d676252
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
6 changed files with 66 additions and 1 deletions

View file

@ -0,0 +1,27 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-latest-tag
spec:
validationFailureAction: Enforce
background: true
rules:
- name: validate-image-tag
match:
any:
- resources:
kinds:
- Pod
validate:
message: "Using the 'latest' tag or omitting image tags is forbidden. Use a specific version semantic tag."
foreach:
- list: "request.object.spec.containers"
deny:
conditions:
any:
- key: "{{ regex_match('^.*:latest$', '{{ element.image }}') }}"
operator: Equals
value: true
- key: "{{ !contains('{{ element.image }}', ':') }}"
operator: Equals
value: true

View file

@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- purge-terminal-pods.yaml
- cleanup-rbac.yaml
- purge-terminal-pods.yaml
- disallow-latest-tag.yaml

View file

@ -0,0 +1,11 @@
apiVersion: v2
name: sealed-secrets
description: Sealed Secrets
type: application
version: 1.0.0
appVersion: 1.0.0
dependencies:
- name: sealed-secrets
version: 2.18.5
repository: https://bitnami-labs.github.io/sealed-secrets

View file

@ -0,0 +1,2 @@
sealed-secrets:
fullnameOverride: sealed-secrets-controller