-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to extend provider-alibaba #63
Comments
ping @negz @hasheddan |
I'm afraid I don't quite follow how @lowkeyrd would use these I wonder if instead it would it be possible to define a regular |
@negz I have updated examples based on the original feature description. As for
Could you please take a look at again whether I have made it clear this time. Thanks. |
Hi @zzxwill, thanks for your reply. As far as I can tell from what you've proposed here, everything that @lowkeyrd needs to do should be possible without needing to add the |
@negz Your solution works. But there might be some drawbacks on code mergeing:
This is why we need the
Here is a brainstorm: |
Or is there a mechanism which can support something like
|
We just had a quick call to discuss our options. I'm hopeful that it will be possible to solve this problem while also maintaining typical patterns in the provider. I'm thinking the internal Alibaba provider, which is a superset of the OSS Alibaba provider, could do something like this: type InternalAlibabaConnector struct {
kube: client.Client
}
func (c *InternalAlibabaConnector) Connect(ctx context.Context, mg resource.Managed) (managed.ExternalClient, error) {
ossConnector := alibabaoss.Connector{client: c.kube}
// Create the regular OSS ExternalClient
ossClient, err := ossConnector.Connect(ctx, mg)
// Return the special internal Alibaba ExternalClient that wraps the OSS ExternalClient.
return &InternalAlibabaClient{oss: ossClient}, err
}
// The special, internal Alibaba provider.
type InternalAlibabaClient struct {
// This implementation wraps the regular OSS ExternalClient implementation.
oss managed.ExternalClient
}
func (e *InternalAlibabaClient) Observe(ctx context.Context, mg resource.Managed) (managed.ExternalObservation, error) {
// Special, internal Alibaba logic can be implemented here before the OSS Observe method is called.
// Call the OSS Observe method.
observation, err := e.oss.Observe(ctx, mg)
// Special, internal Alibaba logic can be implemented here, after the OSS Observe method was called.
// This could include modifying the returned observation.
return observation, err
} |
Great question. There is actually. Take a look at https://crossplane.io/docs/v1.1/concepts/composition.html - a Crossplane "Composite Resource (XR)" is very similar to a Terraform module. Maybe you could build only the functionality you need internally at Alibaba as a completely separate provider, then make composite resources that mixed OSS managed resources with your internal managed resources? |
Thanks, @negz @ryanzhang-oss . The solution has been applied to the project in the internal team. |
What problem are you facing?
@lowkeyrd , from Alibaba internal team, would like to extend
crossplane/provider-alibaba
in his own codebase and make some customizations on api structures, controller setup, PublishConnection and so on.Forking this community provider is not an option as it will take into so many troubles of merging future new releases.
Here are some examples on how the integration would take place.
1. custom Setup of managed resource controller
For example, in OSS managed resource controller,
SetupBucket
is as below. There is only onemanaged.ReconcilerOption
.In internal provider, there are two more
managed.ReconcilerOption
, one of which is to setup account initialization related reconciler option, the other is formanaged.WithConnectionPublishers
.2. custom PublishConnection
OSS managed resource doesn't need
PublishConnection
.The internal custom provider needed
PublishConnection
.3. same
Observe
,Create
,Update
,Delete
logicsBoth in crossplane/provider-alibaba, and internal provier-alibaba, in a managed resource controller, functions
Observe
,Create
,Update
,Delete
are the same.How could Crossplane help solve your problem?
Whether it's possible, in the aspect of Crossplane Runtime, to support more friendly extension.
For example, like supporting not copying
Observe
,Create
,Update
andDelete
functions. If the runtime found they are missing, it will redirect to call theBasexxx
one in the same managed resource controller.Please let me know if I didn't have this feature understood. Thanks.
The text was updated successfully, but these errors were encountered: