Forked from tommeramber/kyverno-disallow-latest-tag.yaml
Created
September 20, 2024 23:07
-
-
Save nanox/f9046b986b2d9689ab6670a3c8728de0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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