Skip to content

feat: migrate from golang-commons lifecycle to subroutines#158

Draft
nexus49 wants to merge 4 commits intomainfrom
feat/migrate-subroutines
Draft

feat: migrate from golang-commons lifecycle to subroutines#158
nexus49 wants to merge 4 commits intomainfrom
feat/migrate-subroutines

Conversation

@nexus49
Copy link
Copy Markdown
Contributor

@nexus49 nexus49 commented Mar 4, 2026

Summary

  • Replace golang-commons/controller/lifecycle with standalone github.com/platform-mesh/subroutines package
  • Split monolithic Subroutine interface into composable Processor, Finalizer interfaces — subroutines only implement what they need
  • Migrate all 5 subroutines, both controllers, and all tests to the new API
  • Remove k8s.io replace directives from go.mod (no longer needed)

Breaking Change

Status condition type names changed from {SubroutineName}_Ready{SubroutineName} (e.g. WorkspaceSubroutine_ReadyWorkspaceSubroutine). The aggregate Ready condition is unchanged.

What stays

golang-commons remains for logger, config, context, traces — only the lifecycle/controller orchestration packages are replaced.

Replace the golang-commons controller/lifecycle framework with the new
standalone github.com/platform-mesh/subroutines package which provides
a cleaner, composable API.

Key changes:
- Split Subroutine interface into Processor, Finalizer (compose as needed)
- runtimeobject.RuntimeObject → client.Object (standard controller-runtime)
- errors.OperatorError → plain error
- ctrl.Result → subroutines.Result (OK, OKWithRequeue, Pending, Stop)
- Replace lifecycle builder with lifecycle.New() + manual controller setup
- Replace golang-commons logger with logr via log.FromContext(ctx)
- Replace ratelimiter wrapper with workqueue.NewTypedItemExponentialFailureRateLimiter
- Condition type names: {Name}_Ready → {Name}
- Remove k8s.io replace directives (no longer needed)

Signed-off-by: Bastian Echterhölter <bastian.echterhoelter@sap.com>
On-behalf-of: @SAP <bastian.echterhoelter@sap.com>
nexus49 added 3 commits March 4, 2026 12:02
The new subroutines lifecycle uses log.FromContext(ctx) and doesn't need
explicit logger or CommonServiceConfig parameters.

Signed-off-by: Bastian Echterhölter <bastian.echterhoelter@sap.com>
On-behalf-of: @SAP <bastian.echterhoelter@sap.com>
The subroutines lifecycle now accepts mcreconcile.Request natively,
so remove the manual mccontext.WithCluster / ctrl.Request wrapping
and drop unused imports.

Signed-off-by: Bastian Echterhölter <bastian.echterhoelter@sap.com>
On-behalf-of: @SAP <bastian.echterhoelter@sap.com>
Signed-off-by: Bastian Echterhölter <bastian.echterhoelter@sap.com>
On-behalf-of: @SAP <bastian.echterhoelter@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant