Skip to content

✨ Add multi provider #56

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ntnn
Copy link
Contributor

@ntnn ntnn commented Jul 21, 2025

Add the multi provider, allowing to use multiple providers with a single manager without conflicting cluster names.

Pseudo to instantiate:

multiProvider := multi.New(multi.Options{})
mgr := mctrl.NewManager(ctx, multiProvider, mctrl.Options{})
multiProvider.SetManager(mgr) // needed for multi to wrap the mgr when calling startFunc

provider1 := provider1.New(provider1.Options{})
// provider1.Run only expects context and mgr and can be passed as startFunc
if err := multiProvider.AddProvider(ctx, "provider1", provider1.Run}; err != nil {
    return err
}

provider2 := provider2.New(provider2.Options{})
if err := provider2.Setup(...); err != nil {
    return err
}
if err := multiProvider.AddProvider(ctx, "provider2", func(ctx context.Context, mgr mctrl.Manager) error {    
   workers := 2 // or some other options that the provider expects to be passed to .Run
    return provider2.Run(ctx, workers, mgr)
}); err != nil {
    return err
}

mgr.Start(ctx)

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ntnn
Once this PR has been reviewed and has the lgtm label, please assign jeremyot for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from skitt and sttts July 21, 2025 10:53
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 21, 2025
@ntnn ntnn force-pushed the multi-provider branch from 6e9e053 to bf93966 Compare July 21, 2025 11:34
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 21, 2025
@ntnn ntnn marked this pull request as ready for review July 21, 2025 16:48
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2025
@k8s-ci-robot k8s-ci-robot requested review from embik and JeremyOT July 21, 2025 16:48
@ntnn
Copy link
Contributor Author

ntnn commented Jul 21, 2025

Will need squashing but I'll do that after reviews

Copy link
Member

@embik embik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small nits.

@corentone
Copy link

I haven't followed all discussions in the sig sorry, but would it be possible to modify the manager to allow mulitple providers in the first place?

@embik
Copy link
Member

embik commented Aug 16, 2025

I haven't followed all discussions in the sig sorry, but would it be possible to modify the manager to allow mulitple providers in the first place?

I think so, this here would give us a way to experiment and iterate on the design without breaking anything for users of multicluster-runtime not interested in running multiple providers. So I think it might be the more elegant design, helping us explore the versatility of the provider interface further.

@ntnn ntnn force-pushed the multi-provider branch 2 times, most recently from 383dd34 to 2417997 Compare August 18, 2025 07:54
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants