Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct{}
Controller provides a crwatcher.ResourceController that prints the events out as the are received. It is a basic implementation that can be used for debugging. It also serves as an example for how you could implement your own crwatcher.ResourceController.
func (Controller) ResourceAdded ¶
func (c Controller) ResourceAdded(r *unstructured.Unstructured)
ResourceAdded will receive a custom resource when it is created and print that the CR was added
Example ¶
r := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "name": "Thing1", }, }, } Controller{}.ResourceAdded(r)
Output: CR added: Thing1
func (Controller) ResourceDeleted ¶
func (c Controller) ResourceDeleted(r *unstructured.Unstructured)
ResourceDeleted will receive a custom resource when it is deleted and print that the CR was deleted
Example ¶
r := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "name": "Thing1", }, }, } Controller{}.ResourceDeleted(r)
Output: CR deleted: Thing1
func (Controller) ResourceUpdated ¶
func (c Controller) ResourceUpdated(oldR, newR *unstructured.Unstructured)
ResourceUpdated receives both an the old version and current version of a custom resource and will print out the the custom resource was changed
Example ¶
oldR := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "name": "Thing1", }, }, } newR := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "name": "Thing2", }, }, } Controller{}.ResourceUpdated(oldR, newR)
Output: CR changed: Thing2
Click to show internal directories.
Click to hide internal directories.