DirectPV Operator 3 - cniackz/public GitHub Wiki

Creas el cluster:

createcluster

Creas el folder:

cd ~
sudo rm -rf ~/projects/memcached-operator
mkdir -p ~/projects/memcached-operator
cd ~/projects/memcached-operator

Inicias el Proyecto y creas el API:

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

Copias Archivos:

### 1. memcached_types.go
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

### 2. memcached_controller.go
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

### 3. main.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

### 4. Dockerfile
rm /Users/cniackz/projects/memcached-operator/Dockerfile
cp /Users/cniackz/base-operator/operator-tuto/Dockerfile /Users/cniackz/projects/memcached-operator/Dockerfile

### 5. Makefile
rm /Users/cniackz/projects/memcached-operator/Makefile
cp /Users/cniackz/base-operator/operator-tuto/Makefile.mk /Users/cniackz/projects/memcached-operator/Makefile

### 6. manager.yaml
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

Generas los manifiestos:

cd /Users/cniackz/projects/memcached-operator
make generate
make manifests

Empujas:

cd /Users/cniackz/projects/memcached-operator
make docker-build docker-push

Deployeas:

make deploy

Verificas el Operador:

kubectl get deployment -n memcached-operator-system

Creas tenant:

cd /Users/cniackz/base-operator/operator-tuto
kubectl apply -f cache_v1alpha1_memcached.yaml

Verificas tenant:

kubectl get deployment
kubectl get pods
kubectl get memcached/memcached-sample -o yaml