crossplane-contrib / provider-argocd

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

Create repository returns PermissionDenied #193

Closed cvegagimenez closed 1 month ago

cvegagimenez commented 1 month ago

What happened?

After upgrading ArgoCD from to 2.12.3 version we get permission denied error when trying to create a new Repository. After verifying against ArgoCD with the ArgoCD CLI we made it to reproduce the same behaviour.

When the repository does not exist, now ArgoCD is returning a permission denied error when trying to get the repository and that error is not controlled in the provider Observe function.

How can we reproduce it?

Try to create a new Repository with the local environment described in the README file and the example in the Marketplace:

apiVersion: repositories.argocd.crossplane.io/v1alpha1
kind: Repository
metadata:
  name: example-project.git
spec:
  forProvider:
    passwordRef:
      key: token
      name: example-project.git
      namespace: crossplane-system
    repo: https://gitlab.com/example-group/example-project.git
    type: git
    username: example-user
  providerConfigRef:
    name: argocd-provider

Result:

Name:         example-scoped-project.git
Namespace:
Labels:       <none>
Annotations:  crossplane.io/external-name: example-scoped-project.git
API Version:  repositories.argocd.crossplane.io/v1alpha1
Kind:         Repository
Metadata:
  Creation Timestamp:  2024-09-18T13:45:36Z
  Generation:          1
  Resource Version:    4509
  UID:                 06021f56-b2d2-4a9a-9cfa-dc0460108515
Spec:
  Deletion Policy:  Delete
  For Provider:
    Password Ref:
      Key:        token
      Name:       example-project.git
      Namespace:  crossplane-system
    Project:      example-project
    Repo:         https://gitlab.com/example-group/example-project-scoped.git
    Type:         git
    Username:     example-user
  Management Policies:
    *
  Provider Config Ref:
    Name:  argocd-provider
Status:
  At Provider:
    Connection State:
  Conditions:
    Last Transition Time:  2024-09-18T13:45:36Z
    Message:               observe failed: rpc error: code = PermissionDenied desc = permission denied
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced
Events:
  Type     Reason                         Age                    From                Message
  ----     ------                         ----                   ----                -------
  Warning  CannotObserveExternalResource  2m5s (x12 over 2m16s)  managed/repository  rpc error: code = PermissionDenied desc = permission denied

What environment did it happen in?

Crossplane Provider argocd version: v0.9.0 ArgoCD version running: v2.12.3

KasnocknDave commented 1 month ago

I have forked the project and am currently working on a fix. I will link the open PR.