Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nanox/f9046b986b2d9689ab6670a3c8728de0 to your computer and use it in GitHub Desktop.
Save nanox/f9046b986b2d9689ab6670a3c8728de0 to your computer and use it in GitHub Desktop.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-latest-tag
spec:
validationFailureAction: audit
background: true
rules:
- name: require-image-tag
match:
any:
- resources:
kinds:
- Pod
validate:
message: "An image tag is required."
pattern:
spec:
containers:
- image: "*:*"
- name: validate-image-tag
match:
any:
- resources:
kinds:
- Pod
validate:
message: "Using a mutable image tag e.g. 'latest' is not allowed."
pattern:
spec:
containers:
- image: "!*:latest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment