Skip to content

Latest commit

 

History

History
127 lines (102 loc) · 3.54 KB

CONTRIBUTING.md

File metadata and controls

127 lines (102 loc) · 3.54 KB

Contributing to Coralogix Operator

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.

Building the Operator

Requirements

  • 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.

Steps

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

Developing

We use kubebuilder for developing the operator. When creating or updating CRDs remember to run

make manifests

Running E2E Tests

The test files are located at ./tests/e2e/. In order to run the full e2e tests suite:

  1. Add the api key and region as environment variables:
$ export CORALOGIX_API_KEY="<api-key>"
$ export CORALOGIX_REGION="<region>"
  1. Run the tests:
$ make e2e-tests

Running Integration 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.

Releases

To determine the release convention we use semantic-release -

"releaseRules": [
          {"message": "major*", "release": "major"},
          {"message": "minor*", "release": "minor"},
          {"message": "patch*", "release": "patch"}
        ]