Uploaded image for project: 'OpenShift GitOps'
  1. OpenShift GitOps
  2. GITOPS-4708

Placement YAML Label Selector Order Differences not ignored

XMLWordPrintable

    • 5
    • False
    • None
    • False
    • GitOps Crimson - Sprint 3262
    • Moderate

      Description of problem:

      Customer is using RHACM and is managing Policies using OpenShift GitOps. Customer is creating a "PolicyGenerator" object which in turn generates "Placement" objects. These "Placement" objects have multiple label selectors (".spec.predicates[].requiredClusterSelector.labelSelector.matchExpressions[]" field).

      The expectation would be that the order of these label selectors is not a difference. However Argo CD shows a difference: ArgoCD-Placements-Diff.png

      Prerequisites (if any, like setup, operators/versions):

      Red Hat OpenShift GitOps 1.12.2

      Steps to Reproduce

      1. Install cluster with Red Hat OpenShift GitOps 1.12.2
      2. On a cluster with RHACM, create a PolicyGenerator that has multiple label selectors (3 in this case):
      apiVersion: policy.open-cluster-management.io/v1
      kind: PolicyGenerator
      metadata:
        name: cluster-application-policies
      placementBindingDefaults:
        name: binding-policy
      policyDefaults:
        namespace: policies-ca
        remediationAction: inform
        consolidateManifests: false
        copyPolicyMetadata: false
        placement: 
          labelSelector:
            environment: none
      #########
      policySets:
        - name: nonprod-example-onprem
          placement:
            labelSelector:
              name: "test-example-onprem-nonprod"
              purpose: "example"
              cloud: "VSphere"
      1. This will result in the following Placement to be created:
      apiVersion: cluster.open-cluster-management.io/v1beta1
      kind: Placement
      metadata:
      [..]
      spec:
        predicates:
          - requiredClusterSelector:
              labelSelector:
                matchExpressions:
                  - key: cloud
                    operator: In
                    values:
                      - VSphere
                  - key: name
                    operator: In
                    values:
                      - test-example-onprem-nonprod
                  - key: purpose
                    operator: In
                    values:
                      - example

       

      Actual results:

      Every time `kustomize` runs, the order of the label selectors in the generated "Placements" is different. This results in a diff.

      Expected results:

      Argo CD does not have a diff for the order of the label selectors.

      Reproducibility (Always/Intermittent/Only Once):

      Always on customer side

      Additional info (Such as Logs, Screenshots, etc):

              rh-ee-ansingh Anand Singh
              rhn-support-skrenger Simon Krenger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: