Quickstart for Go-based Operators
- Go through the installation guide.
- User authorized with permissions.
- An accessible image registry for various operator images (ex. , quay.io) and be logged in your command line environment.
example.com
is used as the registry Docker Hub namespace in these examples. Replace it with another value if using a different registry or namespace.- if the registry is private or uses a custom CA.
- Create a simple Memcached API:
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
- Build and push your operator’s image:
make docker-build docker-push IMG="example.com/memcached-operator:v0.0.1"
- Install OLM:
operator-sdk olm install
- Bundle your operator, then build and push the bundle image (defaults to ):
- Run your bundle. If your bundle image is hosted in a registry that is private and/or has a custom CA, these must be complete.
operator-sdk run bundle <some-registry>/memcached-operator-bundle:v0.0.1
- Create a sample Memcached custom resource:
$ kubectl apply -f config/samples/cache_v1alpha1_memcached.yaml
- Uninstall the operator:
operator-sdk cleanup memcached-operator
- Deploy your operator:
- Create a sample Memcached custom resource:
memcached.cache.example.com/memcached-sample created
- Uninstall the operator:
make undeploy
- Run the operator:
make install run
- In a new terminal tab/window, create a sample Memcached custom resource: