Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-61228

Route.metadata.generation is not updated on OpenShift

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • Rejected
    • NI&D Sprint 276
    • 1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem

      The metadata.generation field on the Route API object does not increment when changes are made to a route's spec. This behavior is contrary to the general expectation for Kubernetes API objects that metadata.generation should increase monotonically with changes to spec. This missing update to metadata.generation impacts controllers, such as the workload identity manager operator, that rely on metadata.generation to make reconciliation decisions.

      Version-Release number of selected component (if applicable)

      This issue affects OpenShift 4.20 and most likely all previous OpenShift 3 and 4 releases.

      This issue does not affect MicroShift, where the Route API is defined as a CRD.

      How reproducible

      This issue is consistently reproducible. Any update to a field within a route object's spec (e.g., spec.tls.termination) via oc apply or oc edit fails to increment the metadata.generation field.

      Steps to Reproduce

      1. Create a route object.
      2. Retrieve the route object and note its initial metadata.generation value.
      3. Modify a field within the route's spec (e.g., spec.tls.termination) using a command such as oc edit or oc patch.
      4. Retrieve the updated route object and observe the metadata.generation value again.

      Actual results

      The metadata.generation field on the route object remains unchanged after modifications to its spec.

      Expected results

      The metadata.generation field should increment monotonically when the spec of the route object is updated.

      Additional info

      The PrepareForUpdate method within the openshift-apiserver's route strategy is missing the logic to update metadata.generation: https://github.com/openshift/openshift-apiserver/blob/91face977f734e086486e804eec288e9b4e43bd3/pkg/route/apiserver/registry/route/strategy.go#L79-L99

      The general expectation is that any spec change on a Kubernetes API object causes the generation to increment: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata

      Note that using resourceVersion as an alternative to generation is problematic because it is updated even by router-initiated status changes, which using resourceVersion in a controller could lead to unnecessary reconciliations or other misbehavior.

      The discrepancy in behavior between OpenShift and MicroShift (where Route is a CRD, and so metadata.generation gets updated) is not ideal; we should align OpenShift and MicroShift by fixing openshift-apiserver.

      There is no existing status.observedGeneration field on the Route API, and the router code does not currently use Route.metadata.generation at all; given this, and given that MicroShift already increments metadata.generation, it should be low risk to add logic in openshift-apiserver to increment metadata.generation.

              rh-ee-rpchevuz Ricardo Pchevuzinske Katz
              mmasters1@redhat.com Miciah Masters
              None
              None
              Rahul Gangwar Rahul Gangwar
              None
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: