Skip to content

mukesh-dua/watchlist-operator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watchlist-operator

Demo source for article - https://medium.com/manikkothu/build-kubernetes-operator-using-kubebuilder-4bfef299757d

steps

$ go mod init my-watchlist.io
$ kubebuilder init --domain demo.my-watchlist.io
$ kubebuilder create api --group webapp --kind MyWatchlist --version v1
Create Resource [y/n]
y
Create Controller [y/n]
y
$ kubebuilder create api --group webapp --kind Redis --version v1
Create Resource [y/n]
y
Create Controller [y/n]
y
# After create Frontend struc, to auto generate deepcopy methods

$ kubebuilder create api --group webapp --kind Frontend --version v1
Create Resource [y/n]
n
Create Controller [y/n]
n
$ make manifests
$ kubectl create -f config/crd/bases/
$ kubectl create -f config/samples/webapp_v1_redis.yaml 
$ kubectl create -f config/samples/webapp_v1_mywatchlist.yaml 
$ make run
$ kubectl port-forward svc/mywatchlist-sample 7000:8080

get logs from side-car pod

kubectl logs watchlist-operator-controller-manager-8549945dc7-f2qtb -n watchlist-operator-system manager

kubectl logs --follow pod/watchlist-operator-controller-manager-8549945dc7-zh67c -n watchlist-operator-system manager 

# note: manager is the container name of the sidecar, this is required in this case because there are two containers in the manager pod - manager and rbac-proxy

get all

kubectl get all -n watchlist-operator-system

clean-up

kubectl delete -f config/crd/bases/
kubectl delete -f config/samples/webapp_v1_redis.yaml 
kubectl delete -f config/samples/webapp_v1_mywatchlist.yaml 

Deploy from docker repo

make deploy IMG=hmanikkothu/mywatchlist-operator:v1

kubectl create -f config/samples/webapp_v1_redis.yaml 
kubectl create -f config/samples/webapp_v1_mywatchlist.yaml 

clean-up

kubectl delete -f config/samples/webapp_v1_redis.yaml 
kubectl delete -f config/samples/webapp_v1_mywatchlist.yaml 

make undeploy IMG=<repo>/mywatchlist-operator:v1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 90.1%
  • Makefile 7.4%
  • Dockerfile 2.5%