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

OLM does not copy target.workload.openshift.io/management annotation to pods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • 4.19
    • OLM
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Important
    • None
    • None
    • None
    • Rejected
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem

      OLM does not propagate the target.workload.openshift.io/management annotation specified in Subscription.spec.config.annotations to pods.

      Version-Release number of selected component (if applicable)

      % oc version
      Client Version: 4.18.8
      Kustomize Version: v5.4.2
      Server Version: 4.19.0-0.ci.test-2025-04-08-214738-ci-ln-clhrhvt-latest
      Kubernetes Version: v1.32.3-dirty
      

      How reproducible

      100%.

      Steps to Reproduce

      1. Create a subscription.

      oc -n openshift-operators create -f - <<EOF
      apiVersion: operators.coreos.com/v1alpha1
      kind: Subscription
      metadata:
        name: servicemeshoperator3
        namespace: openshift-operators
      spec:
        channel: stable
        installPlanApproval: Automatic
        name: servicemeshoperator3
        source: redhat-operators
        sourceNamespace: openshift-marketplace
      EOF
      

      2. Add the foo annotation.

      oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"foo":"bar"}}}}'
      

      3. Verify that the foo annotation is set on the deployment and pod.

      oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e foo
      oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e foo
      

      4. Add the target.workload.openshift.io/management annotation.

      oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"target.workload.openshift.io/management":"{\"effect\": \"PreferredDuringScheduling\"}"}}}}'
      

      5. Verify that the annotation is set on the deployment and pod.

      oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e 'target\.workload'
      oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e 'target\.workload'
      

      6. Add the baz annotation.

      oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"baz":"fooby"}}}}'
      

      7. Verify that the annotation is set on the deployment and pod.

      oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e baz
      oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e baz
      

      Actual results

      Steps 2 and 3 work fine:

      % oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"foo":"bar"}}}}'
      subscription.operators.coreos.com/servicemeshoperator3 patched
      % oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e foo
          foo: bar
              foo: bar
      % oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e foo
            foo: bar
      

      Steps 4 and 5 show that the annotation gets added to the deployment but does not get added to the pod:

      % oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"target.workload.openshift.io/management":"{\"effect\": \"PreferredDuringScheduling\"}"}}}}'
      subscription.operators.coreos.com/servicemeshoperator3 patched
      % oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e 'target\.workload'
          target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
              target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      % oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e 'target\.workload'
      zsh: done       oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o  |
      zsh: exit 1     grep -e 'target\.workload'
      

      Steps 6 and 7 subsequently work fine:

      % oc -n openshift-operators patch subscriptions/servicemeshoperator3 --type=merge --patch='{"spec":{"config":{"annotations":{"baz":"fooby"}}}}'
      subscription.operators.coreos.com/servicemeshoperator3 patched
      % oc -n openshift-operators get deployments/servicemesh-operator3 -o yaml | grep -e baz   
          baz: fooby
              baz: fooby
      % oc -n openshift-operators get pods -l control-plane=servicemesh-operator3 -o yaml | grep -e baz
            baz: fooby
      

      Expected results

      The target.workload.openshift.io/management annotation should be added to the pod by Step 4 and should be observable in Step 5.

      Additional info

      It is worth noting that the annotation value has double-quotes. Perhaps these are causing an issue.

              rh-ee-cchantse Catherine Chan-Tse
              mmasters1@redhat.com Miciah Masters
              None
              None
              Jian Zhang Jian Zhang
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: