Kubernetes operator for CDAP
Alpha
The CDAP Operator is still under active development and has not been extensively tested in production environment. Backward compatibility of the APIs is not guaranteed for alpha releases.
- Version >= 1.9 of Kubernetes.
- Version >= 6.0.0 of CDAP
You can checkout the CDAP Operator source code, build and run locally. To build the CDAP Operator, you need to setup your environment for the Go language. Also, you should have a Kubernetes cluster
- Checkout CDAP Operator source
mkdir -p $GOPATH/src/cdap.io cd $GOPATH/src/cdap.io git clone https://github.com/cdapio/cdap-operator.git cd cdap-operator
- Generates and install the CRDs
make install
- Compiles and run the CDAP Operator
make run
- Deploy CDAP CRD to the cluster
kubectl apply -k config/crd
- Edit the sample CDAP CR and deploy to the cluster
kubectl apply -f config/samples/cdap_v1alpha1_cdapmaster.yaml
You can also build a docker image containing the CDAP controller and deploy it to Kubernetes.
- Build the docker image
You can change the target image name and tag by setting the
IMG=cdap-controller:latest make docker-build
IMG
environment variable. - Push the docker image
IMG=cdap-controller:latest make docker-push
- Deploy CDAP CRD and RBAC to the cluster
make deploy
A step by step guide of running CDAP in Kubernetes using CDAP operator can be found in the blog post.
-
Install kubebuilder.
-
Install setup-envtest by running:
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
- After installing
setup-envtest
, use it to download envtest 1.19.x for kubebuilder and to set your KUBEBUILDER_ASSETS environment variable:
# Downloads envtest v1.19.x and writes the export statement to a temporary file
$(go env GOPATH)/bin/setup-envtest use -p env 1.19.x > /tmp/setup_envtest.sh
# Sets the KUBEBUILDER_ASSETS environment variable
source /tmp/setup_envtest.sh
# Deletes the temporary file
rm /tmp/setup_envtest.sh
- Run
make test