Skip to content

Commit

Permalink
Documentation for eventhandlers.Path
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittrock committed Apr 5, 2018
1 parent 6bf7b0b commit 0ed8d2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controller/eventhandlers/eventhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,17 @@ func (mp MapAndEnqueue) addRateLimited(r workqueue.RateLimitingInterface, obj in
}
}

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

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

type MapToController struct {
Expand Down

0 comments on commit 0ed8d2a

Please sign in to comment.