Skip to content

chore(role-instance): implement roleInstance and roleInstanceSet as reconcile version - #191

Merged
cheyang merged 3 commits into
sgl-project:mainfrom
Syspretor:chore/implement-roleinstanceset-as-storageversion
Mar 11, 2026
Merged

cheyang merged 3 commits into
sgl-project:mainfrom
Syspretor:chore/implement-roleinstanceset-as-storageversion

Conversation

@Syspretor

Copy link
Copy Markdown
Collaborator

…econcile version

Ⅰ. Motivation

Ⅱ. Modifications

Ⅲ. Does this pull request fix one issue?

fixes #XXXX

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Syspretor
Syspretor force-pushed the chore/implement-roleinstanceset-as-storageversion branch from ceb3d76 to da536d1 Compare March 11, 2026 02:51
@RongGu
RongGu requested a review from Copilot March 11, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the workload controllers/reconcilers from the legacy Instance/InstanceSet (workloads/v1alpha1) APIs to the reconcile implementations for RoleInstance/RoleInstanceSet (workloads/v1alpha2), including stateless/stateful modes and supporting in-place update utilities.

Changes:

  • Replace controller wiring to use RoleInstance and RoleInstanceSet reconcilers (and remove Instance/InstanceSet controllers).
  • Port RoleInstanceSet stateless/stateful reconcile logic to v1alpha2 types, including new stateless event handler and ref manager.
  • Update in-place lifecycle/readiness/specified-delete/in-place-update utilities (and related tests) to operate on v1alpha2 RoleInstance.

Reviewed changes

