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

ApplicationSets using shared clusterDecisionResource causes all AppSets from generating

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 4.10.z
    • Documentation / GitOps
    • None
    • Moderate
    • None
    • False
    • Hide

      None

      Show
      None

      Description of problem:

      When having ApplicationSet that uses shared clsuterDecisionResource, if a cluster is not found to apply one of them, it will not apply any of the application.
      
      The applicationSet has these.
      
      ~~~
        generators:
        - clusterDecisionResource:
            configMapRef: acm-placement
            labelSelector:
              matchLabels:
                cluster.open-cluster-management.io/placement: cluster-common-dev
            requeueAfterSeconds: 180
            values:
              targetRef: feature-vishaltest
        - clusterDecisionResource:
            configMapRef: acm-placement
            labelSelector:
              matchLabels:
                cluster.open-cluster-management.io/placement: cluster-infra-dev
            requeueAfterSeconds: 180
            values:
              targetRef: develop
      ~~~
      
      What this means is that look for the resource kind defined in configMapRef: acm-placement that has label cluster.open-cluster-management.io/placement: cluster-infra-dev. The resource is PlacementDecision.
      
      When you remove the label cluster-infra=dev from the clustername cluster, the cluster-infra-dev placement cannot make any decision because there is no cluster matching the placement criteria so it removes the PlacementDecision. You can check using oc get placementdecision -n openshift-gitops --show-labels
      
      Since the application set has a reference to a clusterDecisionResource 
      
      ~~~
        - clusterDecisionResource:
            configMapRef: acm-placement
            labelSelector:
              matchLabels:
                cluster.open-cluster-management.io/placement: cluster-infra-dev
      ~~~
      
      which does not exist any more, the application set controller throws this error and cannot re-generate applicaitons.
      time="2022-10-26T17:25:24Z" level=info msg="Kind.Group/Version Reference" kind.apiVersion=placementdecisions.cluster.open-cluster-management.io/v1beta1
      time="2022-10-26T17:25:24Z" level=info msg="selection type" listOptions.LabelSelector="cluster.open-cluster-management.io/placement=cluster-infra-dev"
      time="2022-10-26T17:25:24Z" level=warning msg="no resource found, make sure you clusterDecisionResource is defined correctly"
      time="2022-10-26T17:25:24Z" level=error msg="error generating params" error="no clusterDecisionResources found" generator="&{0xc00005c058 0xc000812280 0xc0012d5e00 openshift-gitops 0xc00089e240}"
      time="2022-10-26T17:25:24Z" level=error msg="error generating application from params" error="no clusterDecisionResources found" generator="{<nil> <nil> <nil> <nil> 0xc000a7e600 <nil> <nil> <nil>}"
      
      In addition, if you change log level to debug you'll see that the generator actually generates the application for one cluster which is in the existing placement decision, but just does not apply it because of the error on the missing placement decision

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

      gitops operator1.5.x and 1.6.1

      How reproducible:

      Always

      Steps to Reproduce:

      1.
      2.
      3.
      

      Actual results:

      No applications generated / applied

      Expected results:

      Application with found target cluster get generated

      Additional info:

       

              rhn-ecs-pkovar Petr Kovar (Inactive)
              rhn-support-ngirard Neil Girard
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: