memory-bank/components/ws-manager-bridge.md
The Workspace Manager Bridge (ws-manager-bridge) is a critical component in the Gitpod architecture that acts as an intermediary between the workspace manager (ws-manager) and the rest of the Gitpod platform. It subscribes to workspace status updates from the workspace manager, processes these updates, and synchronizes the information with the database and other components of the system.
The primary purposes of the Workspace Manager Bridge component are:
The Workspace Manager Bridge consists of several key components:
The component is designed to be resilient to failures, with mechanisms for reconnection, message queuing, and error handling.
src/main.ts: Entry point for the applicationsrc/bridge.ts: Core implementation of the workspace manager bridgesrc/bridge-controller.ts: Controls bridges to workspace clusterssrc/workspace-instance-controller.ts: Controls workspace instancessrc/prebuild-updater.ts: Updates prebuild informationsrc/cluster-service-server.ts: gRPC service for cluster managementsrc/wsman-subscriber.ts: Subscribes to workspace manager eventssrc/metrics.ts: Metrics collection and reportingsrc/config.ts: Configuration for the componentsrc/container-module.ts: Dependency injection setupThe Workspace Manager Bridge follows this general workflow:
Initialization:
Status Update Handling:
Workspace Instance Control:
Workspace Class Management:
The bridge processes workspace status updates from the workspace manager and maps them to the Gitpod data model:
@gitpod/gitpod-db: Database access@gitpod/gitpod-protocol: Shared protocol definitions@gitpod/ws-manager: Workspace manager client@gitpod/ws-manager-bridge-api: Bridge API definitions@gitpod/ws-daemon: Workspace daemon clientThe Workspace Manager Bridge integrates with:
The Workspace Manager Bridge is configured through environment variables:
CONTROLLER_INTERVAL_SECONDS: Interval for controller operationsCONTROLLER_MAX_DISCONNECT_SECONDS: Maximum time to wait for reconnectionThe component exposes various metrics:
The Workspace Manager Bridge is typically used to: