crossplane-runtime
crossplane-runtime copied to clipboard
Have ExternalConnector accept a smaller interface than resource.Managed
What problem are you facing?
The Generic Managed Resource Reconciler (GMRR) deals primarily with the resource.Managed interface, which is fairly large. Ideally it would use smaller interfaces, where possible.
type ExternalConnecter interface {
Connect(ctx context.Context, mg Managed) (ExternalClient, error)
}
The Connect method above is one place we could easily use a smaller interface. All current Connect implementations don't actually use any of the methods of resource.Managed; they simply assert the resource.Managed to the concrete managed resource type they expect, get the provider it references and its secret, and return a client.
How could Crossplane help solve your problem?
func (f *Foo) GetProviderReference() *corev1.ObjectReference { return f.Spec.ProviderReference }
func (f *Foo) SetProviderReference(r *corev1.ObjectReference) { f.Spec.ProviderReference = r }
type ProviderReferencer interface {
GetProviderReference() *corev1.ObjectReference
SetProviderReference(r *corev1.ObjectReference)
}
type ExternalConnecter interface {
Connect(ctx context.Context, pr ProviderReferencer) (ExternalClient, error)
}
Adding the above getters and setters to all managed resources would allow us to update the Connect methods to accept the above, much smaller interface.
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.
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.