NVIDIA / container-canary

A tool for testing and validating container requirements against versioned manifests
Apache License 2.0
245 stars 15 forks source link

Add optional conditions #45

Open jacobtomlinson opened 1 year ago

jacobtomlinson commented 1 year ago

It would be useful to make some conditions as optional and add a flag to enable them if desired.

For example in the databricks example folks may want Python OR R but not both. They may also want to check for CUDA toolkit for use on GPU nodes, but not everyone will want to test for that.

It would be nice to add an optional setting which still runs them but doesn't fail the test if they fail, but have a CLI flag that makes them mandatory.

E.g

# foo.yaml
apiVersion: container-canary.nvidia.com/v1
kind: Validator
name: foo
command:
  - /bin/sh
  - -c
  - "sleep 3600"
checks:
  - name: bash
    description: Has bash installed
    optional: true
    probe:
      exec:
        command:
          - /bin/sh
          - -c
          - "which bash"
$ canary validate --file foo.yaml --check-optional "bash" somecontainer