crossplane-runtime icon indicating copy to clipboard operation
crossplane-runtime copied to clipboard

ProviderRef should not be of type ObjectReference

Open muvaf opened this issue 5 years ago • 2 comments

What happened?

ProviderReference field that exists in ResourceSpec is of type ObjectReference which has a lot of identifier such as name, namespace, uid, fieldpath etc. In some controllers, we call NamespacedNameOf function which returns an ObjectKey that includes the namespace. This is error-prone since users might add namespace and controller wouldn't be able to locate the object.

Provider objects are cluster-scoped and the type casting happens in managed resource reconciler, meaning its type is hard-coded in the codebase. So, we only need the name of the Provider object. We can have a type in crossplane-runtime like:

type ClusterScopedReference struct {
  APIVersion string `json:"apiVersion,omitempty"
  Kind            string `json:"kind,omitempty"
  Name         string `json:"name"

How can we reproduce it?

Create a managed resource with providerRef that has namespace field populated.

What environment did it happen in?

Crossplane version: 0.5.1

muvaf avatar Dec 19 '19 11:12 muvaf

Related to https://github.com/crossplane/crossplane-runtime/issues/49.

negz avatar Sep 07 '20 21:09 negz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 07:08 stale[bot]

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

github-actions[bot] avatar Sep 05 '24 01:09 github-actions[bot]