Created
May 1, 2023 12:09
-
-
Save tommeramber/d7a1e7a482a52798351316fb67ea7334 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