A small Kubernetes Custom Controller in Go.
using operator-sdk, execute the below command to init the custom controller
operator-sdk init --domain interview.com --repo gitlab.com/rfashwal/dummy-controller
- execute the below command for api creation
operator-sdk create api --group=interview --version=v1alpha1 --kind=Dummy
- create the resource and the controller
Create Resource [y/n]
y
Create Controller [y/n]
y
make manifests
make generate
Open the generated file api/v1alpha1/dummy_types.go and modify it to define the structure of the Dummy custom resource spec, update the controller logic accordingly.
A CI process will build the image and push it to the registry where it can be used to deploy the controller Deploy the controller after the image is pushed:
make deploy IMG=rfashwal/dummy-controller:1-init-dummy-operator
Update the status of Dummy crd to include SpecEcho and follow the above steps to build and deploy
- Update Dummy status to include podStatus
- Update controller to check for pod if not found, create the pod
- Update the dummy staus to include podStatus
- initiate a Kubernetes cluster using kind or minikube
- kubectl command-line tool
- Docker
- Operator SDK
- The release images are found under: https://hub.docker.com/repository/docker/rfashwal/dummy-controller/tags?page=1&ordering=last_updated
For each step, a branch is created and image is released, so you can test any step independently.
latest
tag is the final working controller as specified.
- clone the repo:
git clone [email protected]:rfashwal/dummy-controller.git
- deploy with target image tag:
make deploy IMG=rfashwal/dummy-controller:{tag}