feat(devbox): add devbox condition, fix reconcile logic#6511
Merged
lingdie merged 4 commits intolabring:mainfrom Feb 4, 2026
Merged
feat(devbox): add devbox condition, fix reconcile logic#6511lingdie merged 4 commits intolabring:mainfrom
lingdie merged 4 commits intolabring:mainfrom
Conversation
Whoa! Easy there, Partner!This PR is too big. Please break it up into smaller PRs. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a significant refactoring of the devbox controller to add Kubernetes-style conditions for better observability and to fix reconcile logic issues. The changes split a monolithic reconcile function into a structured pipeline pattern with clear separation of concerns.
Changes:
- Added Kubernetes conditions to DevboxStatus for tracking state transitions, commit workflows, and resource sync status
- Refactored the main reconcile loop into distinct phases: deletion handling, finalizer management, status initialization, scheduling, resource synchronization, state change events, and condition updates
- Extracted pod/network/secret/configmap sync logic into a new pipeline-based file (devbox_sync_pipeline.go) with structured steps and error handling
- Moved scheduling logic into a separate file (devbox_schedule.go) for better code organization
- Added duplicate prevention for storage cleanup operations using a deleteMap sync.Map
- Updated retry backoff for storage cleanup from 3 steps × 2s to 30 steps × 10s
- Fixed RBAC role configuration by removing duplicate verbs declaration
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| controllers/devbox/api/v1alpha2/conditions.go | New file defining condition types, reasons, and helper methods for managing devbox conditions |
| controllers/devbox/api/v1alpha2/devbox_types.go | Added ObservedGeneration and Conditions fields to DevboxStatus |
| controllers/devbox/config/crd/bases/devbox.sealos.io_devboxes.yaml | CRD updated with conditions array and observedGeneration field definitions |
| controllers/devbox/config/rbac/role.yaml | Cleaned up duplicate verbs declaration in RBAC configuration |
| controllers/devbox/internal/controller/devbox_controller.go | Major refactoring: split reconcile logic into phases, added condition sync, improved scheduling and state transition handling |
| controllers/devbox/internal/controller/devbox_sync_pipeline.go | New file implementing structured pipeline for resource synchronization with proper error handling and conditions |
| controllers/devbox/internal/controller/devbox_schedule.go | New file containing scheduling logic extracted from main controller |
| controllers/devbox/internal/controller/event_handler.go | Added condition updates for state changes and commit workflows, added deleteMap for duplicate prevention, increased retry backoff |
bxy4543
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.