Skip to content

Commit

Permalink
✨ Plug DryRunWrapper into manager constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaroaleman committed Mar 16, 2020
1 parent 71fe9fd commit e5ce18f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ type Options struct {
// use the cache for reads and the client for writes.
NewClient NewClientFunc

// DryRunClient specifies whether the client should be configured to enforce
// dryRun mode.
DryRunClient bool

// EventBroadcaster records Events emitted by the manager and sends them to the Kubernetes API
// Use this to customize the event correlator and spam filter
EventBroadcaster record.EventBroadcaster
Expand Down Expand Up @@ -257,6 +261,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
if err != nil {
return nil, err
}

if options.DryRunClient {
writeObj = client.NewDryRunClient(writeObj)
}

// Create the recorder provider to inject event recorders for the components.
// TODO(directxman12): the log for the event provider should have a context (name, tags, etc) specific
// to the particular controller that it's being injected into, rather than a generic one like is here.
Expand Down

0 comments on commit e5ce18f

Please sign in to comment.