The Workspace Manager Bridge API defines the gRPC interfaces for the Workspace Manager Bridge service, which enables dynamic management of workspace clusters within the Gitpod platform. This API allows for the registration, updating, and deregistration of workspace clusters, facilitating multi-cluster deployments and cluster lifecycle management.
This API provides a standardized interface for:
- Registering new workspace clusters
- Updating properties of existing workspace clusters
- Deregistering workspace clusters
- Listing currently registered workspace clusters
- Managing admission constraints for workspace clusters
- Controlling cluster state (available, cordoned, draining)
The Workspace Manager Bridge API is implemented as a gRPC service defined in Protocol Buffer files. These definitions are used to generate client and server code in Go and TypeScript for use by the workspace manager bridge and other components in the system.
Provides methods for managing workspace clusters:
Register
: Registers a new workspace clusterUpdate
: Modifies properties of an already registered workspace clusterDeregister
: Removes a workspace cluster from available clustersList
: Returns the currently registered workspace clusters
Represents the current status of a workspace cluster:
- Name and URL
- State (UNKNOWN, AVAILABLE, CORDONED, DRAINING)
- Score and maximum score
- Admission constraints
- Region information
- Whether the cluster is static or governed
Contains TLS configuration for secure communication with a cluster:
- CA certificate
- Client certificate
- Client key
Provides hints for cluster registration:
- Preferability (None, Prefer, DontSchedule)
- Cordoned status
Defines constraints for workspace admission to a cluster:
- Feature preview constraints
- Permission-based constraints
- The API uses gRPC for efficient, typed communication
- Requests include cluster names to identify the relevant cluster
- Updates can be applied to specific properties of a cluster
- Deregistration can be forced even if instances are still running
- Used by the server component for cluster management
- Used by the ws-manager-bridge to communicate with workspace managers
- Integrated with Kubernetes for cluster management
- Cluster management systems use this API to register new workspace clusters
- Load balancing systems use this API to update cluster scores
- Administrative tools use this API to cordon or drain clusters
- Monitoring systems use this API to list available clusters
The API uses Protocol Buffers version 3 (proto3) syntax, which provides forward and backward compatibility features. The service is designed to allow for the addition of new cluster management features without breaking existing clients.
The Workspace Manager Bridge API uses Protocol Buffers and gRPC for defining interfaces. When changes are made to the .proto
files, the corresponding code in Go and TypeScript needs to be regenerated.
To regenerate the code:
-
Navigate to the ws-manager-bridge-api directory:
cd components/ws-manager-bridge-api
-
Run the generate script:
./generate.sh
This script performs the following actions:
- Installs necessary dependencies (protoc plugins)
- Generates code using buf based on the configuration in
buf.gen.yaml
- Updates license headers
The generate.sh
script uses functions from the shared script at scripts/protoc-generator.sh
:
install_dependencies
: Installs required protoc pluginsprotoc_buf_generate
: Generates code using buf based on the configuration inbuf.gen.yaml
update_license
: Updates license headers in generated files
The buf.gen.yaml
file configures the code generation:
- Generates Go code with appropriate module paths
- Generates JavaScript and TypeScript code with gRPC support
After regenerating the code, you may need to rebuild components that depend on the Workspace Manager Bridge API. This typically involves:
-
For Go components:
cd <component-directory> go build ./...
-
For TypeScript components:
cd <component-directory> yarn install yarn build
-
Using Leeway (for CI/CD):
leeway build -D components/<component-name>:app
The Workspace Manager Bridge API is primarily used by the ws-manager-bridge component, which bridges between workspace managers and the rest of the platform. It plays a critical role in multi-cluster deployments by enabling dynamic management of workspace clusters, facilitating load balancing, and providing a unified interface for cluster operations.