Skip to content

flyer103/minimalist-operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The project is designed to implement a K8s Operator with as few tools as possible and understand the K8s Operator core logic.

How to write an Operator

  1. Write CRD and register CR with kube-apiserver: crd.yaml
  2. Write resource definitions through code:

apis.png

  1. Generate clients:
$ make build-resource

You may need to prepare the code generation tool by doing the following:

$ go get k8s.io/code-generator/cmd/defaulter-gen
$ go get k8s.io/code-generator/cmd/client-gen
$ go get k8s.io/code-generator/cmd/lister-gen
$ go get k8s.io/code-generator/cmd/informer-gen
$ go get k8s.io/code-generator/cmd/deepcopy-gen
  1. Write controller and add event handlers to informer.

Usage

# Register CR.
$ kubectl apply -f yaml/crd.yaml

# Build Operator.
$ make build-operator

# Run operator outside of Cluster.
$ ./release/operator -kubeconfig ~/.kube/config

About

Minimalist Operator Demo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published