Skip to content

Commit 72e1199

Browse files
author
Phillip Wittrock
authored
Merge pull request #61 from pwittrock/master
Documentation for eventhandlers.Path
2 parents 6bf7b0b + 0ed8d2a commit 72e1199

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/controller/eventhandlers/eventhandlers.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,17 @@ func (mp MapAndEnqueue) addRateLimited(r workqueue.RateLimitingInterface, obj in
8888
}
8989
}
9090

91+
// ControllerLookup takes a ReconcileKey and returns the matching resource
9192
type ControllerLookup func(types.ReconcileKey) (interface{}, error)
9293

94+
// Path is list of functions that allow an instance of a resource to be traced back to an owning ancestor. This
95+
// is done by following the chain of owners references and comparing the UID in the owners reference against
96+
// the UID of the instance returned by ControllerLookup.
97+
// e.g. if resource Foo creates Deployments, and wanted to trigger reconciles in response to Pod events created by
98+
// the Deployment, then Path would contain the following [function to lookup a ReplicaSet by namespace/name,
99+
// function to lookup a Deployment by namespace/name, function to lookup a Foo by namespace/name]. When
100+
// a Pod event is observed, this Path could then walk the owners references back to the Foo to get its namespace/name
101+
// and then reconcile this Foo.
93102
type Path []ControllerLookup
94103

95104
type MapToController struct {

0 commit comments

Comments
 (0)