merge fix/cube-k8s-52-55-oe into master
4 file(s) changed+134-53
Mcri-multiplex/pkg/server/mux.go+23-12
| @@ -347,10 +347,11 @@ func (s *MuxServer) PodSandboxStatus(ctx context.Context, req *runtime.PodSandbo | |||
| 347 | 347 | ||
| 348 | func (s *MuxServer) ListPodSandbox(ctx context.Context, req *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error) { | 348 | func (s *MuxServer) ListPodSandbox(ctx context.Context, req *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error) { |
| 349 | var ( | 349 | var ( |
| 350 | - wg sync.WaitGroup | 350 | + wg sync.WaitGroup |
| 351 | - mu sync.Mutex | 351 | + mu sync.Mutex |
| 352 | - allItems []*runtime.PodSandbox | 352 | + allItems []*runtime.PodSandbox |
| 353 | - errs []error | 353 | + errs []error |
| 354 | + succeeded int | ||
| 354 | ) | 355 | ) |
| 355 | 356 | ||
| 356 | for _, mod := range s.reg.Modules() { | 357 | for _, mod := range s.reg.Modules() { |
| @@ -362,6 +363,7 @@ func (s *MuxServer) ListPodSandbox(ctx context.Context, req *runtime.ListPodSand | |||
| 362 | if err != nil { | 363 | if err != nil { |
| 363 | errs = append(errs, fmt.Errorf("%s.ListPodSandbox: %w", e.Type(), err)) | 364 | errs = append(errs, fmt.Errorf("%s.ListPodSandbox: %w", e.Type(), err)) |
| 364 | } else { | 365 | } else { |
| 366 | + succeeded++ | ||
| 365 | allItems = append(allItems, resp.Items...) | 367 | allItems = append(allItems, resp.Items...) |
| 366 | } | 368 | } |
| 367 | mu.Unlock() | 369 | mu.Unlock() |
| @@ -369,7 +371,10 @@ func (s *MuxServer) ListPodSandbox(ctx context.Context, req *runtime.ListPodSand | |||
| 369 | } | 371 | } |
| 370 | 372 | ||
| 371 | wg.Wait() | 373 | wg.Wait() |
| 372 | - if len(errs) > 0 && len(allItems) == 0 { | 374 | + // A successful empty list must not be treated as failure: Cube-only nodes |
| 375 | + // keep e2b registered but unreachable, and kubelet delete/GC filters often | ||
| 376 | + // match nothing (KASandbox #55). | ||
| 377 | + if succeeded == 0 && len(errs) > 0 { | ||
| 373 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) | 378 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) |
| 374 | } | 379 | } |
| 375 | return &runtime.ListPodSandboxResponse{Items: allItems}, nil | 380 | return &runtime.ListPodSandboxResponse{Items: allItems}, nil |
| @@ -381,6 +386,7 @@ func (s *MuxServer) ListContainers(ctx context.Context, req *runtime.ListContain | |||
| 381 | mu sync.Mutex | 386 | mu sync.Mutex |
| 382 | allContainers []*runtime.Container | 387 | allContainers []*runtime.Container |
| 383 | errs []error | 388 | errs []error |
| 389 | + succeeded int | ||
| 384 | ) | 390 | ) |
| 385 | 391 | ||
| 386 | for _, mod := range s.reg.Modules() { | 392 | for _, mod := range s.reg.Modules() { |
| @@ -392,6 +398,7 @@ func (s *MuxServer) ListContainers(ctx context.Context, req *runtime.ListContain | |||
| 392 | if err != nil { | 398 | if err != nil { |
| 393 | errs = append(errs, fmt.Errorf("%s.ListContainers: %w", e.Type(), err)) | 399 | errs = append(errs, fmt.Errorf("%s.ListContainers: %w", e.Type(), err)) |
| 394 | } else { | 400 | } else { |
| 401 | + succeeded++ | ||
| 395 | allContainers = append(allContainers, resp.Containers...) | 402 | allContainers = append(allContainers, resp.Containers...) |
| 396 | } | 403 | } |
| 397 | mu.Unlock() | 404 | mu.Unlock() |
| @@ -399,7 +406,7 @@ func (s *MuxServer) ListContainers(ctx context.Context, req *runtime.ListContain | |||
| 399 | } | 406 | } |
| 400 | 407 | ||
| 401 | wg.Wait() | 408 | wg.Wait() |
| 402 | - if len(errs) > 0 && len(allContainers) == 0 { | 409 | + if succeeded == 0 && len(errs) > 0 { |
| 403 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) | 410 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) |
| 404 | } | 411 | } |
| 405 | return &runtime.ListContainersResponse{Containers: allContainers}, nil | 412 | return &runtime.ListContainersResponse{Containers: allContainers}, nil |
| @@ -415,10 +422,11 @@ func (s *MuxServer) ContainerStats(ctx context.Context, req *runtime.ContainerSt | |||
| 415 | 422 | ||
| 416 | func (s *MuxServer) ListContainerStats(ctx context.Context, req *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error) { | 423 | func (s *MuxServer) ListContainerStats(ctx context.Context, req *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error) { |
| 417 | var ( | 424 | var ( |
| 418 | - wg sync.WaitGroup | 425 | + wg sync.WaitGroup |
| 419 | - mu sync.Mutex | 426 | + mu sync.Mutex |
| 420 | - allStats []*runtime.ContainerStats | 427 | + allStats []*runtime.ContainerStats |
| 421 | - errs []error | 428 | + errs []error |
| 429 | + succeeded int | ||
| 422 | ) | 430 | ) |
| 423 | 431 | ||
| 424 | for _, mod := range s.reg.Modules() { | 432 | for _, mod := range s.reg.Modules() { |
| @@ -430,6 +438,7 @@ func (s *MuxServer) ListContainerStats(ctx context.Context, req *runtime.ListCon | |||
| 430 | if err != nil { | 438 | if err != nil { |
| 431 | errs = append(errs, fmt.Errorf("%s.ListContainerStats: %w", e.Type(), err)) | 439 | errs = append(errs, fmt.Errorf("%s.ListContainerStats: %w", e.Type(), err)) |
| 432 | } else { | 440 | } else { |
| 441 | + succeeded++ | ||
| 433 | allStats = append(allStats, resp.Stats...) | 442 | allStats = append(allStats, resp.Stats...) |
| 434 | } | 443 | } |
| 435 | mu.Unlock() | 444 | mu.Unlock() |
| @@ -437,7 +446,7 @@ func (s *MuxServer) ListContainerStats(ctx context.Context, req *runtime.ListCon | |||
| 437 | } | 446 | } |
| 438 | 447 | ||
| 439 | wg.Wait() | 448 | wg.Wait() |
| 440 | - if len(errs) > 0 && len(allStats) == 0 { | 449 | + if succeeded == 0 && len(errs) > 0 { |
| 441 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) | 450 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) |
| 442 | } | 451 | } |
| 443 | return &runtime.ListContainerStatsResponse{Stats: allStats}, nil | 452 | return &runtime.ListContainerStatsResponse{Stats: allStats}, nil |
| @@ -544,6 +553,7 @@ func (s *MuxServer) ListImages(ctx context.Context, req *runtime.ListImagesReque | |||
| 544 | mu sync.Mutex | 553 | mu sync.Mutex |
| 545 | allImages []*runtime.Image | 554 | allImages []*runtime.Image |
| 546 | errs []error | 555 | errs []error |
| 556 | + succeeded int | ||
| 547 | ) | 557 | ) |
| 548 | 558 | ||
| 549 | for _, mod := range s.reg.Modules() { | 559 | for _, mod := range s.reg.Modules() { |
| @@ -555,6 +565,7 @@ func (s *MuxServer) ListImages(ctx context.Context, req *runtime.ListImagesReque | |||
| 555 | if err != nil { | 565 | if err != nil { |
| 556 | errs = append(errs, fmt.Errorf("%s.ListImages: %w", e.Type(), err)) | 566 | errs = append(errs, fmt.Errorf("%s.ListImages: %w", e.Type(), err)) |
| 557 | } else { | 567 | } else { |
| 568 | + succeeded++ | ||
| 558 | allImages = append(allImages, resp.Images...) | 569 | allImages = append(allImages, resp.Images...) |
| 559 | } | 570 | } |
| 560 | mu.Unlock() | 571 | mu.Unlock() |
| @@ -562,7 +573,7 @@ func (s *MuxServer) ListImages(ctx context.Context, req *runtime.ListImagesReque | |||
| 562 | } | 573 | } |
| 563 | 574 | ||
| 564 | wg.Wait() | 575 | wg.Wait() |
| 565 | - if len(errs) > 0 && len(allImages) == 0 { | 576 | + if succeeded == 0 && len(errs) > 0 { |
| 566 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) | 577 | return nil, fmt.Errorf("all engines failed: %w", errors.Join(errs...)) |
| 567 | } | 578 | } |
| 568 | return &runtime.ListImagesResponse{Images: allImages}, nil | 579 | return &runtime.ListImagesResponse{Images: allImages}, nil |
Mcri-multiplex/pkg/server/mux_test.go+27-0
Mdeploy/k8s-deploy.sh+23-6
Mdocs/zh/cube_user_guide.md+61-35
Comments
Sign in to comment