File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -371,11 +371,16 @@ func modifyConversionWebhooks(crds []*apiextensionsv1.CustomResourceDefinition,
371
371
if crds [i ].Spec .PreserveUnknownFields {
372
372
continue
373
373
}
374
- // Continue if the GroupKind isn't registered as being convertible.
374
+ // Continue if the GroupKind isn't registered as being convertible,
375
+ // and remove any existing conversion webhooks if they exist.
376
+ // This is to prevent the CRD from being rejected by the apiserver, usually
377
+ // manifests that are generated by controller-gen will have a conversion
378
+ // webhook set, but we don't want to enable it if the type isn't registered.
375
379
if _ , ok := convertibles [schema.GroupKind {
376
380
Group : crds [i ].Spec .Group ,
377
381
Kind : crds [i ].Spec .Names .Kind ,
378
382
}]; ! ok {
383
+ crds [i ].Spec .Conversion = nil
379
384
continue
380
385
}
381
386
if crds [i ].Spec .Conversion == nil {
You can’t perform that action at this time.
0 commit comments