Skip to content

Latest commit

 

History

History
131 lines (89 loc) · 2.95 KB

CONTRIBUTING.md

File metadata and controls

131 lines (89 loc) · 2.95 KB

Contributing

Develop Locally

Connect to a Kubernetes cluster

export KUBECONFIG=/path/to/config

Create all CRDs that are managed by the operator:

make init

Run Operator locally:

export ATLAS_PRIVATE_KEY=xxxx-xxxx-xxxx-xxxx
export ATLAS_PUBLIC_KEY=yyyyy
make

Create MongoDB Atlas Project

make deploy-project

Create MongoDB Atlas Cluster

make deploy-cluster

Delete MongoDB Atlas Project and Cluster

make delete-cluster
make delete-project

Testing

Unit Tests

The following executes unit tests for the controllers in ./pkg/controller/

make test
# test only a subset
make test TEST_DIR=./pkg/controller/mongodbatlasdatabaseuser/...
# increase verbosity
make test TEST_DIR=./pkg/controller/mongodbatlasdatabaseuser/... VERBOSE="-v"

E2E Tests

In order to run the end-to-end tests, you first have to create a namespace and a secret containing the private key of the programmatic API key pair which is needed by the Operator to perform API call against the MongoDB Atlas API.

The following command will execute the corresponding kubectl commands for you

export ATLAS_PRIVATE_KEY=xxxx-xxxx-xxxx-xxxx
make inite2etest

Afterwards, you can run the end-to-end tests with

export ATLAS_PUBLIC_KEY=yyyyy
make e2etest ORGANIZATION_ID=123456789

Create new API

This example creates a new MongoDBAtlasCluster API:

make api KIND=MongoDBAtlasCluster

Afterwards adapt the corresponding ./pkg/apis/knappek/v1alpha1/mongodbatlascluster_types.go. Then create the CRD and the generated OpenAPI Spec with

make generate-openapi
make generate-k8s

Create new Controller for the API

To create a controller for the recently created API, run:

make controller KIND=MongoDBAtlasCluster

Create a new Release

You need to have Collaborator permissions to perform this step

A new release will

In order to do this, follow these steps:

  1. Change the version in .drone.yml and in operator.yaml according to Semantic Versioning

  2. Commit your changes (don't push)

  3. Create a new release using SemVer

    make release VERSION=<major.minor.patch>

This will kick the CI pipeline and create a new Github Release with the version tag v<major.minor.patch>.