Skip to content

Server-Side Diff with RespectIgnoreDifferences can fail diff due to missing required fields #17362

@llavaud

Description

@llavaud

Describe the bug

An application that set an ignoreDifferences on a required field of a manifest spec will fail to diff if both RespectIgnoreDifferences and ServerSideDiff are enabled

To Reproduce

Create an application with the following spec:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    argocd.argoproj.io/compare-options: ServerSideDiff=true
...
spec:
  ignoreDifferences:
    - group: apps
      kind: Deployment
      name: foo
      jqPathExpressions:
        - '.spec.template.spec.containers[] | select(.name == "foo").image'
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    - ApplyOutOfSyncOnly=true
    - RespectIgnoreDifferences=true
    - ServerSideApply=true
    - Validate=false
...

Expected behavior

Diff app without errors

Version

argocd: v2.10.1+a79e0ea
  BuildDate: 2024-02-14T17:37:43Z
  GitCommit: a79e0eaca415461dc36615470cecc25d6d38cefb
  GitTreeState: clean
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64

Logs

Failed to compare desired state to live state: failed to calculate diff: error calculating server side diff: serverSideDiff error: error running server side apply in dryrun mode for resource Deployment/foo: Deployment.apps "foo" is invalid: spec.template.spec.containers[0].image: Required value

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomponent:diffIssue related to diff problems and unexpected errors during difffeature:server-side-diffIssue about the server side diff featureversion:2.13Latest confirmed affected version is 2.13version:3.1Latest confirmed affected version is 3.1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions