use fu wei's suggeted interface pick for marshaling
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
parent
14962dcbd2
commit
d1c1051927
@ -97,22 +97,19 @@ func (in *instrumentedAlphaService) RunPodSandbox(ctx context.Context, r *runtim
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.RunPodSandboxRequest
|
var v1r runtime.RunPodSandboxRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.RunPodSandboxResponse
|
var v1res *runtime.RunPodSandboxResponse
|
||||||
v1res, err = in.c.RunPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.RunPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.RunPodSandboxResponse{}
|
resp := &runtime_alpha.RunPodSandboxResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -121,8 +118,6 @@ func (in *instrumentedAlphaService) RunPodSandbox(ctx context.Context, r *runtim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,22 +150,19 @@ func (in *instrumentedAlphaService) ListPodSandbox(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ListPodSandboxRequest
|
var v1r runtime.ListPodSandboxRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ListPodSandboxResponse
|
var v1res *runtime.ListPodSandboxResponse
|
||||||
v1res, err = in.c.ListPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ListPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ListPodSandboxResponse{}
|
resp := &runtime_alpha.ListPodSandboxResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -179,8 +171,6 @@ func (in *instrumentedAlphaService) ListPodSandbox(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,22 +203,19 @@ func (in *instrumentedAlphaService) PodSandboxStatus(ctx context.Context, r *run
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.PodSandboxStatusRequest
|
var v1r runtime.PodSandboxStatusRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.PodSandboxStatusResponse
|
var v1res *runtime.PodSandboxStatusResponse
|
||||||
v1res, err = in.c.PodSandboxStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.PodSandboxStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.PodSandboxStatusResponse{}
|
resp := &runtime_alpha.PodSandboxStatusResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -237,8 +224,6 @@ func (in *instrumentedAlphaService) PodSandboxStatus(ctx context.Context, r *run
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +243,7 @@ func (in *instrumentedService) StopPodSandbox(ctx context.Context, r *runtime.St
|
|||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in *instrumentedAlphaService) StopPodSandbox(ctx context.Context, r *runtime_alpha.StopPodSandboxRequest) (_ *runtime_alpha.StopPodSandboxResponse, err error) {
|
func (in *instrumentedAlphaService) StopPodSandbox(ctx context.Context, r *runtime_alpha.StopPodSandboxRequest) (res *runtime_alpha.StopPodSandboxResponse, err error) {
|
||||||
if err := in.checkInitialized(); err != nil {
|
if err := in.checkInitialized(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -270,24 +255,20 @@ func (in *instrumentedAlphaService) StopPodSandbox(ctx context.Context, r *runti
|
|||||||
log.G(ctx).Infof("StopPodSandbox for %q returns successfully", r.GetPodSandboxId())
|
log.G(ctx).Infof("StopPodSandbox for %q returns successfully", r.GetPodSandboxId())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var res *runtime_alpha.StopPodSandboxResponse
|
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.StopPodSandboxRequest
|
var v1r runtime.StopPodSandboxRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.StopPodSandboxResponse
|
var v1res *runtime.StopPodSandboxResponse
|
||||||
v1res, err = in.c.StopPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.StopPodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.StopPodSandboxResponse{}
|
resp := &runtime_alpha.StopPodSandboxResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -296,8 +277,6 @@ func (in *instrumentedAlphaService) StopPodSandbox(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +296,7 @@ func (in *instrumentedService) RemovePodSandbox(ctx context.Context, r *runtime.
|
|||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in *instrumentedAlphaService) RemovePodSandbox(ctx context.Context, r *runtime_alpha.RemovePodSandboxRequest) (_ *runtime_alpha.RemovePodSandboxResponse, err error) {
|
func (in *instrumentedAlphaService) RemovePodSandbox(ctx context.Context, r *runtime_alpha.RemovePodSandboxRequest) (res *runtime_alpha.RemovePodSandboxResponse, err error) {
|
||||||
if err := in.checkInitialized(); err != nil {
|
if err := in.checkInitialized(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -329,24 +308,20 @@ func (in *instrumentedAlphaService) RemovePodSandbox(ctx context.Context, r *run
|
|||||||
log.G(ctx).Infof("RemovePodSandbox %q returns successfully", r.GetPodSandboxId())
|
log.G(ctx).Infof("RemovePodSandbox %q returns successfully", r.GetPodSandboxId())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var res *runtime_alpha.RemovePodSandboxResponse
|
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.RemovePodSandboxRequest
|
var v1r runtime.RemovePodSandboxRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.RemovePodSandboxResponse
|
var v1res *runtime.RemovePodSandboxResponse
|
||||||
v1res, err = in.c.RemovePodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.RemovePodSandbox(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.RemovePodSandboxResponse{}
|
resp := &runtime_alpha.RemovePodSandboxResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -355,8 +330,6 @@ func (in *instrumentedAlphaService) RemovePodSandbox(ctx context.Context, r *run
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,22 +362,19 @@ func (in *instrumentedAlphaService) PortForward(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.PortForwardRequest
|
var v1r runtime.PortForwardRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.PortForwardResponse
|
var v1res *runtime.PortForwardResponse
|
||||||
v1res, err = in.c.PortForward(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.PortForward(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.PortForwardResponse{}
|
resp := &runtime_alpha.PortForwardResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -413,8 +383,6 @@ func (in *instrumentedAlphaService) PortForward(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,22 +421,19 @@ func (in *instrumentedAlphaService) CreateContainer(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.CreateContainerRequest
|
var v1r runtime.CreateContainerRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.CreateContainerResponse
|
var v1res *runtime.CreateContainerResponse
|
||||||
v1res, err = in.c.CreateContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.CreateContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.CreateContainerResponse{}
|
resp := &runtime_alpha.CreateContainerResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -478,8 +443,6 @@ func (in *instrumentedAlphaService) CreateContainer(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +462,7 @@ func (in *instrumentedService) StartContainer(ctx context.Context, r *runtime.St
|
|||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in *instrumentedAlphaService) StartContainer(ctx context.Context, r *runtime_alpha.StartContainerRequest) (_ *runtime_alpha.StartContainerResponse, err error) {
|
func (in *instrumentedAlphaService) StartContainer(ctx context.Context, r *runtime_alpha.StartContainerRequest) (res *runtime_alpha.StartContainerResponse, err error) {
|
||||||
if err := in.checkInitialized(); err != nil {
|
if err := in.checkInitialized(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -511,24 +474,20 @@ func (in *instrumentedAlphaService) StartContainer(ctx context.Context, r *runti
|
|||||||
log.G(ctx).Infof("StartContainer for %q returns successfully", r.GetContainerId())
|
log.G(ctx).Infof("StartContainer for %q returns successfully", r.GetContainerId())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var res *runtime_alpha.StartContainerResponse
|
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.StartContainerRequest
|
var v1r runtime.StartContainerRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.StartContainerResponse
|
var v1res *runtime.StartContainerResponse
|
||||||
v1res, err = in.c.StartContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.StartContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.StartContainerResponse{}
|
resp := &runtime_alpha.StartContainerResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -537,8 +496,6 @@ func (in *instrumentedAlphaService) StartContainer(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,22 +530,19 @@ func (in *instrumentedAlphaService) ListContainers(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ListContainersRequest
|
var v1r runtime.ListContainersRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ListContainersResponse
|
var v1res *runtime.ListContainersResponse
|
||||||
v1res, err = in.c.ListContainers(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ListContainers(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ListContainersResponse{}
|
resp := &runtime_alpha.ListContainersResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -597,8 +551,6 @@ func (in *instrumentedAlphaService) ListContainers(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,22 +583,19 @@ func (in *instrumentedAlphaService) ContainerStatus(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ContainerStatusRequest
|
var v1r runtime.ContainerStatusRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ContainerStatusResponse
|
var v1res *runtime.ContainerStatusResponse
|
||||||
v1res, err = in.c.ContainerStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ContainerStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ContainerStatusResponse{}
|
resp := &runtime_alpha.ContainerStatusResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -655,8 +604,6 @@ func (in *instrumentedAlphaService) ContainerStatus(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,22 +636,19 @@ func (in *instrumentedAlphaService) StopContainer(ctx context.Context, r *runtim
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.StopContainerRequest
|
var v1r runtime.StopContainerRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.StopContainerResponse
|
var v1res *runtime.StopContainerResponse
|
||||||
v1res, err = in.c.StopContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.StopContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.StopContainerResponse{}
|
resp := &runtime_alpha.StopContainerResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -713,8 +657,6 @@ func (in *instrumentedAlphaService) StopContainer(ctx context.Context, r *runtim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,22 +689,19 @@ func (in *instrumentedAlphaService) RemoveContainer(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.RemoveContainerRequest
|
var v1r runtime.RemoveContainerRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.RemoveContainerResponse
|
var v1res *runtime.RemoveContainerResponse
|
||||||
v1res, err = in.c.RemoveContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.RemoveContainer(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.RemoveContainerResponse{}
|
resp := &runtime_alpha.RemoveContainerResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -771,8 +710,6 @@ func (in *instrumentedAlphaService) RemoveContainer(ctx context.Context, r *runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,22 +742,19 @@ func (in *instrumentedAlphaService) ExecSync(ctx context.Context, r *runtime_alp
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ExecSyncRequest
|
var v1r runtime.ExecSyncRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ExecSyncResponse
|
var v1res *runtime.ExecSyncResponse
|
||||||
v1res, err = in.c.ExecSync(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ExecSync(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ExecSyncResponse{}
|
resp := &runtime_alpha.ExecSyncResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -829,8 +763,6 @@ func (in *instrumentedAlphaService) ExecSync(ctx context.Context, r *runtime_alp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,22 +797,19 @@ func (in *instrumentedAlphaService) Exec(ctx context.Context, r *runtime_alpha.E
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ExecRequest
|
var v1r runtime.ExecRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ExecResponse
|
var v1res *runtime.ExecResponse
|
||||||
v1res, err = in.c.Exec(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.Exec(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ExecResponse{}
|
resp := &runtime_alpha.ExecResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -889,8 +818,6 @@ func (in *instrumentedAlphaService) Exec(ctx context.Context, r *runtime_alpha.E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,22 +850,19 @@ func (in *instrumentedAlphaService) Attach(ctx context.Context, r *runtime_alpha
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.AttachRequest
|
var v1r runtime.AttachRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.AttachResponse
|
var v1res *runtime.AttachResponse
|
||||||
v1res, err = in.c.Attach(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.Attach(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.AttachResponse{}
|
resp := &runtime_alpha.AttachResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -947,8 +871,6 @@ func (in *instrumentedAlphaService) Attach(ctx context.Context, r *runtime_alpha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,22 +903,19 @@ func (in *instrumentedAlphaService) UpdateContainerResources(ctx context.Context
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.UpdateContainerResourcesRequest
|
var v1r runtime.UpdateContainerResourcesRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.UpdateContainerResourcesResponse
|
var v1res *runtime.UpdateContainerResourcesResponse
|
||||||
v1res, err = in.c.UpdateContainerResources(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.UpdateContainerResources(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.UpdateContainerResourcesResponse{}
|
resp := &runtime_alpha.UpdateContainerResourcesResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1005,8 +924,6 @@ func (in *instrumentedAlphaService) UpdateContainerResources(ctx context.Context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1041,22 +958,19 @@ func (in *instrumentedAlphaService) PullImage(ctx context.Context, r *runtime_al
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.PullImageRequest
|
var v1r runtime.PullImageRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.PullImageResponse
|
var v1res *runtime.PullImageResponse
|
||||||
v1res, err = in.c.PullImage(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.PullImage(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.PullImageResponse{}
|
resp := &runtime_alpha.PullImageResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1065,8 +979,6 @@ func (in *instrumentedAlphaService) PullImage(ctx context.Context, r *runtime_al
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,22 +1013,19 @@ func (in *instrumentedAlphaService) ListImages(ctx context.Context, r *runtime_a
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ListImagesRequest
|
var v1r runtime.ListImagesRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ListImagesResponse
|
var v1res *runtime.ListImagesResponse
|
||||||
v1res, err = in.c.ListImages(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ListImages(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ListImagesResponse{}
|
resp := &runtime_alpha.ListImagesResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1125,8 +1034,6 @@ func (in *instrumentedAlphaService) ListImages(ctx context.Context, r *runtime_a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,22 +1068,19 @@ func (in *instrumentedAlphaService) ImageStatus(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ImageStatusRequest
|
var v1r runtime.ImageStatusRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ImageStatusResponse
|
var v1res *runtime.ImageStatusResponse
|
||||||
v1res, err = in.c.ImageStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ImageStatus(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ImageStatusResponse{}
|
resp := &runtime_alpha.ImageStatusResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1185,8 +1089,6 @@ func (in *instrumentedAlphaService) ImageStatus(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,7 +1108,7 @@ func (in *instrumentedService) RemoveImage(ctx context.Context, r *runtime.Remov
|
|||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in *instrumentedAlphaService) RemoveImage(ctx context.Context, r *runtime_alpha.RemoveImageRequest) (_ *runtime_alpha.RemoveImageResponse, err error) {
|
func (in *instrumentedAlphaService) RemoveImage(ctx context.Context, r *runtime_alpha.RemoveImageRequest) (res *runtime_alpha.RemoveImageResponse, err error) {
|
||||||
if err := in.checkInitialized(); err != nil {
|
if err := in.checkInitialized(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1218,24 +1120,20 @@ func (in *instrumentedAlphaService) RemoveImage(ctx context.Context, r *runtime_
|
|||||||
log.G(ctx).Infof("RemoveImage %q returns successfully", r.GetImage().GetImage())
|
log.G(ctx).Infof("RemoveImage %q returns successfully", r.GetImage().GetImage())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var res *runtime_alpha.RemoveImageResponse
|
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.RemoveImageRequest
|
var v1r runtime.RemoveImageRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.RemoveImageResponse
|
var v1res *runtime.RemoveImageResponse
|
||||||
v1res, err = in.c.RemoveImage(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.RemoveImage(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.RemoveImageResponse{}
|
resp := &runtime_alpha.RemoveImageResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1244,8 +1142,6 @@ func (in *instrumentedAlphaService) RemoveImage(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1278,22 +1174,19 @@ func (in *instrumentedAlphaService) ImageFsInfo(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ImageFsInfoRequest
|
var v1r runtime.ImageFsInfoRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ImageFsInfoResponse
|
var v1res *runtime.ImageFsInfoResponse
|
||||||
v1res, err = in.c.ImageFsInfo(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ImageFsInfo(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ImageFsInfoResponse{}
|
resp := &runtime_alpha.ImageFsInfoResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1302,8 +1195,6 @@ func (in *instrumentedAlphaService) ImageFsInfo(ctx context.Context, r *runtime_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1336,22 +1227,19 @@ func (in *instrumentedAlphaService) ContainerStats(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ContainerStatsRequest
|
var v1r runtime.ContainerStatsRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ContainerStatsResponse
|
var v1res *runtime.ContainerStatsResponse
|
||||||
v1res, err = in.c.ContainerStats(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ContainerStats(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ContainerStatsResponse{}
|
resp := &runtime_alpha.ContainerStatsResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1360,8 +1248,6 @@ func (in *instrumentedAlphaService) ContainerStats(ctx context.Context, r *runti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,22 +1280,19 @@ func (in *instrumentedAlphaService) ListContainerStats(ctx context.Context, r *r
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.ListContainerStatsRequest
|
var v1r runtime.ListContainerStatsRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.ListContainerStatsResponse
|
var v1res *runtime.ListContainerStatsResponse
|
||||||
v1res, err = in.c.ListContainerStats(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.ListContainerStats(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.ListContainerStatsResponse{}
|
resp := &runtime_alpha.ListContainerStatsResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1418,8 +1301,6 @@ func (in *instrumentedAlphaService) ListContainerStats(ctx context.Context, r *r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,22 +1333,19 @@ func (in *instrumentedAlphaService) Status(ctx context.Context, r *runtime_alpha
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.StatusRequest
|
var v1r runtime.StatusRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.StatusResponse
|
var v1res *runtime.StatusResponse
|
||||||
v1res, err = in.c.Status(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.Status(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.StatusResponse{}
|
resp := &runtime_alpha.StatusResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1476,8 +1354,6 @@ func (in *instrumentedAlphaService) Status(ctx context.Context, r *runtime_alpha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1542,22 +1418,19 @@ func (in *instrumentedAlphaService) UpdateRuntimeConfig(ctx context.Context, r *
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// converts request and response for earlier CRI version to call and get response from the current version
|
// converts request and response for earlier CRI version to call and get response from the current version
|
||||||
p, err := r.Marshal()
|
|
||||||
if err == nil {
|
|
||||||
var v1r runtime.UpdateRuntimeConfigRequest
|
var v1r runtime.UpdateRuntimeConfigRequest
|
||||||
if err = v1r.Unmarshal(p); err == nil {
|
if err := alphaReqToV1Req(r, &v1r); err != nil {
|
||||||
|
return nil, errdefs.ToGRPC(err)
|
||||||
|
}
|
||||||
var v1res *runtime.UpdateRuntimeConfigResponse
|
var v1res *runtime.UpdateRuntimeConfigResponse
|
||||||
v1res, err = in.c.UpdateRuntimeConfig(ctrdutil.WithNamespace(ctx), &v1r)
|
v1res, err = in.c.UpdateRuntimeConfig(ctrdutil.WithNamespace(ctx), &v1r)
|
||||||
if v1res != nil {
|
if v1res != nil {
|
||||||
p, perr := v1res.Marshal()
|
|
||||||
if perr == nil {
|
|
||||||
resp := &runtime_alpha.UpdateRuntimeConfigResponse{}
|
resp := &runtime_alpha.UpdateRuntimeConfigResponse{}
|
||||||
if perr = resp.Unmarshal(p); perr == nil {
|
perr := v1RespToAlphaResp(v1res, resp)
|
||||||
|
if perr == nil {
|
||||||
res = resp
|
res = resp
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
// actual error has precidence on error returned vs parse error issues
|
// actual error has precidence on error returned vs parse error issues
|
||||||
if perr != nil {
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = perr
|
err = perr
|
||||||
} else {
|
} else {
|
||||||
@ -1566,8 +1439,6 @@ func (in *instrumentedAlphaService) UpdateRuntimeConfig(ctx context.Context, r *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,3 +1499,33 @@ func (in *instrumentedAlphaService) ReopenContainerLog(ctx context.Context, r *r
|
|||||||
}
|
}
|
||||||
return res, errdefs.ToGRPC(err)
|
return res, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func alphaReqToV1Req(
|
||||||
|
alphar interface{ Marshal() ([]byte, error) },
|
||||||
|
v1r interface{ Unmarshal(_ []byte) error },
|
||||||
|
) error {
|
||||||
|
p, err := alphar.Marshal()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = v1r.Unmarshal(p); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func v1RespToAlphaResp(
|
||||||
|
v1res interface{ Marshal() ([]byte, error) },
|
||||||
|
alphares interface{ Unmarshal(_ []byte) error },
|
||||||
|
) error {
|
||||||
|
p, err := v1res.Marshal()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = alphares.Unmarshal(p); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user