Skip to content

When using ignoreDiffrences.jqPathExpressions with filtering through IF, ignoring fields doesn't work. #25602

@vovagib

Description

@vovagib

Checklist:

  • [+] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [+] I've included steps to reproduce the bug.
  • [+] I've pasted the output of argocd version.

I'm using ArgoCD v2.6.1. I know it's no longer supported, but my company uses an older version of Kubernetes. Our developers use ArgoRollout to deploy their applications and periodically create issues for us by forgetting about their applications or images. I want to set up ignoring the number of replicas if a specific annotation with a certain value is added to the .metadata.annotations field:

ignoreDifferences:
    - group: "*"
      kind: "*"
      jqPathExpressions:
        - .metadata?.annotations?["custom.argocd.argoproj.io/ignore-spec-replicas"] as $ignoreSpec | if $ignoreSpec == "true" then .spec.replicas else null end

This works with Deployment or StatefulSet entities, but not with Rollout. In the Live Manifest tab, I see that the .spec.replicas field is simply deleted. If I set the annotation value to "false", the field reappears.
If I simply specify .spec.replicas in jqPathExpressions, it works for Rollout.
If I do it like this:

ignoreDifferences:
    - group: "*"
      kind: "*"
      jqPathExpressions:
        - if .kind == "Rollout" then .spec.replicas else null end

this also works and ArgoCD correctly ignores the field I need. But as soon as I add a longer path to the IF statement, everything breaks.

Can you accurately tell me in which version of ArgoCD this bug was fixed? Has anyone else encountered something similar and how can it be fixed?

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/pendingThis issue needs further triage to be correctly classified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions