@@ -61,6 +61,11 @@ var _ = Describe("application", func() {
6161 instance , err := ControllerManagedBy (m ).
6262 For (& appsv1.ReplicaSet {}).
6363 Owns (& appsv1.ReplicaSet {}).
64+ WithOptions (controller.Options {
65+ LeaderElection : & controller.LeaderElectionOptions {
66+ NeedLeaderElection : false ,
67+ },
68+ }).
6469 Build (noop )
6570 Expect (err ).NotTo (HaveOccurred ())
6671 Expect (instance ).NotTo (BeNil ())
@@ -75,6 +80,11 @@ var _ = Describe("application", func() {
7580 instance , err := ControllerManagedBy (m ).
7681 For (& fakeType {}).
7782 Owns (& appsv1.ReplicaSet {}).
83+ WithOptions (controller.Options {
84+ LeaderElection : & controller.LeaderElectionOptions {
85+ NeedLeaderElection : false ,
86+ },
87+ }).
7888 Build (noop )
7989 Expect (err ).To (MatchError (ContainSubstring ("no kind is registered for the type builder.fakeType" )))
8090 Expect (instance ).To (BeNil ())
@@ -97,6 +107,11 @@ var _ = Describe("application", func() {
97107 instance , err := ControllerManagedBy (m ).
98108 For (& appsv1.ReplicaSet {}).
99109 Owns (& appsv1.ReplicaSet {}).
110+ WithOptions (controller.Options {
111+ LeaderElection : & controller.LeaderElectionOptions {
112+ NeedLeaderElection : false ,
113+ },
114+ }).
100115 Build (noop )
101116 Expect (err ).To (HaveOccurred ())
102117 Expect (err .Error ()).To (ContainSubstring ("expected error" ))
@@ -120,7 +135,12 @@ var _ = Describe("application", func() {
120135 instance , err := ControllerManagedBy (m ).
121136 For (& appsv1.ReplicaSet {}).
122137 Owns (& appsv1.ReplicaSet {}).
123- WithOptions (controller.Options {MaxConcurrentReconciles : maxConcurrentReconciles }).
138+ WithOptions (controller.Options {
139+ MaxConcurrentReconciles : maxConcurrentReconciles ,
140+ LeaderElection : & controller.LeaderElectionOptions {
141+ NeedLeaderElection : false ,
142+ },
143+ }).
124144 Build (noop )
125145 Expect (err ).NotTo (HaveOccurred ())
126146 Expect (instance ).NotTo (BeNil ())
@@ -141,6 +161,11 @@ var _ = Describe("application", func() {
141161 ctrl1 , err := ControllerManagedBy (m ).
142162 For (& TestDefaultValidator {}).
143163 Owns (& appsv1.ReplicaSet {}).
164+ WithOptions (controller.Options {
165+ LeaderElection : & controller.LeaderElectionOptions {
166+ NeedLeaderElection : false ,
167+ },
168+ }).
144169 Build (noop )
145170 Expect (err ).NotTo (HaveOccurred ())
146171 Expect (ctrl1 ).NotTo (BeNil ())
@@ -149,6 +174,11 @@ var _ = Describe("application", func() {
149174 ctrl2 , err := ControllerManagedBy (m ).
150175 For (& TestDefaultValidator {}).
151176 Owns (& appsv1.ReplicaSet {}).
177+ WithOptions (controller.Options {
178+ LeaderElection : & controller.LeaderElectionOptions {
179+ NeedLeaderElection : false ,
180+ },
181+ }).
152182 Build (noop )
153183 Expect (err ).NotTo (HaveOccurred ())
154184 Expect (ctrl2 ).NotTo (BeNil ())
@@ -162,7 +192,12 @@ var _ = Describe("application", func() {
162192
163193 bldr := ControllerManagedBy (m ).
164194 For (& appsv1.Deployment {}).
165- Owns (& appsv1.ReplicaSet {})
195+ Owns (& appsv1.ReplicaSet {}).
196+ WithOptions (controller.Options {
197+ LeaderElection : & controller.LeaderElectionOptions {
198+ NeedLeaderElection : false ,
199+ },
200+ })
166201 doReconcileTest ("3" , stop , bldr , m , false )
167202 close (done )
168203 }, 10 )
@@ -173,6 +208,11 @@ var _ = Describe("application", func() {
173208
174209 bldr := ControllerManagedBy (m ).
175210 For (& appsv1.Deployment {}).
211+ WithOptions (controller.Options {
212+ LeaderElection : & controller.LeaderElectionOptions {
213+ NeedLeaderElection : false ,
214+ },
215+ }).
176216 Watches ( // Equivalent of Owns
177217 & source.Kind {Type : & appsv1.ReplicaSet {}},
178218 & handler.EnqueueRequestForOwner {OwnerType : & appsv1.Deployment {}, IsController : true })
0 commit comments