Sitelet https://github.com/feuyeux/hello-operator
Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello Operator

Kubebuilder and Operator SDK have long been seen as competitors in the field of Operator tooling, when in reality there was collaboration going on for some time already. Now, with the Operator Framework being incubated into CNCF, we are coming together on a single solution that creates Golang Operators (Kubebuilder) while the SDK provides a holistic experience in creating, testing, bundling and releasing Operators. https://www.openshift.com/blog/operator-sdk-reaches-v1.0

Guestbook Sample

1 init

sh build_sample.sh
sh open_sample.sh

2 edit

  1. api/v1/guestbook_types.go:32
    BookName string `json:"book_name,omitempty"`
  2. api/v1/guestbook_types.go:38
    Status string `json:"Status"`
  3. controllers/guestbook_controller.go:45
    obj := &appv1.Guestbook{}
    if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
      log.Println(err, "Unable to fetch object")
    } else {
      log.Println("Greeting from Kubebuilder to", obj.Spec.BookName)
    }
    obj.Status.Status = "Running"
    if err := r.Status().Update(ctx, obj); err != nil {
      log.Println(err, "unable to update status")
    }
  4. config/samples/app_v1_guestbook.yaml
    apiVersion: app.feuyeux.io/v1
    kind: Guestbook
    metadata:
      name: guestbook-sample
    spec:
      book_name: kubebuilder-operator-sample

3 rebuild&run

sh rebuild_sample.sh
sh test_sample.sh

4 cleanup

echo "Uninstall CRDs"
make uninstall

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages