-
Notifications
You must be signed in to change notification settings - Fork 0
DirectPV Operator 2
Cesar Celis Hernandez edited this page Jul 21, 2023
·
6 revisions
To document how I created the DirectPV Operator from scratch!.
createcluster
cd ~
sudo rm -rf ~/projects/memcached-operator
mkdir -p ~/projects/memcached-operator
cd ~/projects/memcached-operator
operator-sdk init --domain example.com --repo github.com/example/memcached-operator --plugins=go/v4-alpha
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
rm /Users/cniackz/projects/memcached-operator/api/v1alpha1/memcached_types.go
cp /Users/cniackz/base-operator/operator-tuto/memcached_types.go /Users/cniackz/projects/memcached-operator/api/v1alpha1/memcached_types.go
cd /Users/cniackz/projects/memcached-operator
make generate
cd /Users/cniackz/projects/memcached-operator
make manifests
rm /Users/cniackz/projects/memcached-operator/internal/controller/memcached_controller.go
cp /Users/cniackz/base-operator/operator-tuto/memcached_controller.go /Users/cniackz/projects/memcached-operator/internal/controller/memcached_controller.go
rm /Users/cniackz/projects/memcached-operator/cmd/main.go
cp /Users/cniackz/base-operator/operator-tuto/main.go /Users/cniackz/projects/memcached-operator/cmd/main.go
cd /Users/cniackz/projects/memcached-operator
make manifests
rm /Users/cniackz/projects/memcached-operator/Dockerfile
cp /Users/cniackz/base-operator/operator-tuto/Dockerfile /Users/cniackz/projects/memcached-operator/Dockerfile
rm /Users/cniackz/projects/memcached-operator/Makefile
cp /Users/cniackz/base-operator/operator-tuto/Makefile.mk /Users/cniackz/projects/memcached-operator/Makefile
cd /Users/cniackz/projects/memcached-operator
make docker-build docker-push
- Add
MEMCACHED_IMAGE
env var to the Deployment so it does not fail:
rm /Users/cniackz/projects/memcached-operator/config/manager/manager.yaml
cp /Users/cniackz/base-operator/operator-tuto/manager.yaml /Users/cniackz/projects/memcached-operator/config/manager/manager.yaml
make deploy
kubectl get deployment -n memcached-operator-system
cd /Users/cniackz/base-operator/operator-tuto
kubectl apply -f cache_v1alpha1_memcached.yaml
kubectl get deployment
kubectl get pods
kubectl get memcached/memcached-sample -o yaml