This page explains you how to set up your development environment.
Before you start, install the following tools and packages:
- go (>= 1.17)
- golangci-lint
- kubectl (>= 1.14)
- kubebuilder (>= 2.0.0)
- docker (>= 19.0.0 with optional
buildx
extension for multi-arch builds) - helm (>= 3.2.0, preferably 3.9.x)
- helm unittest (only needed if developing helm charts)
helm plugin install https://github.com/quintush/helm-unittest --version 0.2.8
- Kubernetes distribution such as minikube or kind, or access to a hosted Kubernetes service such as GKE or AKS
git clone https://github.com/elastic/cloud-on-k8s.git
cd cloud-on-k8s
Run make check-requisites
to check that all dependencies are installed.
- Run
make dependencies
to download the Go libraries needed to compile the project. - Get a working development Kubernetes cluster. You can use:
-
make bootstrap-minikube
-
Use deployer (see the deployer README on how to customize which version of Kind will be used):
make switch-kind bootstrap-cloud
-
Cloud providers
Use deployer (note that some one time configuration is required):
- Docker registry
The docker.elastic.co
registry and the eck-dev
namespace are setup by default.
It is up to you to manage the authentication (docker login -u $username docker.elastic.co
) to be able to push images into it.
A file .registry.env
can be created to use another Docker registry.
make switch-registry-gcr
configures this file to use Google Container Registry with:
REGISTRY = eu.gcr.io
REGISTRY_NAMESPACE = my-gcloud-project
E2E_REGISTRY_NAMESPACE = my-gcloud-project
- Deploy the operator
make run
to run the operator locally, ormake deploy
to deploy the operators into the configured k8s cluster.make samples
to apply a sample stack resource.
make unit integration
E2E tests will run in the e2e-mercury
and e2e-venus
namespaces.
Run make run
to start the operator and then run make e2e-local
in a separate shell to run the E2E tests.
ECK is instrumented with Elastic APM tracing. To run ECK locally with tracing enabled, run:
ENABLE_TRACING=true ELASTIC_APM_SERVER_URL=https://<apm-server-url> ELASTIC_APM_SECRET_TOKEN=<token> ELASTIC_APM_VERIFY_SERVER_CERT=false make run
Starting the operator with the --development
flag enables the development mode. The following set of flags become available for use in this mode.
Flag | Description |
---|---|
auto-port-forward |
Allows the operator to be run locally (outside of a Kubernetes cluster) by port-forwarding to the remote cluster. |
debug-http-listen |
Address to start the debug server which provides access to pprof endpoints. Default is localhost:6060 . |