Skip to content

Commit 8604405

Browse files
authored
consider only served versions for crd usage check (#416)
1 parent 3c6d6a2 commit 8604405

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pkg/reconciler/reconciler.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,9 +1531,11 @@ func (r *Reconciler) isTypeUsed(ctx context.Context, gk schema.GroupKind, hashed
15311531

15321532
func (r *Reconciler) isCrdUsed(ctx context.Context, crd *apiextensionsv1.CustomResourceDefinition, hashedOwnerId string, onlyForeign bool) (bool, error) {
15331533
gvk := schema.GroupVersionKind{
1534-
Group: crd.Spec.Group,
1535-
Version: crd.Spec.Versions[0].Name,
1536-
Kind: crd.Spec.Names.Kind,
1534+
Group: crd.Spec.Group,
1535+
Version: slices.Select(crd.Spec.Versions, func(v apiextensionsv1.CustomResourceDefinitionVersion) bool {
1536+
return v.Served
1537+
})[0].Name,
1538+
Kind: crd.Spec.Names.Kind,
15371539
}
15381540
list := &unstructured.UnstructuredList{}
15391541
list.SetGroupVersionKind(gvk)

0 commit comments

Comments
 (0)