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

Gitops operator is not accepting regular expression in sourceNamespaces - Application in non-controlplane namespaces

XMLWordPrintable

    • 5
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide
      Before this update, the operator did not correctly accept regular expressions in sourceNamespaces, causing unexpected behavior when matching namespace patterns. This update fixes the issue by updating the operator code to use the new regex option (glob.REGEXP) instead of glob.GLOB when processing getSourceNamespaces. Now, the operator properly evaluates regular expressions in sourceNamespaces as expected.
      Show
      Before this update, the operator did not correctly accept regular expressions in sourceNamespaces, causing unexpected behavior when matching namespace patterns. This update fixes the issue by updating the operator code to use the new regex option (glob.REGEXP) instead of glob.GLOB when processing getSourceNamespaces. Now, the operator properly evaluates regular expressions in sourceNamespaces as expected.
    • Bug Fix
    • Hide

      1. Install openshift-gitops operator

      2. Configure the ArgoCD CR of your user-defined cluster-scoped Argo CD instance with the target namespaces, adding:

        sourceNamespaces:
          - /^test.*test$/        

      3. Create a namespace that math the regular expression like 'testusrtest'

      4. Check the created namespace has the label 'argocd.argoproj.io/managed-by-cluster-argocd=openshift-gitops'

      Show
      1. Install openshift-gitops operator 2. Configure the ArgoCD CR of your user-defined cluster-scoped Argo CD instance with the target namespaces, adding:   sourceNamespaces:     - /^test.*test$/         3. Create a namespace that math the regular expression like 'testusrtest' 4. Check the created namespace has the label 'argocd.argoproj.io/managed-by-cluster-argocd=openshift-gitops'
    • 5
    • GitOps Crimson Sprint 14

      Description of Problem

      The feature request -  RFE-5400 raised for allowing GitOps operator to accept regular expressions in sourceNamespaces is closed now, but the feature is not working.

      It seems the same was implemented in upstream already

       [1]Upstream Doc: https://argo-cd.readthedocs.io/en/stable/operator-manual/app-any-namespace/#change-workload-startup-parameters

      Additional Info

      Followed doc[2] to enable Application resource in non-controlplane namespace in openshift-gitops

      [2]https://docs.redhat.com/en/documentation/red_hat_openshift_gitops/1.14/html/argo_cd_applications/managing-apps-in-non-control-plane-namespaces#gitops-configuring-argo-cd-cr-of-your-user-defined-cluster-scoped-instance-with-target-namespaces_managing-apps-in-non-control-plane-namespaces

      Problem Reproduction

      For example,

      • To match a namespace called `testgiotest`, used the regex  /^test.*test$/
      • The server pod logs stating that the "application namespace patterns enabled", but the namespace is not getting the `argocd.argoproj.io/managed-by-cluster-argocd` label.
      sourceNamespaces:
          - /^test.*test$/
      time="2025-03-27T07:50:04Z" level=info msg="Enabled application namespace patterns: openshift-gitops, /^test.*test$/

      Tried with multiple patterns, but it seems regex is not working as explained in upstream doc[1].

      Reproducibility

      Always

      Prerequisites/Environment

      Openshift-GitOps 1.15.1

      Steps to Reproduce

      • Try a regex expression in sourceNamespace to match a namespace 

      Expected Results

      • The namespace should be labelled with argocd.argoproj.io/managed-by-cluster-argocd` label

      Actual Results

      • The label is not getting added to namespace while using regex

      Problem Analysis

      • <Completed by engineering team as part of the triage/refinement process>

      Root Cause

      • <What is the root cause of the problem? Or, why is it not a bug?>

      Workaround (If Possible)

      • <Are there any workarounds we can provide to the customers?>

      Fix Approaches

      • <If we decide to fix this bug, how will we do it?>

      Acceptance Criteria

      • ...

      Definition of Done

      • Code Complete:
        • All code has been written, reviewed, and approved.
      • Tested:
        • Unit tests have been written and passed.
        • Ensure code coverage is not reduced with the changes.
        • Integration tests have been automated.
        • System tests have been conducted, and all critical bugs have been fixed.
        • Tested and merged on OpenShift either upstream or downstream on a local build.
      • Documentation:
        • User documentation or release notes have been written (if applicable).
      • Build:
        • Code has been successfully built and integrated into the main repository / project.
        • Midstream changes (if applicable) are done, reviewed, approved and merged.
      • Review:
        • Code has been peer-reviewed and meets coding standards.
        • All acceptance criteria defined in the user story have been met.
        • Tested by reviewer on OpenShift.
      • Deployment:
        • The feature has been deployed on OpenShift cluster for testing.

              nmirasch@redhat.com Neus Miras Chueca
              rhn-support-gio Ginilekshmi A O (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: