nodeexporter_memory_limits.rego 854 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package prometheus.nodeexporter_memory_limits
  2. import future.keywords
  3. # Policy expects input structure of form:
  4. # values: {}
  5. # This policy tests for the existence of memory limits as a hard constraint. We look
  6. # for Helm values of the form:
  7. #
  8. # nodeExporter:
  9. # resources:
  10. # limits:
  11. # cpu: 200m
  12. # memory: 256Mi
  13. # requests:
  14. # cpu: 10m
  15. # memory: 256Mi
  16. POLICY_ID := "nodeexporter_memory_limits"
  17. POLICY_VERSION := "v0.0.1"
  18. POLICY_SEVERITY := "high"
  19. POLICY_TITLE := sprintf("Prometheus nodeExporter should have memory limits set", [])
  20. POLICY_SUCCESS_MESSAGE := sprintf("Success: Prometheus nodeExporter has memory limits set", [])
  21. allow if {
  22. input.values.nodeExporter.resources.limits.memory
  23. }
  24. FAILURE_MESSAGE contains msg if {
  25. not allow
  26. msg := "Failed: Prometheus nodeExporter does not have memory limits set"
  27. }