Skip to content

feat: add instance controller#66

Merged
cheyang merged 1 commit intosgl-project:mainfrom
yangsoon:feat/add-instance-controller
Oct 28, 2025
Merged

feat: add instance controller#66
cheyang merged 1 commit intosgl-project:mainfrom
yangsoon:feat/add-instance-controller

Conversation

@yangsoon
Copy link
Copy Markdown
Contributor

@yangsoon yangsoon commented Oct 22, 2025

Ⅰ. Motivation

This PR implements the inplace update capability for the Instance (as shown in the diagram below).

instanceset-arch

Ⅱ. Modifications

  • Add a new Instance controller.
  • This controller provides the first step towards inplace update, enabling inplace update for pods managed by the same Instance .

Ⅲ. Does this pull request fix one issue?

fixes #64 & #65

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

Ⅴ. Describe how to verify it

you can refer to doc/feature/instance.md for more usage.

VI. Special notes for reviews

Checklist

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

@cheyang cheyang requested a review from gujingit October 22, 2025 12:34
@BSWANG BSWANG requested a review from Copilot October 22, 2025 12:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 implements an Instance controller to enable inplace update capability for pods managed by the same Instance. The controller provides the foundational step toward achieving inplace updates, as part of addressing issue #64.

Key changes:

  • Introduces a new Instance controller with reconciliation logic for managing instances and their owned pods
  • Adds revision control mechanisms for tracking instance configuration changes
  • Reorganizes import paths from pkg/utils/inplace/* to pkg/inplace/* for better code structure

Reviewed Changes

Copilot reviewed 19 out of 153 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/utils/fieldindex/register.go Adds field indexing for pod owner references to support efficient pod lookups
pkg/reconciler/instance/utils/instance_utils.go Provides utility functions for pod management, selector creation, and revision handling
pkg/reconciler/instance/revision/instance_revision.go Implements revision control for tracking instance configuration changes
pkg/reconciler/instance/instance_reconciler.go Core reconciler implementation for Instance resources
pkg/reconciler/instance/instance_event_handler.go Handles pod lifecycle events and maps them to instance reconciliation requests
pkg/reconciler/instance/core/instance_core.go Contains core logic for pod creation, revision management, and update operations
internal/controller/workloads/instance_controller.go Controller setup and CRD existence checks for Instance resources
pkg/inplace/pod/pod_util.go Adds Instance-specific readiness gate injection and updates import paths
pkg/inplace/pod/inplaceupdate/inplace_update.go Updates import paths for inplace update utilities
pkg/inplace/instance/readiness/instance_readiness_utils.go Updates import paths for instance readiness utilities
pkg/inplace/instance/inplaceupdate/inplace_update.go Updates import paths for instance inplace update logic
go.mod Adds dependencies for kruise and kubernetes packages
cmd/rbgs/main.go Integrates Instance controller into the main manager
api/workloads/v1alpha1/instance_types.go Corrects API documentation comment
api/workloads/v1alpha1/constant.go Adds new Instance-specific label constants and renames InstanceSet labels

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/utils/fieldindex/register.go Outdated
Comment thread pkg/reconciler/instance/instance_reconciler.go Outdated
Comment thread pkg/reconciler/instance/instance_reconciler.go Outdated
Comment thread pkg/inplace/pod/inplaceupdate/inplace_update.go Outdated
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch from cdbdbba to 1cc4f2b Compare October 24, 2025 09:43
@RongGu RongGu requested a review from Copilot October 27, 2025 02:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 29 out of 165 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

api/workloads/v1alpha1/constant.go:1

  • The comment has a grammatical issue: "when Instance Ready" should be "when the Instance is ready" for proper grammar.
package v1alpha1

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

Comment thread pkg/reconciler/instance/sync/instance_update.go Outdated
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch 3 times, most recently from a9c2958 to a29a0e1 Compare October 27, 2025 12:03
@yangsoon yangsoon changed the title [WIP] feat: add instance controller feat: add instance controller Oct 27, 2025
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch 2 times, most recently from d8dac47 to 74b10dd Compare October 27, 2025 12:33
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread pkg/inplace/instance/inplaceupdate/inplace_update.go Outdated
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch from 74b10dd to 14f3b91 Compare October 27, 2025 13:49
@RongGu RongGu requested a review from Copilot October 27, 2025 16:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 34 out of 169 changed files in this pull request and generated 2 comments.


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

Comment thread doc/features/instance.md Outdated
Comment thread doc/features/instance.md Outdated
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch 2 times, most recently from 9b01702 to 8dc7300 Compare October 28, 2025 01:56
@RongGu RongGu requested a review from Copilot October 28, 2025 02:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 34 out of 169 changed files in this pull request and generated 3 comments.


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

Comment thread pkg/reconciler/instance/inplaceupdate/inplaceupdate.go Outdated
Comment thread pkg/reconciler/instance/instance_status.go
Comment thread pkg/reconciler/instance/lifecycle/lifecycle_utils.go Outdated
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch 2 times, most recently from ffeb81a to a331f27 Compare October 28, 2025 03:27
@yangsoon yangsoon force-pushed the feat/add-instance-controller branch from a331f27 to c40e10f Compare October 28, 2025 03:47
@yangsoon yangsoon requested review from Syspretor and Copilot October 28, 2025 03:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 34 out of 169 changed files in this pull request and generated no new comments.


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

@yangsoon
Copy link
Copy Markdown
Contributor Author

@cheyang @Syspretor @gujingit PTAL

@yangsoon yangsoon mentioned this pull request Oct 28, 2025
5 tasks
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

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 e7dfee0 into sgl-project:main Oct 28, 2025
3 checks passed
@yangsoon yangsoon deleted the feat/add-instance-controller branch October 28, 2025 07:52
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.

[Feature] Support inplace update with InstanceSet

5 participants