From e5ce18f462e4fa4f0f6dea8a1ebf8be230584477 Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Thu, 5 Mar 2020 23:16:15 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Plug=20DryRunWrapper=20into=20manag?= =?UTF-8?q?er=20constructor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/manager/manager.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 852eb787b9..dbd23d197e 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -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 @@ -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.