argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.98k stars 5.47k forks source link

Schema validation of multiple source types #17354

Open verult opened 8 months ago

verult commented 8 months ago

Checklist:

Describe the bug

The validation check to prevent multiple Application source types from being used in a single source seems to not be done at the CRD schema level. Our kubeconform setup, which relies on OpenAPI schema definitions, did not catch the error.

Also, the Application Specification documentation doesn't mention this limitation.

To Reproduce

  1. Check into the Git repo an Application with:
sources:
  - ...
    directory: {}
    kustomize: {}
  1. Sync the application. We get a sync error: ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = error getting app source type: multiple application sources defined: Kustomize,Directory

Expected behavior

A CRD validation tool such as kubeconform should be able to catch the validation error through OpenAPI V3 schema validation (i.e. using oneof) before merging the application change.

Screenshots

Version

Paste the output from `argocd version` here.

The server version is v2.10.0+2175939

Logs

Paste any relevant application logs here.
andrii-korotkov-verkada commented 1 week ago

ArgoCD versions 2.10 and below have reached EOL. Can you upgrade and let us know if the issue is still present, please?