Skip to content

feat(devbox): add devbox condition, fix reconcile logic#6511

Merged
lingdie merged 4 commits intolabring:mainfrom
lingdie:devbox-condition
Feb 4, 2026
Merged

feat(devbox): add devbox condition, fix reconcile logic#6511
lingdie merged 4 commits intolabring:mainfrom
lingdie:devbox-condition

Conversation

@lingdie
Copy link
Collaborator

@lingdie lingdie commented Jan 9, 2026

No description provided.

@lingdie lingdie requested a review from a team as a code owner January 9, 2026 10:17
@pull-request-size
Copy link

Whoa! Easy there, Partner!

This PR is too big. Please break it up into smaller PRs.

Copy link
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 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 bxy4543 added this to the v5.2 milestone Feb 4, 2026
@lingdie lingdie merged commit 7bcd0da into labring:main Feb 4, 2026
63 of 79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants