@@ -180,23 +180,23 @@ var _ = Describe("Reconciler", func() {
180180
181181 Describe ("#WebhookForControllerRing" , func () {
182182 It ("should have the correct settings" , func () {
183- Expect (r . WebhookForControllerRing (ring )).To (MatchFields (IgnoreExtras , Fields {
183+ Expect (WebhookForControllerRing (ring , config . Webhook . Config )).To (MatchFields (IgnoreExtras , Fields {
184184 "Name" : Equal ("sharder.sharding.timebertt.dev" ),
185185 "SideEffects" : PointTo (Equal (admissionregistrationv1 .SideEffectClassNone )),
186186 "AdmissionReviewVersions" : ConsistOf ("v1" ),
187187 }))
188188 })
189189
190190 It ("should have non-problematic failure settings" , func () {
191- Expect (r . WebhookForControllerRing (ring )).To (MatchFields (IgnoreExtras , Fields {
191+ Expect (WebhookForControllerRing (ring , config . Webhook . Config )).To (MatchFields (IgnoreExtras , Fields {
192192 "FailurePolicy" : PointTo (Equal (admissionregistrationv1 .Ignore )),
193193 "TimeoutSeconds" : PointTo (BeEquivalentTo (5 )),
194194 }))
195195 })
196196
197197 Context ("client config" , func () {
198198 It ("should use the config's default client config and add the path" , func () {
199- Expect (r . WebhookForControllerRing (ring ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
199+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
200200 Service : & admissionregistrationv1.ServiceReference {
201201 Namespace : "sharding-system" ,
202202 Name : "sharder" ,
@@ -215,7 +215,7 @@ var _ = Describe("Reconciler", func() {
215215 }
216216 clientConfig := config .Webhook .Config .ClientConfig .DeepCopy ()
217217
218- Expect (r . WebhookForControllerRing (ring ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
218+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
219219 Service : & admissionregistrationv1.ServiceReference {
220220 Namespace : clientConfig .Service .Namespace ,
221221 Name : clientConfig .Service .Name ,
@@ -230,7 +230,7 @@ var _ = Describe("Reconciler", func() {
230230 URL : ptr .To ("https://example.com/webhook" ),
231231 }
232232
233- Expect (r . WebhookForControllerRing (ring ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
233+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
234234 URL : ptr .To ("https://example.com/webhook/webhooks/sharder/controllerring/foo" ),
235235 }))
236236 })
@@ -240,15 +240,15 @@ var _ = Describe("Reconciler", func() {
240240 URL : ptr .To ("https://example.com/" ),
241241 }
242242
243- Expect (r . WebhookForControllerRing (ring ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
243+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).ClientConfig ).To (Equal (admissionregistrationv1.WebhookClientConfig {
244244 URL : ptr .To ("https://example.com/webhooks/sharder/controllerring/foo" ),
245245 }))
246246 })
247247 })
248248
249249 Context ("namespace selector" , func () {
250250 It ("should use the config's default namespace selector" , func () {
251- Expect (r . WebhookForControllerRing (ring ).NamespaceSelector ).To (Equal (& metav1.LabelSelector {
251+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).NamespaceSelector ).To (Equal (& metav1.LabelSelector {
252252 MatchExpressions : []metav1.LabelSelectorRequirement {{
253253 Key : corev1 .LabelMetadataName ,
254254 Operator : metav1 .LabelSelectorOpNotIn ,
@@ -263,7 +263,7 @@ var _ = Describe("Reconciler", func() {
263263 }
264264 namespaceSelector := config .Webhook .Config .NamespaceSelector .DeepCopy ()
265265
266- Expect (r . WebhookForControllerRing (ring ).NamespaceSelector ).To (Equal (namespaceSelector ))
266+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).NamespaceSelector ).To (Equal (namespaceSelector ))
267267 })
268268
269269 It ("should use the ControllerRing's namespace selector" , func () {
@@ -272,12 +272,12 @@ var _ = Describe("Reconciler", func() {
272272 }
273273 namespaceSelector := ring .Spec .NamespaceSelector .DeepCopy ()
274274
275- Expect (r . WebhookForControllerRing (ring ).NamespaceSelector ).To (Equal (namespaceSelector ))
275+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).NamespaceSelector ).To (Equal (namespaceSelector ))
276276 })
277277 })
278278
279279 It ("should only select unassigned objects" , func () {
280- selector , err := metav1 .LabelSelectorAsSelector (r . WebhookForControllerRing (ring ).ObjectSelector )
280+ selector , err := metav1 .LabelSelectorAsSelector (WebhookForControllerRing (ring , config . Webhook . Config ).ObjectSelector )
281281 Expect (err ).NotTo (HaveOccurred ())
282282
283283 Expect (selector .Matches (labels.Set {})).To (BeTrue ())
@@ -295,7 +295,7 @@ var _ = Describe("Reconciler", func() {
295295 },
296296 }
297297
298- Expect (r . WebhookForControllerRing (ring ).Rules ).To (ConsistOf (
298+ Expect (WebhookForControllerRing (ring , config . Webhook . Config ).Rules ).To (ConsistOf (
299299 RuleForResource (ring .Spec .Resources [0 ].GroupResource ),
300300 RuleForResource (ring .Spec .Resources [1 ].GroupResource ),
301301 RuleForResource (ring .Spec .Resources [1 ].ControlledResources [0 ]),
0 commit comments