Skip to content

Commit

Permalink
doc: update instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
tylergu committed May 16, 2022
1 parent 7033f2f commit 77127ed
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 43 deletions.
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Acto: Automatic, Continuous Testing for (Kubernetes/OpenShift) Operators

## Prerequisites
- Golang
- Python dependencies
- `pip3 install -r requirements.txt`
- [k8s Kind cluster](https://kind.sigs.k8s.io/)
Expand All @@ -15,18 +16,19 @@
To run the test:
```
python3 acto.py \
--candidates CANDIDATES, -c CANDIDATES yaml file to specify candidates for parameters
--seed SEED, -s SEED seed CR file
--operator OPERATOR, -o OPERATOR yaml file for deploying the operator
--helm OPERATOR_CHART Path of operator helm chart
--init INIT Path of init yaml file (deploy before operator)
--duration DURATION, -d DURATION Number of hours to run
--seed SEED, -s SEED seed CR file
--operator OPERATOR, -o OPERATOR yaml file for deploying the operator with kubectl
--helm OPERATOR_CHART Path of operator helm chart
--kustomize KUSTOMIZE Path of folder with kustomize
--init INIT Path of init yaml file (deploy before operator)
--duration DURATION, -d DURATION Number of hours to run
--preload-images [PRELOAD_IMAGES [PRELOAD_IMAGES ...]]
Docker images to preload into Kind cluster
--crd-name CRD_NAME Name of CRD to use, required if there are multiple CRDs
--custom-fields CUSTOM_FIELDS Python source file containing a list of custom fields
--context CONTEXT Cached context data
--dryrun DRYRUN Only generate test cases without executing them
Docker images to preload into Kind cluster
--crd-name CRD_NAME Name of CRD to use, required if there are multiple CRDs
--helper-crd HELPER_CRD generated CRD file that helps with the input generation
--custom-fields CUSTOM_FIELDS Python source file containing a list of custom fields
--context CONTEXT Cached context data
--dryrun Only generate test cases without executing them
```

Example:
Expand All @@ -49,9 +51,13 @@ python3 acto.py --seed data/cass-operator/cr.yaml \
```

zookeeper-operator (using helm)
`python3 acto.py --candidates data/zookeeper-operator/candidates.yaml --seed data/zookeeper-operator/cr.yaml --helm data/zookeeper-operator/zookeeper-operator --duration 1 --crd-name=zookeeperclusters.zookeeper.pravega.io`
```console
python3 acto.py --seed data/zookeeper-operator/cr.yaml \
--helm data/zookeeper-operator/zookeeper-operator \
--crd-name=zookeeperclusters.zookeeper.pravega.io
```

**mongodb-operator** (using helm)
**mongodb-operator** (using kubectl)
```console
python3 acto.py --seed data/percona-server-mongodb-operator/cr.yaml \
--operator data/percona-server-mongodb-operator/bundle.yaml \
Expand Down Expand Up @@ -96,14 +102,4 @@ Acto aims to automate the E2E testing as much as possible to minimize users' lab

Currently, porting operators still requires some manual effort, we need:
1. A way to deploy the operator, the deployment method needs to handle all the necessary prerequisites to deploy the operator, e.g. CRD, namespace creation, RBAC, etc. Current we support three deploy methods: `yaml`, `helm`, and `kustomize`. For example, rabbitmq-operator uses `yaml` for deployment, and the [example is shown here](data/rabbitmq-operator/operator.yaml)
2. A seed CR yaml serving as the initial cr input. This can be any valid CR for your application. [Example](data/rabbitmq-operator/cr.yaml)
3. (Optional) (Not yet supported)A candidates file specifying possible values for some parameters. The candidates file's format is very similar to a CR, except you replace the values with another field `candidates` and specify a list of values under `candidates`. Example:
```yaml
image:
candidates:
- "rabbitmq:3.8.21-management"
- "rabbitmq:latest"
- "rabbitmq:3.9-management"
- null
```
A complete example for rabbitmq-operator is [here](data/rabbitmq-operator/candidates.yaml)
2. A seed CR yaml serving as the initial cr input. This can be any valid CR for your application. [Example](data/rabbitmq-operator/cr.yaml)
33 changes: 15 additions & 18 deletions acto.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,29 +323,26 @@ def handle_excepthook(type, message, stack):

parser = argparse.ArgumentParser(
description='Automatic, Continuous Testing for k8s/openshift Operators')
parser.add_argument('--candidates',
'-c',
dest='candidates',
required=False,
help="yaml file to specify candidates for parameters")
parser.add_argument('--seed',
'-s',
dest='seed',
required=True,
help="seed CR file")
parser.add_argument('--operator',
'-o',
dest='operator',
required=False,
help="yaml file for deploying the operator")
parser.add_argument('--helm',
dest='operator_chart',
required=False,
help='Path of operator helm chart')
parser.add_argument('--kustomize',
dest='kustomize',
required=False,
help='Path of folder with kustomize')
deploy_method = parser.add_mutually_exclusive_group(required=True)
deploy_method.add_argument('--operator',
'-o',
dest='operator',
required=False,
help="yaml file for deploying the\
operator with kubectl")
deploy_method.add_argument('--helm',
dest='operator_chart',
required=False,
help='Path of operator helm chart')
deploy_method.add_argument('--kustomize',
dest='kustomize',
required=False,
help='Path of folder with kustomize')
parser.add_argument('--init',
dest='init',
required=False,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ deepdiff
kubernetes==20.13.0
exrex
sh
rich
rich
jsonschema

0 comments on commit 77127ed

Please sign in to comment.