remaining traces of old Flux CRDs (OCIRepo v1beta2, example)

In CI pipelines testing the upgrade from 1.6 to 1.7 on an internal project derived from Sylva where kubectl apply is used to define OCIRepositories, we ran into the following problem:

Error from server: request to convert CR to an invalid group/version: source.toolkit.fluxcd.io/v1beta2

This happens after upgrading the management cluster from sylva 1.6 to 1.7.

This happens on this objects:

kind: OCIRepository
metadata:
  # ...
  managedFields:
  - apiVersion: source.toolkit.fluxcd.io/v1beta2   # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:interval: {}
        f:ref:
          f:tag: {}
        f:url: {}
    manager: kubectl
    operation: Apply
    time: "2026-07-06T04:38:15Z"
  # ...

The explanation is simple:

  • this object has traces of the old v1beta2 version in the managedFields
  • this apiVersion is deleted by the upgrade to Flux 2.8 done when pgrading the management cluster from sylva 1.6 to 1.7

We already ran into this problem pattern in #3996 (closed)/#3807 (closed), which we solved by !7680 (merged) that introduced a MigrateAPIVersion feature-gate on kustomize-controller... but this change only enforce the apiVersion migration for resources handled by kustomize-controller, and does not solve it for FluxCD resources handled by other controllers.

We need to revive !7487 (merged) to address this problem.