Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Prevent ApplicationSet controller from creating invalid Applications, causing 'unable to delete application resource' in Argo CD #112

Closed
jgwest opened this issue Feb 2, 2021 · 0 comments · Fixed by #136
Assignees
Labels
bug Something isn't working

Comments

@jgwest
Copy link
Member

jgwest commented Feb 2, 2021

While writing a new E2E test, I happened to create an ApplicationSet resource that produced invalid Argo CD applictions:

  • I created the ApplicationSet, and the ApplicationSet controller correctly created the Application.
  • However, the created Application was invalid.
  • Argo CD correctly complained that application destination can't have both name and server defined: in-cluster.

It was correct for Argo CD to complain about this, because I did, in fact, have both a name and a server defined in my ApplicationSet. The ApplicationSet I had defined was producing an invalid Application via the templating process.

The ApplicationSet controller should never create invalid Argo CD Applications (thus leaving it up to Argo CD to deal with that), it should instead detect if an ApplicationSet will produce an invalid Application, and rather than creating the Application it should instead log an error to the console (and, in the future, report a message as a condition within the status field).

This invalid Application also prevented Argo CD from deleting the Application, with this message printed on delete (eg via the finalizer):
Unable to delete application resources: application destination can't have both name and server defined: in-cluster

This was the invalid Application that was produced:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  finalizers:
  - resources-finalizer.argocd.argoproj.io
  name: in-cluster-guestbook
  namespace: argocd-e2e
spec:
  destination:
    name: in-cluster
    namespace: guestbook2
    server: https://kubernetes.default.svc
  project: default
  source:
    path: guestbook
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
1 participant