/couchbase-operator-ci

Primary LanguagePythonApache License 2.0Apache-2.0

Couchbase Operator Functional Test

This project uses kops to provision a fully functional Kubernetes cluster in AWS, install Couchbase Operator and run functional tests against the cluster. The project is designed to run in a container so it does not interfere with your main development environment and cann be run in the background.

Detail

This creates a 4 node Kubernetes cluster. Nodes are distrubuted across subnets in different availability zones within a VPC as depicted in the diagram.

Cluster Topology

Nodes are secured with an ephemeral SSH key. All APIs are secured via TLS. Nodes are accessible via public DNS.

Running

docker run \
  --rm \
  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
  --mount type=bind,source=/home/simon/go/src/github.com/couchbase/couchbase-operator,target=/mnt/couchbase-operator,readonly \
  --group-add $(grep docker /etc/group | cut -d: -f3) \
  spjmurray/couchbase-operator-ci:0.0.1 \
  --docker-user spjmurray \
  --docker-api-key ${DOCKER_API_KEY} \
  --docker-repo spjmurray/couchbase-operator \
  --backend aws \
  --aws-region us-east-1 \
  --aws-access-key ${AWS_ACCESS_KEY} \
  --aws-secret-key ${AWS_SECRET_KEY}

Recomended Options

--rm
Clean the container up after exit
--mount
The CI job needs to have access to docker and clone the repository so needs access to the local host file system.
--group-add
The container runs as non-root but needs to access the docker socket, so add the user to the host docker group.

Required Environment Variables

DOCKER_API_KEY
API key associated with a docker account

Back Ends

Due to the plugable nature of the test framework we can support different cloud technologies. Each has different configuration requirements via environment variables.

aws

Required Environment Variables

AWS_REGION
Which region to create the cluster in. The backend will automatically poll availability zones and distribute the cluster across them
AWS_ACCESS_KEY
Your access key for AWS authentication
AWS_SECRET_KEY
Your secret key for AWS authentication