Thank you for your interest in contributing to the Coralogix Operator. We welcome your contributions. Here you'll find information to help you get started with operator development.
You are contributing under the terms and conditions of the Contributor License Agreement. For signing.
- You’ll need a Kubernetes cluster to run against. You can use KIND
- Go 1.20.x (for building the operator locally)
- kuttl (for running e2e tests).
- kubebuilder for developing the operator.
Clone the repository locally.
$ git clone [email protected]:coralogix/coralogix-operator
Navigate to the operator directory and install it. This command will build the operator and install the CRDs located at crd directory into the K8s cluster specified in ~/.kube/config.
$ make install
Add the region and api-key as environment variables (or later as flags).
$ export CORALOGIX_API_KEY="xxx-xxx-xxx"
$ export CORALOGIX_REGION = "EU2"
For private domain the domain
field or the environment variable CORALOGIX_DOMAIN
have to be defined.
Run the operator locally
$ go run cmd/main.go
Or with regin
and api-key
flags
$ go run cmd/main.go -region EU2 -api-key xxx-xxx-xxx
For not running the prometheusRule controller set the prometheus-rule-controller
flag to false
$ go run cmd/main.go -prometheus-rule-controller=false
Or build and push your image to a registry
make docker-build docker-push IMG=<some-registry>/coralogix-operator:tag
Then deploy it to the cluster
make deploy IMG=<some-registry>/coralogix-operator:tag
Running examples
---------------------
It's possible to use one of the samples in the [sample directory](./config/samples) or creating your own sample file.
Then apply it -
```sh
$ kubectl apply -f config/samples/alerts/standard_alert.yaml
Getting the resource status
$ kubectl get alerts.coralogix.com standard-alert-example -oyaml
Destroying the resource.
$ kubectl delete alerts.coralogix.com standard-alert-example
We use kubebuilder for developing the operator. When creating or updating CRDs remember to run
make manifests
The test files are located at ./tests/e2e/. In order to run the full e2e tests suite:
- Add the api key and region as environment variables:
$ export CORALOGIX_API_KEY="<api-key>"
$ export CORALOGIX_REGION="<region>"
- Run the tests:
$ make e2e-tests
We use kuttl for integration tests. The test files are located at ./tests/integration/. In order to run the full integration tests suite, run:
$ make integration-tests
Note: kuttl
tests create real resources and in a case of failure some resources may not be removed.
To determine the release convention we use semantic-release -
"releaseRules": [
{"message": "major*", "release": "major"},
{"message": "minor*", "release": "minor"},
{"message": "patch*", "release": "patch"}
]