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

OpenShift Resource Issue When resourceVersion is Included in last-applied-configuration Annotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 4.18
    • openshift-apiserver
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      There is an issue in OpenShift resources when resourceVersion is included in the kubectl.kubernetes.io/last-applied-configuration annotation. This behavior does not occur in native Kubernetes resources.

      Version-Release number of selected component (if applicable):

      oc version
      Client Version: 4.18.1
      Kustomize Version: v5.4.2
      Server Version: 4.18.2
      Kubernetes Version: v1.31.6    

      How reproducible:

       Steps to Reproduce:   

      Steps to Reproduce:

      Create a new namespace:
      
      oc create ns test-3
      
      Apply the initial BuildConfig:
      
      apply -f https://raw.githubusercontent.com/Mangaal/argocd-resource-version-issue/refs/heads/main/manifest/bc.yaml
      
      Retrieve and inspect the BuildConfig 
      
      oc get buildconfig -n test-3 core -o yaml
      oc get buildconfig -n test-3 core -o yaml > core.yaml
      
      Reapply the saved YAML file, which now includes the latest metadata.resourceVersion:
      oc apply -f core.yaml
      
      Verify that resourceVersion is included in the annotation:
      
      oc get buildconfig core -n test-3 -o jsonpath="{.metadata.annotations.kubectl\.kubernetes\.io/last-applied-configuration}" | jq
      
      The resourceVersion is present in last-applied-configuration because the previously applied YAML contained it. Attempt to reapply the original YAML file:
      oc apply -f https://raw.githubusercontent.com/Mangaal/argocd-resource-version-issue/refs/heads/main/manifest/bc.yaml
      
      Observed Error:
      
      The buildconfigs "core" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update

      Actual results:

      OpenShift resources like BuildConfig and Route encounter errors when reapplying YAML due to resourceVersionbeing included in the last-applied-configuration annotation.

      Expected results:

      The behavior should be consistent with Kubernetes native k8s resource (e.g., Deployment), where similar OpenShift resources (e.g., Route) do not have this issue.

      Additional info:

        https://issues.redhat.com/browse/GITOPS-6009  

              Unassigned Unassigned
              rh-ee-mmeetei Mangaal Meetei
              None
              None
              Rahul Gangwar Rahul Gangwar
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: