Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add fileSelector to the GitFileGenerator to support label-based file match(https://github.com/argoproj/argo-cd/issues/17673)(Alpha) #21281

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sriteja-Tadakaluru
Copy link

@Sriteja-Tadakaluru Sriteja-Tadakaluru commented Dec 21, 2024

Description:
This is to support more granularity on selecting files over git repositories based on the key-value pairs along with the path. This is similar to how matchLabels or matchExpressions works on kubernetes metadata objects.

Optional Field: fileSelector can be used with matchLabels/matchExpressions.

  • Supports matchLabels

  • Supports matchExpressions:

  • For more operators(IN/EXISTS....etc)
    
  • Note: This is only for the objects(doesn't work for arrays of objects).

Example CR:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: test-fileselector
  namespace: argocd
spec:
  generators:
    - git:
        requeueAfterSeconds: 600
        repoURL: https://github.com/example-test/example.git
        revision: HEAD
        files:
          - path: testing/values-*.yaml   ====> path to the values files
            fileSelector:  =========> labels/expressions used to select files.
              matchLabels:
                clusterName: test-kubernetes
                labels.env: prod
              matchExpressions:
              - key: labels.env
                operator: In
                values:
                - test1
               -  prod
                - prod1
                - prod2
  template:
    metadata:
      namespace: argocd
      name: 'test-{{Name}}'
    spec:
      project: default
      source:
        helm:
          ignoreMissingValueFiles: true
          valueFiles:
            - 'values-{{Name}}.yaml'
        path: testing
        repoURL: https://github.com/example-test/example.git
        targetRevision: HEAD
      destination:
        server: https://kubernetes.default.svc
      syncPolicy:
        automated:
          selfHeal: true

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@Sriteja-Tadakaluru Sriteja-Tadakaluru requested a review from a team as a code owner December 21, 2024 06:49
Copy link

bunnyshell bot commented Dec 21, 2024

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@Sriteja-Tadakaluru Sriteja-Tadakaluru changed the title Add fileSelector to the GitFileGenerator to support label-based file match(https://github.com/argoproj/argo-cd/issues/17673) feat: Add fileSelector to the GitFileGenerator to support label-based file match(https://github.com/argoproj/argo-cd/issues/17673) Dec 21, 2024
Copy link

codecov bot commented Dec 21, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.25%. Comparing base (12a4dab) to head (b57951d).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
applicationset/generators/git.go 77.77% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21281      +/-   ##
==========================================
+ Coverage   53.34%   55.25%   +1.90%     
==========================================
  Files         337      337              
  Lines       57056    57079      +23     
==========================================
+ Hits        30439    31538    +1099     
+ Misses      23974    22851    -1123     
- Partials     2643     2690      +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Sriteja-Tadakaluru Sriteja-Tadakaluru force-pushed the master branch 3 times, most recently from c1e5b65 to 0053d42 Compare December 23, 2024 10:30
@Sriteja-Tadakaluru Sriteja-Tadakaluru changed the title feat: Add fileSelector to the GitFileGenerator to support label-based file match(https://github.com/argoproj/argo-cd/issues/17673) feat: Add fileSelector to the GitFileGenerator to support label-based file match(https://github.com/argoproj/argo-cd/issues/17673)(Alpha) Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant