Pocket Operator
Deploy and manage pocket nodes on Kubernetes.
Overview
The Pocket Operator extends the Kubernetes control plane to create, read, update
and delete pocket nodes using custom resources.
This operator was built with
operator-builder.
⚠️ Under active development
We are currently working on the first release of the operator. That means the API and CRD are subject to change - in fact they most certainly are going to be changed. We will be updating this README as we make progress. Not production ready. Expect issues.
Installation
We provide kustomize manifests for deploying the operator. To create manifests to deploy the latest version of operator, run the following command:
kustomize build "https://github.com/pokt-network/pocket-operator//config/default?ref=master"
Usage
Please see the supported Custom Resource Definitions (CRDs) in the config/crd directory.
We do not ship Postgres database with this operator, it is up to a user to choose a way to run the database. We suggest to utilize Postgres Operators such as CrunchyData or zalando's postgres-operator for that purpose due to additional availability guarantees (replications, backups, etc). We do have an example in the config/samples directory for one non-replicated Postgres deployment. Once this product matures, we are going to publish a step-by-step guide with a recommended way to deploy postgres operators.
Examples can be found in the config/samples directory.
Local Development & Testing
To install the custom resource/s for this operator, make sure you have a
kubeconfig set up for a test cluster, then install the CRDs.
make install
To run the controller locally against your test cluster.
make run
You can then test the operator by creating the sample manifests in another
terminal.
kubectl apply -f config/samples
Give the validators some time to come up. The validator nodes will go into a crashloop if database is not yet available, but will restart and retry.
Run the dev client in the pocket client container. See the pocket development
docs
for more info on using the dev client.
kubectl exec -it pocket-v1-client -- go run app/client/main.go
Finally, once testing is complete you can clean up. Note: you will need to run
the controller to finalize resource deletion with make run
if you stopped it.
make uninstall
Code Generation
The following steps will re-generate the codebase from scratch after making
changes to the configurations, source manifests and/or markers.
Caution: These steps will permanently delete any changes you have made
directly to the codebase that is being provisioned by operator-builder.
Re-build the codebase from the existing configurations and source manifests.
cd .opertator-builder
make operator-build
Install the dependencies (postgres operator) in your test cluster.
make operator-dependencies
Copy the modified sample manifests into the config/samples
directory of the
codebase.
make operator-samples
cd ../
You can now re-test the operator using the Local Development & Testing
instructions above.
Deploy the Controller Manager
First, set the image name.
export IMG=myrepo/myproject:v0.1.0
Now you can build and push the image.
make docker-build
make docker-push
Then deploy.
make deploy
To clean up.
make undeploy
Companion CLI
To build the companion CLI.
make build-cli
The CLI binary will get saved to the bin directory. You can see the help
message with the following.
./bin/pocketctl help
Contributing
Please read CONTRIBUTING.md for details on contributions and the process of submitting pull requests.
License
This project is licensed under the MIT License; see the LICENSE.md file for details.