Skip to content

Instantly share code, notes, and snippets.

@bharatmicrosystems
Created October 30, 2020 08:20
Show Gist options
  • Save bharatmicrosystems/1c79afbf05e845c55207cc6dc3aaa3ff to your computer and use it in GitHub Desktop.
Save bharatmicrosystems/1c79afbf05e845c55207cc6dc3aaa3ff to your computer and use it in GitHub Desktop.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-resources
spec:
validationFailureAction: enforce
rules:
- name: check-pod-resources
match:
resources:
kinds:
- Pod
validate:
message: "CPU and memory resource requests and limits are required"
pattern:
spec:
containers:
- name: "*"
resources:
limits:
memory: "?*"
cpu: "?*"
requests:
memory: "?*"
cpu: "?*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment