Add a script to delete ZK state This may be necessary in case Zuul's runtime state in ZK gets corrupted. Change-Id: I2743f0e6c7241be6cd103bee7b3622a6685cf8da
diff --git a/README.md b/README.md index d827fae..fec861b 100644 --- a/README.md +++ b/README.md
@@ -130,11 +130,27 @@ its config files if those changes are due to merge commits (unless the .zuul.yaml file is changed as content in the merge commit). +## Deleting ZooKeeper State + +Zuul stores its runtime state in ZooKeeper. In the case of a bug in +Zuul or some other source of data corruption, it may be necessary to +delete the state from ZooKeeper and restart the cluster. To do this, +stop all of the Pods and then run: + + kubectl -n zuul apply -f k8s/delete-state.yaml + +This will run a k8s job to delete the state. Once that pod has +exited, run the following command to clean it up: + + kubectl -n zuul delete job zuul-delete-state + +Then restart all of the Zuul services. + # Additional Help Feel free to contact James Blair (corvus) in Gerrit Slack, or the -wider Zuul community in #zuul on the OFTC IRC network, or the -zuul-discuss@lists.zuul-ci.org mailing list. +wider Zuul community at https://matrix.to/#/#zuul:opendev.org in +Matrix, or the zuul-discuss@lists.zuul-ci.org mailing list. # Appendix: Manual steps for bootstrapping
diff --git a/k8s/delete-state.yaml b/k8s/delete-state.yaml new file mode 100644 index 0000000..d9eb2fe --- /dev/null +++ b/k8s/delete-state.yaml
@@ -0,0 +1,33 @@ +apiVersion: batch/v1 +kind: Job +metadata: + namespace: zuul + name: zuul-delete-state +spec: + template: + spec: + containers: + - name: zuul-delete-state + image: zuul/zuul-scheduler + command: ["bash", "-c", "echo 'yes' | zuul delete-state"] + volumeMounts: + - name: zuul-config + mountPath: /etc/zuul + - name: zuul-tenant-config + mountPath: /etc/zuul/tenant + - name: zookeeper-client-tls + mountPath: /tls/client + readOnly: true + volumes: + - name: zuul-config + secret: + secretName: zuul-config + - name: zuul-tenant-config + secret: + secretName: zuul-tenant-config + - name: zookeeper-client-tls + secret: + secretName: zookeeper-client-tls + serviceAccountName: zuul + restartPolicy: Never + backoffLimit: 4