Skip to content

Commit

Permalink
adding unstructured example
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn Hurley committed Nov 14, 2018
1 parent 002c18b commit 4053e38
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/book/beyond_basics/controller_watches.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources.
## Watching the Controller Resource

Controllers may watch Resources and trigger Reconcile calls with the key of the
object from the watch event.
object from the watch event.

This example configures a controller to watch for Pod events, and call Reconcile with
the Pod key.
Expand All @@ -32,6 +32,18 @@ if err != nil {
return err
}
```

```go
// You can also watch unstructured objects
u := &unstructured.Unstructured{}
u.SetGroupVersionKind(schema.GroupVersionKind{
Kind: "Pod",
Group: "",
Version: "v1",
})

err = c.Watch(&source.Kind{Type: u}, &handler.EnqueueRequestForObject{})
```
{% endmethod %}


Expand Down

0 comments on commit 4053e38

Please sign in to comment.