Copilot reviewed 49 out of 52 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/envtest/testutil/setup.go Envtest wiring updated to use RoleInstance / RoleInstanceSet controllers.
pkg/reconciler/roleinstanceset/statelessmode/utils/utils.go Switch stateless RoleInstanceSet utils to v1alpha2 + constants labels.
pkg/reconciler/roleinstanceset/statelessmode/utils/sorter.go Update sorter interfaces/types to v1alpha2 RoleInstance.
pkg/reconciler/roleinstanceset/statelessmode/utils/ref_manager.go New generic ref manager for adopting/releasing owned objects.
pkg/reconciler/roleinstanceset/statelessmode/sync/update.go Port update logic to RoleInstanceSet/RoleInstance v1alpha2 APIs.
pkg/reconciler/roleinstanceset/statelessmode/sync/scale.go Port scale logic to RoleInstanceSet/RoleInstance v1alpha2 APIs + constants.
pkg/reconciler/roleinstanceset/statelessmode/sync/helper.go Port helper logic/expectation diffs to v1alpha2 naming/fields.
pkg/reconciler/roleinstanceset/statelessmode/sync/api.go Update sync interface to v1alpha2 RoleInstanceSet/RoleInstance.
pkg/reconciler/roleinstanceset/statelessmode/status.go Update status updater to v1alpha2 RoleInstanceSet status/types.
pkg/reconciler/roleinstanceset/statelessmode/revision/revision.go Update controller revision patching to v1alpha2 templates/codec.
pkg/reconciler/roleinstanceset/statelessmode/reconciler.go Port reconciler to fetch/reconcile v1alpha2 RoleInstanceSet.
pkg/reconciler/roleinstanceset/statelessmode/event_handler.go New RoleInstance event handler for stateless RoleInstanceSet expectations.
pkg/reconciler/roleinstanceset/statelessmode/core/implement.go Core control updated for RoleInstanceSet templates/labels/spec injection.
pkg/reconciler/roleinstanceset/statelessmode/core/api.go New v1alpha2 RoleInstanceSet core control interface.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_utils.go Update stateful helpers to v1alpha2 RoleInstance/RoleInstanceSet.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_status_updater.go Update stateful status updater to v1alpha2 listers/types.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_helper.go Update revision helpers/status calculations to v1alpha2 types.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_controller.go Update informer/lister/controllerKind to v1alpha2 RoleInstanceSet/RoleInstance.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_control.go Update stateful control interfaces and status types to v1alpha2.
pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_control.go Update instance object manager to v1alpha2 RoleInstance listers/types.
pkg/reconciler/roleinstanceset/statefulmode/instance_ref_manager.go Update controller-ref manager and instance ops to v1alpha2 RoleInstance.
pkg/reconciler/roleinstance/utils/instance_utils.go New utils module for roleinstance reconcile flow.
pkg/reconciler/roleinstance/sync/instance_update.go Update imports to roleinstance core/utils packages.
pkg/reconciler/roleinstance/sync/instance_scale.go Update imports to roleinstance core/utils packages.
pkg/reconciler/roleinstance/sync/api.go Update imports to roleinstance lifecycle/inplaceupdate packages.
pkg/reconciler/roleinstance/revision/instance_revision.go Update imports to roleinstance core/utils packages.
pkg/reconciler/roleinstance/lifecycle/lifecycle_utils.go New lifecycle helper for updating pod readiness keys.
pkg/reconciler/roleinstance/instance_status.go Rename package to roleinstance and update internal imports.
pkg/reconciler/roleinstance/instance_reconciler.go Rename package to roleinstance and update internal imports.
pkg/reconciler/roleinstance/instance_event_handler.go Rename package to roleinstance and update internal imports.
pkg/reconciler/roleinstance/inplaceupdate/inplaceupdate.go Update import to roleinstance utils.
pkg/reconciler/roleinstance/core/instance_core.go Update import to roleinstance utils.
pkg/reconciler/instanceset/statelessmode/event_handler.go Remove legacy InstanceSet stateless event handler (v1alpha1).
pkg/reconciler/instanceset/statelessmode/core/api.go Remove legacy InstanceSet stateless core API (v1alpha1).
pkg/inplace/instance/specifieddelete/specified_delete.go Switch specified-delete label + patch helper to RoleInstance v1alpha2 + constants.
pkg/inplace/instance/readiness/instance_readiness_utils_test.go Update readiness tests to v1alpha2 RoleInstance types.
pkg/inplace/instance/readiness/instance_readiness_utils.go Port readiness utilities to v1alpha2 RoleInstance and adapter methods.
pkg/inplace/instance/readiness/instance_readiness.go Port readiness interface to v1alpha2 RoleInstance.
pkg/inplace/instance/lifecycle/lifecycle_utils.go Port lifecycle utilities to v1alpha2 RoleInstance lifecycle keys/types.
pkg/inplace/instance/instance_util_test.go Update instance util tests to v1alpha2 RoleInstance + constants labels.
pkg/inplace/instance/instance_util.go Rename/update helpers to RoleInstance variants and constants label keys.
pkg/inplace/instance/inplaceupdate/inplace_update_test.go Port in-place update tests to v1alpha2 RoleInstance and new option names.
pkg/inplace/instance/inplaceupdate/inplace_update_defaults_test.go Port defaults tests to v1alpha2 template/layout and new option names.
pkg/inplace/instance/inplaceupdate/inplace_update_defaults.go Port defaults implementation to v1alpha2 RoleInstance + new option names.
pkg/inplace/instance/inplaceupdate/inplace_update.go Port main in-place update implementation to v1alpha2 RoleInstance and adapters.
pkg/inplace/instance/clientdapter/adapter.go Rename adapter methods to RoleInstance variants and v1alpha2 types.
pkg/constants/label.go Add RoleInstance label keys and component label aliases.
internal/controller/workloads/roleinstanceset_controller.go New controller that dispatches RoleInstanceSet reconcile by pattern (stateful/stateless).
internal/controller/workloads/roleinstance_controller.go New RoleInstance controller registration.
internal/controller/workloads/instanceset_controller.go Remove legacy InstanceSet controller registration.
internal/controller/workloads/instance_controller.go Remove legacy Instance controller registration.
cmd/rbgs/main.go Wire manager startup to RoleInstance/RoleInstanceSet controllers instead of Instance/InstanceSet.
Comments suppressed due to low confidence (1)

pkg/reconciler/roleinstance/instance_reconciler.go:31

  • This reconciler package was renamed to roleinstance, but it still imports and reconciles the v1alpha1.Instance API. With the new internal/controller/workloads/roleinstance_controller.go registering a controller for v1alpha2.RoleInstance, this will result in a GVK mismatch (client.Get will query workloads/v1alpha1, Kind=Instance instead of workloads/v1alpha2, Kind=RoleInstance). Update the roleinstance reconciler (and its dependent core/sync/revision/status code) to use v1alpha2.RoleInstance types (and Kind="RoleInstance"), or keep the controller registration on v1alpha1 consistently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/workloads/roleinstance_controller.go
@Syspretor
Syspretor force-pushed the chore/implement-roleinstanceset-as-storageversion branch from da536d1 to 0623b12 Compare March 11, 2026 03:34
Comment thread internal/controller/workloads/roleinstance_controller.go Outdated
Comment thread pkg/constants/label.go Outdated
@Syspretor
Syspretor force-pushed the chore/implement-roleinstanceset-as-storageversion branch from 0623b12 to 057b62d Compare March 11, 2026 06:10

@cheyang cheyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm
/approve

@cheyang
cheyang merged commit 0393388 into sgl-project:main Mar 11, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants