From 77127edb5bbbba0a7d3957965fb7de3e74d640da Mon Sep 17 00:00:00 2001 From: Tyler Gu Date: Sun, 15 May 2022 22:11:13 -0500 Subject: [PATCH] doc: update instructions --- README.md | 44 ++++++++++++++++++++------------------------ acto.py | 33 +++++++++++++++------------------ requirements.txt | 3 ++- 3 files changed, 37 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 36ad78d923..063b9b47b9 100644 --- a/README.md +++ b/README.md @@ -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/) @@ -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: @@ -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 \ @@ -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) \ No newline at end of file +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) \ No newline at end of file diff --git a/acto.py b/acto.py index 98394727ca..c66eb128de 100644 --- a/acto.py +++ b/acto.py @@ -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, diff --git a/requirements.txt b/requirements.txt index 8bd574370c..d8834d4179 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ deepdiff kubernetes==20.13.0 exrex sh -rich \ No newline at end of file +rich +jsonschema \ No newline at end of file