Skip to content

Split controllers into dedicated packages, remove Ginkgo#85

Merged
kcp-ci-bot merged 3 commits intokcp-dev:mainfrom
xrstf:split-controllers
Aug 26, 2025
Merged

Split controllers into dedicated packages, remove Ginkgo#85
kcp-ci-bot merged 3 commits intokcp-dev:mainfrom
xrstf:split-controllers

Conversation

@xrstf
Copy link
Copy Markdown
Contributor

@xrstf xrstf commented Aug 25, 2025

Summary

I am working on at least 2 new controllers and we have reached the point where too many controllers share the same package. So I moved every controller into its own sub directory.

But this made the tests explode, because they are written to assume global private variables and a single test suite. Instead of painfully refactoring them, I painfully refactored them, but into simple, shorter, regular Go tests. I also replaced the usage of envtest with ctrl-runtime's fake client.

Due to the missing envtest, Deployments will not progress and so will not have their status fields defaulted when using fake clients. This has unearthed that the status handling in the operator was broken, regardless of envtest or fakeclient. Not only did it assume that an error when getting the deployment status is not severe (it is, if that part errors there is no Available condition and the code further down in the switch statement panics), but it would also not apply the Deleting phase ever as long as a Deployment exists. So I reworked the status handling a bit and also made it compatible with static backends (like fakeclient or kcp).

I also replaced gomega with require, which we use in kcp already and more importantly, is nice to use without the need for a dot import. Dot import bad.

What Type of PR Is This?

/kind cleanup

Release Notes

Remove Ginkgo from unit tests, use fakeclient instead of envtest.

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 25, 2025
On-behalf-of: @SAP christoph.mewes@sap.com
@xrstf xrstf changed the title WIP - Split controllers into dedicated packages, remove Ginkgo Split controllers into dedicated packages, remove Ginkgo Aug 25, 2025
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 25, 2025
@xrstf
Copy link
Copy Markdown
Contributor Author

xrstf commented Aug 25, 2025

/retest

Copy link
Copy Markdown
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

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2025
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 57452b3077731f29ab069d47b1bb55106ea21cc5

@kcp-ci-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik

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

The pull request process is described 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

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2025
@kcp-ci-bot kcp-ci-bot merged commit 25bf91e into kcp-dev:main Aug 26, 2025
10 checks passed
@xrstf xrstf deleted the split-controllers branch September 3, 2025 08:21
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. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

3 participants