Skip to content

Commit 88179ac

Browse files
authored
Merge pull request #484 from shawn-hurley/feature/adding-unstructured-doc
Adding unstructured example for book
2 parents aca81e1 + 4053e38 commit 88179ac

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/book/beyond_basics/controller_watches.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Resources.
99
## Watching the Controller Resource
1010

1111
Controllers may watch Resources and trigger Reconcile calls with the key of the
12-
object from the watch event.
12+
object from the watch event.
1313

1414
This example configures a controller to watch for Pod events, and call Reconcile with
1515
the Pod key.
@@ -32,6 +32,18 @@ if err != nil {
3232
return err
3333
}
3434
```
35+
36+
```go
37+
// You can also watch unstructured objects
38+
u := &unstructured.Unstructured{}
39+
u.SetGroupVersionKind(schema.GroupVersionKind{
40+
Kind: "Pod",
41+
Group: "",
42+
Version: "v1",
43+
})
44+
45+
err = c.Watch(&source.Kind{Type: u}, &handler.EnqueueRequestForObject{})
46+
```
3547
{% endmethod %}
3648

3749

0 commit comments

Comments
 (0)