sandbox: merge address and protocol to one url

Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
Abel Feng
2024-04-23 14:28:01 +08:00
parent c3b306240e
commit de38490ed6
19 changed files with 281 additions and 333 deletions

View File

@@ -123,7 +123,7 @@ func (c *criService) StartContainer(ctx context.Context, r *runtime.StartContain
endpoint := sandbox.Endpoint
if endpoint.IsValid() {
taskOpts = append(taskOpts,
containerd.WithTaskAPIEndpoint(endpoint.Address, endpoint.Protocol, endpoint.Version))
containerd.WithTaskAPIEndpoint(endpoint.Address, endpoint.Version))
}
task, err := container.NewTask(ctx, ioCreation, taskOpts...)

View File

@@ -127,7 +127,6 @@ func (c *criService) recover(ctx context.Context) error {
state = sandboxstore.StateNotReady
}
} else {
endpoint.Protocol = status.Protocol
endpoint.Version = status.Version
endpoint.Address = status.Address
if code, ok := runtime.PodSandboxState_value[status.State]; ok {

View File

@@ -265,11 +265,10 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
return nil, fmt.Errorf("failed to start sandbox %q: %w", id, err)
}
if ctrl.Protocol != "" && ctrl.Address != "" {
if ctrl.Address != "" {
sandbox.Endpoint = sandboxstore.Endpoint{
Protocol: ctrl.Protocol,
Version: ctrl.Version,
Address: ctrl.Address,
Version: ctrl.Version,
Address: ctrl.Address,
}
}

View File

@@ -52,13 +52,12 @@ type Sandbox struct {
}
type Endpoint struct {
Address string
Protocol string
Version uint32
Address string
Version uint32
}
func (e *Endpoint) IsValid() bool {
return e.Protocol != "" && e.Address != ""
return e.Address != ""
}
// NewSandbox creates an internally used sandbox type. This functions reminds