Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
331 changes: 171 additions & 160 deletions packages/api/internal/api/api.gen.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/api/internal/orchestrator/nodemanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var OrchestratorToApiNodeStateMapper = map[orchestratorinfo.ServiceInfoStatus]ap
orchestratorinfo.ServiceInfoStatus_Healthy: api.NodeStatusReady,
orchestratorinfo.ServiceInfoStatus_Draining: api.NodeStatusDraining,
orchestratorinfo.ServiceInfoStatus_Unhealthy: api.NodeStatusUnhealthy,
orchestratorinfo.ServiceInfoStatus_Standby: api.NodeStatusStandby,
}

func NewClient(tracerProvider trace.TracerProvider, meterProvider metric.MeterProvider, host string) (*clusters.GRPCClient, error) {
Expand Down
1 change: 1 addition & 0 deletions packages/api/internal/orchestrator/nodemanager/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var ApiNodeToOrchestratorStateMapper = map[api.NodeStatus]orchestratorinfo.Servi
api.NodeStatusReady: orchestratorinfo.ServiceInfoStatus_Healthy,
api.NodeStatusDraining: orchestratorinfo.ServiceInfoStatus_Draining,
api.NodeStatusUnhealthy: orchestratorinfo.ServiceInfoStatus_Unhealthy,
api.NodeStatusStandby: orchestratorinfo.ServiceInfoStatus_Standby,
}

func (n *Node) Status() api.NodeStatus {
Expand Down
3 changes: 3 additions & 0 deletions packages/orchestrator/info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ option go_package = "https://github.com/e2b-dev/infra/orchestrator";
// needs to be different from the enumeration in the template manager
enum ServiceInfoStatus {
Healthy = 0;
// Draining means the node is bound to be shut down. It will not accept new sandboxes and will stop once all existing sandboxes are done.
Draining = 1;
Unhealthy = 2;
// Standby means the node is not actively used, but it can return to Healthy and continues serving traffic.
Standby = 3;
}

enum ServiceInfoRole {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (h *Healthcheck) getStatus() e2bHealth.Status {
switch h.info.GetStatus() {
case e2borchestratorinfo.ServiceInfoStatus_Healthy:
return e2bHealth.Healthy
case e2borchestratorinfo.ServiceInfoStatus_Draining:
case e2borchestratorinfo.ServiceInfoStatus_Draining, e2borchestratorinfo.ServiceInfoStatus_Standby:
return e2bHealth.Draining
}

Expand Down
2 changes: 1 addition & 1 deletion packages/orchestrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func run(config cfg.Config) (success bool) {
// Mark service draining if not already.
// If service stats was previously changed via API, we don't want to override it.
logger.L().Info(ctx, "Starting drain phase", zap.Int("sandbox_count", sandboxes.Count()))
if serviceInfo.GetStatus() == orchestratorinfo.ServiceInfoStatus_Healthy {
if status := serviceInfo.GetStatus(); status == orchestratorinfo.ServiceInfoStatus_Healthy || status == orchestratorinfo.ServiceInfoStatus_Standby {
serviceInfo.SetStatus(ctx, orchestratorinfo.ServiceInfoStatus_Draining)

// Wait for draining state to propagate to all consumers
Expand Down
46 changes: 26 additions & 20 deletions packages/shared/pkg/grpc/orchestrator-info/info.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/shared/pkg/http/edge/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions spec/openapi-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ components:
- healthy
- draining
- unhealthy
- standby

ClusterOrchestratorRole:
type: string
Expand Down
7 changes: 6 additions & 1 deletion spec/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,17 +1294,22 @@ components:

NodeStatus:
type: string
description: Status of the node
description: |
Status of the node.
- draining: the node is bound to be shut down. It will not accept new sandboxes and will stop once all existing sandboxes are done.
- standby: the node is not actively used, but it can return to ready and continue serving traffic.
enum:
- ready
- draining
- connecting
- unhealthy
- standby
x-enum-varnames:
- NodeStatusReady
- NodeStatusDraining
- NodeStatusConnecting
- NodeStatusUnhealthy
- NodeStatusStandby

NodeStatusChange:
required:
Expand Down
17 changes: 13 additions & 4 deletions tests/integration/internal/api/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading