File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -372,14 +372,39 @@ func modifyConversionWebhooks(crds []client.Object, webhookOptions WebhookInstal
372
372
case * apiextensionsv1beta1.CustomResourceDefinition :
373
373
c .Spec .Conversion .WebhookClientConfig .Service = nil
374
374
c .Spec .Conversion .WebhookClientConfig = & apiextensionsv1beta1.WebhookClientConfig {
375
+ Service : nil ,
376
+ URL : url ,
375
377
CABundle : webhookOptions .LocalServingCAData ,
376
378
}
377
379
case * apiextensionsv1.CustomResourceDefinition :
378
380
c .Spec .Conversion .Webhook .ClientConfig .Service = nil
379
381
c .Spec .Conversion .Webhook .ClientConfig = & apiextensionsv1.WebhookClientConfig {
382
+ Service : nil ,
380
383
URL : url ,
381
384
CABundle : webhookOptions .LocalServingCAData ,
382
385
}
386
+ case * unstructured.Unstructured :
387
+ webhookClientConfig := map [string ]interface {}{
388
+ "url" : * url ,
389
+ "caBundle" : webhookOptions .LocalServingCAData ,
390
+ }
391
+
392
+ switch c .GroupVersionKind ().Version {
393
+ case "v1beta1" :
394
+ if err := unstructured .SetNestedMap (
395
+ c .Object ,
396
+ webhookClientConfig ,
397
+ "spec" , "conversion" , "webhookClientConfig" ); err != nil {
398
+ return err
399
+ }
400
+ case "v1" :
401
+ if err := unstructured .SetNestedMap (
402
+ c .Object ,
403
+ webhookClientConfig ,
404
+ "spec" , "conversion" , "webhook" , "clientConfig" ); err != nil {
405
+ return err
406
+ }
407
+ }
383
408
}
384
409
}
385
410
You can’t perform that action at this time.
0 commit comments