|
| 1 | +# End-to-end tests |
| 2 | + |
| 3 | +## Kyverno Chainsaw |
| 4 | + |
| 5 | +Chainsaw provides a declarative approach to test Kubernetes operators and controllers. |
| 6 | + |
| 7 | +While Chainsaw is designed for testing operators and controllers, it can declaratively test any Kubernetes objects. |
| 8 | + |
| 9 | +Chainsaw is an open-source tool that was initially developed for defining and running Kyverno end-to-end tests. |
| 10 | + |
| 11 | +## Configuration |
| 12 | + |
| 13 | +To configure Chainsaw for testing, you need to define parameters for the specific Kubernetes resources and controllers being tested. Below are example configurations. |
| 14 | + |
| 15 | +**Sample Configuration** |
| 16 | + |
| 17 | +```yaml |
| 18 | +driverName: sample-driver.objectstorage.k8s.io |
| 19 | +deletionPolicy: "Delete" # Options: "Delete" or "Retain" |
| 20 | +bucketClassParams: |
| 21 | + foo: bar |
| 22 | + baz: cux |
| 23 | +bucketAccessClassParams: |
| 24 | + foo: bar |
| 25 | + baz: cux |
| 26 | +authenticationType: "Key" # Options: "Key" or "IAM" |
| 27 | +bucketClaimProtocols: ["S3", "Azure"] # Supported protocols for bucket claims |
| 28 | +bucketAccessProtocol: "S3" # Protocol for bucket access |
| 29 | +``` |
| 30 | +
|
| 31 | +**Example for Linode COSI Driver** |
| 32 | +
|
| 33 | +```yaml |
| 34 | +driverName: objectstorage.cosi.linode.com |
| 35 | +deletionPolicy: "Delete" # Options: "Delete" or "Retain" |
| 36 | +bucketClassParams: |
| 37 | + cosi.linode.com/v1/region: us-east # Specify the region for Linode object storage |
| 38 | + cosi.linode.com/v1/acl: private # Define the access control list (ACL) settings |
| 39 | + cosi.linode.com/v1/cors: disabled # Enable or disable Cross-Origin Resource Sharing (CORS) |
| 40 | +bucketAccessClassParams: |
| 41 | + cosi.linode.com/v1/permissions: read_write # Define access permissions |
| 42 | +authenticationType: "Key" # Options: "Key" or "IAM" |
| 43 | +bucketClaimProtocols: ["S3"] # Supported protocol for bucket claims |
| 44 | +bucketAccessProtocol: "S3" # Protocol for bucket access |
| 45 | +``` |
| 46 | +
|
| 47 | +### Running tests |
| 48 | +
|
| 49 | +To run the Chainsaw end-to-end tests, you can use the following command: |
| 50 | +
|
| 51 | +```sh |
| 52 | +chainsaw test --values /path/to/values.yaml |
| 53 | +``` |
| 54 | + |
| 55 | +This command will run the tests using the values defined in the provided YAML configuration file. |
| 56 | +Ensure the file is properly configured to suit the Kubernetes objects and controllers you are testing. |
0 commit comments