Generate a scaffold for the operator.
operator-sdk init --repo=github.com/leszko/hazelcast-operator
operator-sdk create api --version v1 --group=hazelcast --kind Hazelcast --resource=true --controller=true
Add the logic to api/v1/hazelcast-types.go
and controllers/hazelcast_controller.go
.
docker build -t leszko/hazelcast-operator:go . && docker push leszko/hazelcast-operator:go
make install
make deploy IMG=leszko/hazelcast-operator:go
Check that the operator is running with the following command.
kubectl logs deployment.apps/hazelcast-operator-controller-manager -n hazelcast-operator-system -c manager
kubectl apply -f config/samples/hazelcast_v1_hazelcast.yaml
Note: If you want Hazelcast members themselves to form a cluster, you need to configure RBAC for Hazelcast: kubectl apply -f https://raw.githubusercontent.com/hazelcast/hazelcast-kubernetes/master/rbac.yaml
.
kubectl delete -f config/samples/hazelcast_v1_hazelcast.yaml
kustomize build config/default | kubectl delete -f -