@@ -359,21 +359,26 @@ func modifyConversionWebhooks(crds []apiextensionsv1.CustomResourceDefinition, s
359
359
}
360
360
url := pointer .StringPtr (fmt .Sprintf ("https://%s/convert" , hostPort ))
361
361
362
- for _ , c := range crds {
362
+ for i := range crds {
363
363
// Continue if we're preserving unknown fields.
364
- if c .Spec .PreserveUnknownFields {
364
+ if crds [ i ] .Spec .PreserveUnknownFields {
365
365
continue
366
366
}
367
367
// Continue if the GroupKind isn't registered as being convertible.
368
368
if _ , ok := convertibles [schema.GroupKind {
369
- Group : c .Spec .Group ,
370
- Kind : c .Spec .Names .Kind ,
369
+ Group : crds [ i ] .Spec .Group ,
370
+ Kind : crds [ i ] .Spec .Names .Kind ,
371
371
}]; ! ok {
372
372
continue
373
373
}
374
- c .Spec .Conversion .Strategy = apiextensionsv1 .WebhookConverter
375
- c .Spec .Conversion .Webhook .ClientConfig .Service = nil
376
- c .Spec .Conversion .Webhook .ClientConfig = & apiextensionsv1.WebhookClientConfig {
374
+ if crds [i ].Spec .Conversion == nil {
375
+ crds [i ].Spec .Conversion = & apiextensionsv1.CustomResourceConversion {
376
+ Webhook : & apiextensionsv1.WebhookConversion {},
377
+ }
378
+ }
379
+ crds [i ].Spec .Conversion .Strategy = apiextensionsv1 .WebhookConverter
380
+ crds [i ].Spec .Conversion .Webhook .ConversionReviewVersions = []string {"v1" , "v1beta1" }
381
+ crds [i ].Spec .Conversion .Webhook .ClientConfig = & apiextensionsv1.WebhookClientConfig {
377
382
Service : nil ,
378
383
URL : url ,
379
384
CABundle : webhookOptions .LocalServingCAData ,
0 commit comments