Skip to content

Commit e5ce18f

Browse files
committed
✨ Plug DryRunWrapper into manager constructor
1 parent 71fe9fd commit e5ce18f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/manager/manager.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ type Options struct {
184184
// use the cache for reads and the client for writes.
185185
NewClient NewClientFunc
186186

187+
// DryRunClient specifies whether the client should be configured to enforce
188+
// dryRun mode.
189+
DryRunClient bool
190+
187191
// EventBroadcaster records Events emitted by the manager and sends them to the Kubernetes API
188192
// Use this to customize the event correlator and spam filter
189193
EventBroadcaster record.EventBroadcaster
@@ -257,6 +261,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
257261
if err != nil {
258262
return nil, err
259263
}
264+
265+
if options.DryRunClient {
266+
writeObj = client.NewDryRunClient(writeObj)
267+
}
268+
260269
// Create the recorder provider to inject event recorders for the components.
261270
// TODO(directxman12): the log for the event provider should have a context (name, tags, etc) specific
262271
// to the particular controller that it's being injected into, rather than a generic one like is here.

0 commit comments

Comments
 (0)