In order to build Eunomia, you'll need the following:
- Git
- Go 1.12+
- Docker
- Operator SDK v0.8.1
- Access to a Kubernetes cluster
To check out this repository:
- Create a fork of this repo
- Create the directories and clone your fork
mkdir -p $GOPATH/src/github.com/KohlsTechnology
cd $GOPATH/src/github.com/KohlsTechnology
git clone https://github.com/<YOUR FORK>/eunomia.git
cd eunomia
All the components can easily be installed via Homebrew on a Mac:
brew install git
brew install go
brew install docker
brew install operator-sdk
brew install minikube
brew install minishift
The most efficient way to develop the operator locally is run the code on your local machine. This allows you to test code changes as you make them.
minikube start
kubectl apply -f ./deploy/crds/eunomia_v1alpha1_gitopsconfig_crd.yaml
export JOB_TEMPLATE=./build/job-templates/job.yaml
export CRONJOB_TEMPLATE=./build/job-templates/cronjob.yaml
export WATCH_NAMESPACE=""
export OPERATOR_NAME=eunomia-operator
export GO111MODULE=on
go mod vendor
operator-sdk up local --namespace="${WATCH_NAMESPACE}"
Setting WATCH_NAMESPACE to empty string, as above, results in Eunomia watching all namespaces. If you want a particular namespace to be watched, set it explicitly in the env variable.
The Eunomia operator gets packaged as a container image for running on Kubernetes clusters. These instructions will walk through building and testing the image.
See https://golang.org/doc/install to install/setup your Go Programming environment if you have not already done this.
export GO111MODULE=on
GOOS=linux make
From here you could build the eunomia-operator Docker image and manually push it to a registry, or run it locally (out of scope for this doc).
Run the following to build and push the images:
export REGISTRY=<your registry>
docker login $REGISTRY
./scripts/build-images.sh
Here are some preliminary instructions. This still needs a lot of TLC. Feel free to send in PRs.
# Start minikube
minikube start
# Deploy the operator
helm template deploy/helm/eunomia-operator/ | kubectl apply -f -
Here are some preliminary instructions. This still needs a lot of TLC. Feel free to send in PRs.
# Deploy the operator
helm template deploy/helm/eunomia-operator/ --set eunomia.openshift.route.enabled=true | oc apply -f -
For testing and CI purposes, we manage several set of tests. These tests can be run locally by following the below instructions. All test scripts assume that you are already logged into your minikube cluster.
make test-unit
# Optional: Set the environment variable $EUNOMIA_URI to point to a specific git url for testing
# Optional: Set the environment variable $EUNOMIA_REF to point to a specific git reference for testing
make test-e2e
make test