Writing your own Scorecard Suite

An exmple of k8s operators

routerhan
8 min readAug 25, 2024
by wallarm

This article covers running Scorecard against a deployed operator. Learn how to run Scorecard based on the configuration that was already generated as part of your operator bundle.

Next, you’ll implement a custom Scorecard suite, first with a trivial test case, and then with an actual test that run’s some basic validation of our operator’s behavior.

Run the Scorecard tests

Start by running the basic test suite that you already have. From the base directory of your operator project, run the following command:

$ operator-sdk scorecard bundle/

This runs the tests described at bundle/tests/scorecard/config.yaml. You should see a bunch of output for the various tests. Some of the tests will fail because we haven’t done some due diligence like adding descriptors and validation for all the CRD fields.

You can run specific test suites or specific tests with the -selector flag:

$ operator-sdk scorecard bundle/ --selector=suite=olm
--------------------------------------------------------------------------------
Image: quay.io/operator-framework/scorecard-test:v1.8.0
Entrypoint: [scorecard-test olm-crds-have-validation]
Labels:
"suite":"olm"…

--

--

routerhan
routerhan

Written by routerhan

R&D Software Engineer @IBM Germany. This blog is an independent research of cloud computing.