Files
polaris/docs/customization/custom-checks.md
Robert Brennan c11b839009 Update docs (#472)
* move docs files

* update docs from template

* another update

* add insights callouts

* add ingress check to the docs

* remove old prefixes on check names
2021-01-15 15:16:59 -05:00

1.2 KiB

Custom Checks

If you'd like to create your own checks, you can use JSON Schema. For example, to disallow images from quay.io:

checks:
  imageRegistry: warning
customChecks:
  imageRegistry:
    successMessage: Image comes from allowed registries
    failureMessage: Image should not be from disallowed registry
    category: Images
    target: Container # target can be "Container" or "Pod"
    schema:
      '$schema': http://json-schema.org/draft-07/schema
      type: object
      properties:
        image:
          type: string
          not:
            pattern: ^quay.io

Schemas can also be specified as JSON strings instead of YAML, for easier copy/pasting:

customChecks:
  foo:
    jsonSchema: |
      {
        "$schema": "http://json-schema.org/draft-07/schema",
        "type": "object"
      }

We extend JSON Schema with resourceMinimum and resourceMaximum fields to help compare memory and CPU resource strings like 1000m and 1G. You can see an example in the extended config

There are additional examples in the checks folder.