A Zuul Operator PoC ======= ## Requirements: * [OKD](https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz) * [SDK](https://github.com/operator-framework/operator-sdk#quick-start) * [Zookeeper Operator](https://github.com/pravega/zookeeper-operator#install-the-operator) ## Prepare cluster ```shell sudo -i oc cluster up sudo chown root:fedora /var/run/docker.sock oc login -u developer -p dev docker login -u developer -p $(oc whoami -t) $(oc registry info) # Log as admin to install crd sudo cat /root/.kube/config > ~/.kube/config oc login -u system:admin oc project default ``` ## Install Postgress Operator Follow [install instruction](https://crunchydata.github.io/postgres-operator/stable/installation/), basically: ``` vi ./pv/crunchy-pv.json # set volume size and pv number oc apply -f ./pv/crunchy-pv.json oc apply -f ./deploy/cluster-rbac.yaml oc apply -f ./deploy/rbac.yaml ./deploy/deploy.sh ``` ## Install Zookeeper Operator ```shell oc create -f https://raw.githubusercontent.com/pravega/zookeeper-operator/master/deploy/crds/zookeeper_v1beta1_zookeepercluster_crd.yaml oc create -f https://raw.githubusercontent.com/pravega/zookeeper-operator/master/deploy/default_ns/rbac.yaml oc create -f https://raw.githubusercontent.com/pravega/zookeeper-operator/master/deploy/default_ns/operator.yaml ``` ## Install Zuul Operator ```shell operator-sdk build 172.30.1.1:5000/myproject/zuul-operator:latest docker push 172.30.1.1:5000/myproject/zuul-operator:latest oc create -f deploy/crds/zuul-ci_v1alpha1_zuul_crd.yaml oc create -f deploy/rbac.yaml oc create -f deploy/operator.yaml ``` Look for operator pod and check it's output ```shell $ oc get pods NAME READY STATUS RESTARTS AGE zuul-operator-c64756f66-rbdmg 2/2 Running 0 3s $ oc logs zuul-operator-c64756f66-rbdmg -c operator ... {"level":"info","ts":1554197305.5853095,"logger":"cmd","msg":"Go Version: go1.10.3"} {"level":"info","ts":1554197305.5854425,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"} {"level":"info","ts":1554197305.5854564,"logger":"cmd","msg":"Version of operator-sdk: v0.6.0"} {"level":"info","ts":1554197305.5855,"logger":"cmd","msg":"Watching namespace.","Namespace":"default"} ... ``` ## Usage ``` $ oc apply -f - < 80/TCP 41s $ curl 172.30.209.181/api/tenants [{"name": "demo", "projects": 0, "queue": 0}] ```