sandbox: store endpoint in cri sandboxStore
Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
@@ -185,8 +185,9 @@ type ShimInstance interface {
|
||||
Client() any
|
||||
// Delete will close the client and remove bundle from disk.
|
||||
Delete(ctx context.Context) error
|
||||
// Version returns shim's features compatibility version.
|
||||
Version() int
|
||||
// Endpoint returns shim's endpoint information,
|
||||
// including address, protocol and version.
|
||||
Endpoint() (string, string, int)
|
||||
}
|
||||
|
||||
func parseStartResponse(response []byte) (client.BootstrapParams, error) {
|
||||
@@ -359,9 +360,11 @@ func (gc *grpcConn) UserOnCloseWait(ctx context.Context) error {
|
||||
}
|
||||
|
||||
type shim struct {
|
||||
bundle *Bundle
|
||||
client any
|
||||
version int
|
||||
bundle *Bundle
|
||||
client any
|
||||
address string
|
||||
protocol string
|
||||
version int
|
||||
}
|
||||
|
||||
var _ ShimInstance = (*shim)(nil)
|
||||
@@ -371,8 +374,8 @@ func (s *shim) ID() string {
|
||||
return s.bundle.ID
|
||||
}
|
||||
|
||||
func (s *shim) Version() int {
|
||||
return s.version
|
||||
func (s *shim) Endpoint() (string, string, int) {
|
||||
return s.address, s.protocol, s.version
|
||||
}
|
||||
|
||||
func (s *shim) Namespace() string {
|
||||
@@ -440,7 +443,8 @@ type shimTask struct {
|
||||
}
|
||||
|
||||
func newShimTask(shim ShimInstance) (*shimTask, error) {
|
||||
taskClient, err := NewTaskClient(shim.Client(), shim.Version())
|
||||
_, _, version := shim.Endpoint()
|
||||
taskClient, err := NewTaskClient(shim.Client(), version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@ type ControllerInstance struct {
|
||||
SandboxID string
|
||||
Pid uint32
|
||||
CreatedAt time.Time
|
||||
Address string
|
||||
Protocol string
|
||||
Version uint32
|
||||
Labels map[string]string
|
||||
}
|
||||
|
||||
@@ -133,4 +136,7 @@ type ControllerStatus struct {
|
||||
CreatedAt time.Time
|
||||
ExitedAt time.Time
|
||||
Extra typeurl.Any
|
||||
Address string
|
||||
Protocol string
|
||||
Version uint32
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ func (s *remoteSandboxController) Start(ctx context.Context, sandboxID string) (
|
||||
Pid: resp.GetPid(),
|
||||
CreatedAt: resp.GetCreatedAt().AsTime(),
|
||||
Labels: resp.GetLabels(),
|
||||
Address: resp.GetAddress(),
|
||||
Protocol: resp.GetProtocol(),
|
||||
Version: resp.GetVersion(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -141,6 +144,9 @@ func (s *remoteSandboxController) Status(ctx context.Context, sandboxID string,
|
||||
CreatedAt: resp.GetCreatedAt().AsTime(),
|
||||
ExitedAt: resp.GetExitedAt().AsTime(),
|
||||
Extra: resp.GetExtra(),
|
||||
Address: resp.GetAddress(),
|
||||
Protocol: resp.GetProtocol(),
|
||||
Version: resp.GetVersion(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user