This example creates a new Controller named "pod-controller" with a no-op reconcile function. The manager.Manager will be used to Start the Controller, and will provide it a shared Cache and Client.
()
| 41 | // This example creates a new Controller named "pod-controller" with a no-op reconcile function. The |
| 42 | // manager.Manager will be used to Start the Controller, and will provide it a shared Cache and Client. |
| 43 | func ExampleNew() { |
| 44 | _, err := controller.New("pod-controller", mgr, controller.Options{ |
| 45 | Reconciler: reconcile.Func(func(context.Context, reconcile.Request) (reconcile.Result, error) { |
| 46 | // Your business logic to implement the API by creating, updating, deleting objects goes here. |
| 47 | return reconcile.Result{}, nil |
| 48 | }), |
| 49 | }) |
| 50 | if err != nil { |
| 51 | log.Error(err, "unable to create pod-controller") |
| 52 | os.Exit(1) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // This example starts a new Controller named "pod-controller" to Watch Pods and call a no-op Reconciler. |
| 57 | func ExampleController() { |