Quickstart for Go-based Operators
This guide walks through an example of building a simple memcached-operator using tools and libraries provided by the Operator SDK.
- Go through the installation guide.
- User authorized with permissions.
- Create a project directory for your project and initialize the project:
- Create a simple Memcached API:
- Use the built-in Makefile targets to build and push your operator. Make sure to define
IMG
when you callmake
:
export USERNAME=<quay-namespace>
export OPERATOR_IMG="quay.io/$USERNAME/memcached-operator:v0.0.1"
make docker-build docker-push IMG=$OPERATOR_IMG
SHELL := /bin/bash
- Install :
- Bundle your operator and push the bundle image:
make bundle IMG=$OPERATOR_IMG
export BUNDLE_IMG="quay.io/$USERNAME/memcached-operator-bundle:v0.0.1"
make docker-push IMG=$BUNDLE_IMG
- Run your bundle:
operator-sdk run bundle $BUNDLE_IMG
- Create a sample Memcached custom resource:
- Uninstall the operator:
operator-sdk cleanup memcached-operator
Direct deployment
- Deploy your operator:
make deploy IMG=$OPERATOR_IMG
- Create a sample Memcached custom resource:
Read the for an in-depth walkthough of building a Go operator.