crossplane-contrib / provider-argocd

Crossplane provider to provision and manage Argo CD objects
Apache License 2.0
68 stars 35 forks source link

"Application" cannot reference "Cluster" #115

Closed MariusGrandeAndersen closed 8 months ago

MariusGrandeAndersen commented 9 months ago

What happened?

Using argocd provider v0.4.0, having an existing Cluster that is Ready True Synced True. I add an application like this

apiVersion: applications.argocd.crossplane.io/v1alpha1
kind: Application
metadata:
  name: argocd-application-security
spec:
  forProvider:
    destination:
      namespace: argocd
      #   server: https://aks.hcp.westeurope.azmk8s.io:443
      #   serverRef:
      #     name: argocd-cluster-cilium
      serverSelector:
        matchLabels:
          security: "true"
...

In the example above, using either serverSelector or serverRef, it gives error

Events:
  Type     Reason                        Age               From                 Message
  ----     ------                        ----              ----                 -------
  Warning  CannotCreateExternalResource  5s (x12 over 9s)  managed/application  cannot create Argocd application: rpc error: code = InvalidArgument desc = application spec for argocd-application-security is invalid: InvalidSpecError: Unable to get cluster: rpc error: code = NotFound desc = cluster "argocd-cluster-cilium" not found

Using server: https://aks.hcp.westeurope.azmk8s.io:443 works fine.

Cluster is defined like this

apiVersion: cluster.argocd.crossplane.io/v1alpha1
kind: Cluster
metadata:
  name: argocd-cluster-cilium
  labels:
    security: "true"
spec:
  forProvider:
    config:
      kubeconfigSecretRef:
        namespace: crossplane-system
        name: cilium-connectiondetails-write
        key: kubeconfig
    name: argocd-cluster-cilium
  providerConfigRef:
    name: argocd-provider
maximilianbraun commented 8 months ago

Hey @MariusGrandeAndersen,

thanks for reporting. I just checked and could reproduce the issue. I'll check if I can provide a fix with #122.