A Kubernetes Operator for Zuul
eff9f360f7
This switches from the ansible/dhall operator framework to kopf, an operator framework written in pure Python. This allows us to: * Build the operator application as a Python app. * Build the operator image using the opendev python builder images. * Run the operator as a Python CLI program "zuul-operator". * Write procedural Python code to handle operator tasks (such as creating new nodepool launchers when providers are added). * Use Jinja for templating config files and k8s resource files (direct pythonic manipulation of resources is an option too). The new CR nearly matches the existing one, with some minor differences. Some missing features and documentation are added in the commits immediately following; they should be reviewed and merged as a unit. Also, fx waiting for scheduler to settle in functional test since we changed this log line in Zuul. Change-Id: Ib37b67e3444b7cd44692d48eee77775ee9049e9f Change-Id: I70ec31ecd8fe264118215944022b2e7b513dced9 |
||
---|---|---|
build | ||
deploy | ||
playbooks/zuul-operator-functional | ||
zuul_operator | ||
.git-blame-ignore-revs | ||
.gitignore | ||
.gitreview | ||
.zuul.yaml | ||
CONTRIBUTE.md | ||
LICENSE | ||
Makefile | ||
README.md | ||
requirements.txt | ||
setup.cfg | ||
setup.py |
Zuul Operator
Build the image
$ make image
Install the operator
$ make install
kubectl apply -f deploy/crds/zuul-ci_v1alpha1_zuul_crd.yaml -f deploy/rbac.yaml -f deploy/operator.yaml
Look for operator pod and check it's output
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
zuul-operator-c64756f66-rbdmg 2/2 Running 0 3s
$ kubectl logs zuul-operator-c64756f66-rbdmg
[...]
{"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
$ kubectl apply -f - <<EOF
apiVersion: operator.zuul-ci.org/v1alpha1
kind: Zuul
metadata:
name: example-zuul
spec:
EOF
zuul.zuul-ci.org/example-zuul created