Skip to content

feat: Simulated Provider for running IT - #1129

Open
takoverflow wants to merge 16 commits into
gardener:masterfrom
takoverflow:sim-provider/it
Open

feat: Simulated Provider for running IT#1129
takoverflow wants to merge 16 commits into
gardener:masterfrom
takoverflow:sim-provider/it

Conversation

@takoverflow

Copy link
Copy Markdown
Member

What this PR does / why we need it:
This PR introduces Simulated provider to run IT as part of MCM repo's CI/CD. This can also be used as a mock provider with a virtual (kwok) cluster for testing/simulation purposes.

Which issue(s) this PR fixes:
Fixes part of #1120

Special notes for your reviewer:
Recommend reviewing PR commit-wise for an easy time.

Release note:

Introduce simulation provider to run integration tests for MCM without an actual cluster

@takoverflow
takoverflow requested a review from a team as a code owner July 31, 2026 13:33
@takoverflow takoverflow added kind/enhancement Enhancement, improvement, extension area/testing Testing related labels Jul 31, 2026
@gardener-prow

gardener-prow Bot commented Jul 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Details 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

@gardener-prow gardener-prow Bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 31, 2026
@takoverflow
takoverflow marked this pull request as draft July 31, 2026 19:30
@gardener-prow gardener-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2026
@takoverflow
takoverflow force-pushed the sim-provider/it branch 3 times, most recently from 9d14f82 to a15083d Compare July 31, 2026 20:14
@takoverflow
takoverflow marked this pull request as ready for review July 31, 2026 20:36
@gardener-prow gardener-prow Bot added cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Jul 31, 2026
@gardener-prow gardener-prow Bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. and removed cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. labels Jul 31, 2026
Comment thread pkg/simulatedprovider/cmd/machine-controller/main.go Outdated
Comment thread .ci/test Outdated
Comment thread pkg/simulatedprovider/provider/driver.go Outdated
Comment thread pkg/test/integration/common/framework.go Outdated

@aaronfern aaronfern left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR!
Looks good, I only have a few nits

Comment thread pkg/test/integration/common/framework.go Outdated
Comment thread pkg/simulatedprovider/test/integration/controller/test-mcc.yaml Outdated
Comment thread go.mod Outdated
Comment thread .ci/test Outdated

@r4mek r4mek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR!

Comment thread pkg/simulatedprovider/cluster/cluster.go
Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go Outdated
@takoverflow

Copy link
Copy Markdown
Member Author

Thanks for taking a look
Have addressed your review comments, PTAL @gagan16k @aaronfern @r4mek

@thiyyakat thiyyakat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for adding the simulated provider! ❤️ Just a few comments/questions from me. PTAL.

Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go Outdated
Comment thread pkg/simulatedprovider/provider/node.go
Comment thread pkg/simulatedprovider/provider/node.go
Comment thread pkg/simulatedprovider/cmd/machine-controller/main.go
Comment thread pkg/simulatedprovider/provider/driver.go Outdated
@gardener-prow gardener-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 22, 2026
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
@takoverflow

takoverflow commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

Do you think that will be useful here, given that we are planning to use the simulated provider for reproducing issues and debugging as well? If you feel there are sufficient logs already in the controller, you needn't add any more.

@thiyyakat These logs have some use because it can help trace what happened in the driver call from the time the request was made till it finished. In the simulated provider, we don't have any real activity that's logged/takes time there wouldn't be much value I feel for these, since it can be interpreted from the machine controller logs when these calls are made.

But if you think there's use-case still, I don't have strong feelings, I can add the logs indicating what calls are being made.

@thiyyakat

Copy link
Copy Markdown
Member

In the simulated provider, we don't have any real activity that's logged/takes time there wouldn't be much value I feel for these, since it can be interpreted from the machine controller logs when these calls are made.

Got it. No need to add the logs then.

Comment thread pkg/simulatedprovider/provider/node.go Outdated
@gardener-prow gardener-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2026
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
@thiyyakat

Copy link
Copy Markdown
Member

Thanks for the changes and for addressing my comments!

/lgtm

@gardener-prow gardener-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2026
@gardener-prow

gardener-prow Bot commented Aug 25, 2026

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: c5c86cf0951c614636bc18de78d60eff4a601d8a

@gardener-prow gardener-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2026
@gardener-prow

gardener-prow Bot commented Aug 26, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

Signed-off-by: Prashant Tak <prashant.tak@sap.com>
Comment thread docs/development/integration_tests.md

// DeleteMachine handles a machine deletion request. For the simulated provider, it just
// removes the corresponding node from the managedNodes map.
func (d *DriverImpl) DeleteMachine(_ context.Context, req *driver.DeleteMachineRequest) (resp *driver.DeleteMachineResponse, err error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we call d.client.CoreV1().Nodes().Delete(ctx, req.Machine.Name, metav1.DeleteOptions{})

@takoverflow takoverflow Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Node deletion is handled by the machine deletion flow itself. As part of Driver interface DeleteMachine call, we don't actually delete the node object.

Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
Comment thread pkg/simulatedprovider/provider/driver.go Outdated
Comment thread go.mod Outdated
return
}
node = d.buildNode(req.Machine, req.MachineClass)
_, err = d.client.CoreV1().Nodes().Create(ctx, node, metav1.CreateOptions{})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

VERY MINOR: You can save the node object returned and use it instead of an additional call to get.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But what if the node object is updated before we attempt to change it's status. Wouldn't it cause a conflictError if we then transition it to a Ready node.

Comment thread pkg/simulatedprovider/cluster/cluster.go Outdated
- Add separate go module for simulatedprovider
- Introduce objects representing the MCM crds
- Retry on failure for transitioning node to Ready
- Wait and poll properly for ensuring MCM CRDs are deployed

Signed-off-by: Prashant Tak <prashant.tak@sap.com>
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
Signed-off-by: Prashant Tak <prashant.tak@sap.com>
@gardener-prow gardener-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 4, 2026
@gardener-prow

gardener-prow Bot commented Sep 4, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Testing related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants