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
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"
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
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
To create a controller for the recently created API, run:
make controller KIND=MongoDBAtlasCluster
You need to have Collaborator permissions to perform this step
A new release will
- create a new release on the Github release page
- push a new tagged Docker image to Dockerhub
In order to do this, follow these steps:
-
Change the version in .drone.yml and in operator.yaml according to Semantic Versioning
-
Commit your changes (don't push)
-
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>
.