etcd operator guide for developers.
How to start contributing
First of all, etcd operator uses kubebuilder. See official docs to learn more.
Easy way
Using this way, you don’t be able to debug the controller locally. After every change you will have to redeploy changes.
Pre-requisites
- Any docker-like container tool, “docker” by default. For more information search for:
CONTAINER_TOOL
in Makefile. - kubectl
Steps
Create and prepare kind cluster:
make kind-prepare
Build image and load it into kind cluster:
make kind-load
Deploy CRDs, etcd-operator, RBAC, webhook certs into kind cluster:
make deploy
To deploy your code changes, load a new image and redeploy etcd-operator:
make kind-load && make redeploy
To clean up after all, delete kind cluster:
make kind-delete
Advanced way
Using VSCode you can connect your IDE to a pod in kubernetes cluster and use go run cmd/main.go
from the pod.
It will allow you to debug easily and faster integrate code changes to you develop environment.
General steps
- Install VSCode Kubernetes extension.
- Install VSCode Dev Containers extension.
- Create pvc to store operator code, go modules and your files.
- Build Dockerfile to create image for your develop environment (git, golang , etc…). Take base image that you love most.
- Patch operator deployment to
- Attach PVC from step 3.
- Change operator image to your image.
- Change command and args to endless sleep loop.
- Change rolling update strategy to recreate if you use RWO storage class.
- Change security context RunAsNonRoot to false.
- Increase requests and limits.
- Remove readiness and liveness probes.
- Attach VSCode to a running container through Kubernetes extension.
- Install necessary extensions to the container. They will be preserved after container restart if you attached pvc to home directory.
- Run
go run cmd/main.go
.
Release procedure
Every PR should have a label to show what kind of changes does it bring. For example, PRs with docs changes should have
documentation
label. This labels will be used by the release-drafter
workflow to prepare the release draft.
Cutting off a release
When all tasks for the release are merged to main
branch, maintainer should
- create new minor or major version in
site
if it’s not a patch release and merge this PR tomain
branch - check that tag has not been already created. If it has been, delete it
- publish the release using draft, created by
release-drafter
- you are amazing :)