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
372372 case * apiextensionsv1beta1.CustomResourceDefinition :
373373 c .Spec .Conversion .WebhookClientConfig .Service = nil
374374 c .Spec .Conversion .WebhookClientConfig = & apiextensionsv1beta1.WebhookClientConfig {
375+ Service : nil ,
376+ URL : url ,
375377 CABundle : webhookOptions .LocalServingCAData ,
376378 }
377379 case * apiextensionsv1.CustomResourceDefinition :
378380 c .Spec .Conversion .Webhook .ClientConfig .Service = nil
379381 c .Spec .Conversion .Webhook .ClientConfig = & apiextensionsv1.WebhookClientConfig {
382+ Service : nil ,
380383 URL : url ,
381384 CABundle : webhookOptions .LocalServingCAData ,
382385 }
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+ }
383408 }
384409 }
385410
You can’t perform that action at this time.
0 commit comments