loft-sh / vcluster-sdk

Provides a toolset to create custom vcluster syncers
Apache License 2.0
25 stars 19 forks source link

seems like resource x is not available in the physical cluster or vcluster has no access to it #13

Closed mhaddon closed 2 years ago

mhaddon commented 2 years ago

I am a bit confused by this error, though I am sure the answer is simple.

I have made a syncer which allows the syncing of an ArgoCD Application.

The error is: "panic: init syncer application: seems like resource argoproj.io/v1, Kind=Application is not available in the physical cluster or vcluster has no access to it"

I have the ArgoCD Application CRD installed on the host machine, and the plugin config looks like this:

      plugin:
        argocd-sync:
          image: x
          imagePullPolicy: "IfNotPresent"
          rbac:
            role:
              extraRules:
                - apiGroups:
                    - "argoproj.io"
                  resources:
                    - "applications"
                  verbs:
                    - "create"
                    - "delete"
                    - "patch"
                    - "update"
                    - "get"
                    - "list"
                    - "watch"
            clusterRole:
              extraRules:
                - apiGroups:
                    - "apiextensions.k8s.io"
                  resources:
                    - "customresourcedefinitions"
                  verbs:
                    - "get"
                    - "list"
                    - "watch"
      rbac:
        clusterRole:
          create: true

Since I am using a different target namespace, I also have a custom role, for the host to access that namespace:

- apiGroups:
  - argoproj.io
  resources:
  - applications
  verbs:
  - create
  - delete
  - patch
  - update
  - get
  - list
  - watch

Am I missing something or is this error implying something else?

mhaddon commented 2 years ago

I am an idiot, it is v1alpha1 not v1. I had to change the groupversion_info.go