Skip to content

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 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 <[email protected]>
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.

/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 28, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: dece1b69a1dbb93d625916c988c1a4ecd2bda7ff

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik, ntnn

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

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 28, 2025
@k8s-ci-robot k8s-ci-robot merged commit 690bf28 into kubernetes-sigs:main Aug 28, 2025
18 checks passed
@ntnn ntnn mentioned this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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