mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
kubelet/remote: update cri to protobuf v3
This commit is contained in:
parent
8e4ea2dd15
commit
76afc7300d
@ -71,7 +71,7 @@ func (r *RemoteImageService) ImageStatus(image *runtimeapi.ImageSpec) (*runtimea
|
|||||||
Image: image,
|
Image: image,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("ImageStatus %q from image service failed: %v", image.GetImage(), err)
|
glog.Errorf("ImageStatus %q from image service failed: %v", image.Image, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ func (r *RemoteImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtim
|
|||||||
Auth: auth,
|
Auth: auth,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("PullImage %q from image service failed: %v", image.GetImage(), err)
|
glog.Errorf("PullImage %q from image service failed: %v", image.Image, err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.GetImageRef(), nil
|
return resp.ImageRef, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveImage removes the image.
|
// RemoveImage removes the image.
|
||||||
@ -104,7 +104,7 @@ func (r *RemoteImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
|
|||||||
Image: image,
|
Image: image,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("RemoveImage %q from image service failed: %v", image.GetImage(), err)
|
glog.Errorf("RemoveImage %q from image service failed: %v", image.Image, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ func (r *RemoteRuntimeService) Version(apiVersion string) (*runtimeapi.VersionRe
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
typedVersion, err := r.runtimeClient.Version(ctx, &runtimeapi.VersionRequest{
|
typedVersion, err := r.runtimeClient.Version(ctx, &runtimeapi.VersionRequest{
|
||||||
Version: &apiVersion,
|
Version: apiVersion,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Version from runtime service failed: %v", err)
|
glog.Errorf("Version from runtime service failed: %v", err)
|
||||||
@ -79,7 +79,7 @@ func (r *RemoteRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.GetPodSandboxId(), nil
|
return resp.PodSandboxId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
||||||
@ -89,7 +89,7 @@ func (r *RemoteRuntimeService) StopPodSandbox(podSandBoxID string) error {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.StopPodSandbox(ctx, &runtimeapi.StopPodSandboxRequest{
|
_, err := r.runtimeClient.StopPodSandbox(ctx, &runtimeapi.StopPodSandboxRequest{
|
||||||
PodSandboxId: &podSandBoxID,
|
PodSandboxId: podSandBoxID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("StopPodSandbox %q from runtime service failed: %v", podSandBoxID, err)
|
glog.Errorf("StopPodSandbox %q from runtime service failed: %v", podSandBoxID, err)
|
||||||
@ -106,7 +106,7 @@ func (r *RemoteRuntimeService) RemovePodSandbox(podSandBoxID string) error {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.RemovePodSandbox(ctx, &runtimeapi.RemovePodSandboxRequest{
|
_, err := r.runtimeClient.RemovePodSandbox(ctx, &runtimeapi.RemovePodSandboxRequest{
|
||||||
PodSandboxId: &podSandBoxID,
|
PodSandboxId: podSandBoxID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("RemovePodSandbox %q from runtime service failed: %v", podSandBoxID, err)
|
glog.Errorf("RemovePodSandbox %q from runtime service failed: %v", podSandBoxID, err)
|
||||||
@ -122,7 +122,7 @@ func (r *RemoteRuntimeService) PodSandboxStatus(podSandBoxID string) (*runtimeap
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
resp, err := r.runtimeClient.PodSandboxStatus(ctx, &runtimeapi.PodSandboxStatusRequest{
|
resp, err := r.runtimeClient.PodSandboxStatus(ctx, &runtimeapi.PodSandboxStatusRequest{
|
||||||
PodSandboxId: &podSandBoxID,
|
PodSandboxId: podSandBoxID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("PodSandboxStatus %q from runtime service failed: %v", podSandBoxID, err)
|
glog.Errorf("PodSandboxStatus %q from runtime service failed: %v", podSandBoxID, err)
|
||||||
@ -154,7 +154,7 @@ func (r *RemoteRuntimeService) CreateContainer(podSandBoxID string, config *runt
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
resp, err := r.runtimeClient.CreateContainer(ctx, &runtimeapi.CreateContainerRequest{
|
resp, err := r.runtimeClient.CreateContainer(ctx, &runtimeapi.CreateContainerRequest{
|
||||||
PodSandboxId: &podSandBoxID,
|
PodSandboxId: podSandBoxID,
|
||||||
Config: config,
|
Config: config,
|
||||||
SandboxConfig: sandboxConfig,
|
SandboxConfig: sandboxConfig,
|
||||||
})
|
})
|
||||||
@ -163,7 +163,7 @@ func (r *RemoteRuntimeService) CreateContainer(podSandBoxID string, config *runt
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.GetContainerId(), nil
|
return resp.ContainerId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartContainer starts the container.
|
// StartContainer starts the container.
|
||||||
@ -172,7 +172,7 @@ func (r *RemoteRuntimeService) StartContainer(containerID string) error {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.StartContainer(ctx, &runtimeapi.StartContainerRequest{
|
_, err := r.runtimeClient.StartContainer(ctx, &runtimeapi.StartContainerRequest{
|
||||||
ContainerId: &containerID,
|
ContainerId: containerID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("StartContainer %q from runtime service failed: %v", containerID, err)
|
glog.Errorf("StartContainer %q from runtime service failed: %v", containerID, err)
|
||||||
@ -188,8 +188,8 @@ func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64)
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
||||||
ContainerId: &containerID,
|
ContainerId: containerID,
|
||||||
Timeout: &timeout,
|
Timeout: timeout,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("StopContainer %q from runtime service failed: %v", containerID, err)
|
glog.Errorf("StopContainer %q from runtime service failed: %v", containerID, err)
|
||||||
@ -206,7 +206,7 @@ func (r *RemoteRuntimeService) RemoveContainer(containerID string) error {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.RemoveContainer(ctx, &runtimeapi.RemoveContainerRequest{
|
_, err := r.runtimeClient.RemoveContainer(ctx, &runtimeapi.RemoveContainerRequest{
|
||||||
ContainerId: &containerID,
|
ContainerId: containerID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("RemoveContainer %q from runtime service failed: %v", containerID, err)
|
glog.Errorf("RemoveContainer %q from runtime service failed: %v", containerID, err)
|
||||||
@ -238,7 +238,7 @@ func (r *RemoteRuntimeService) ContainerStatus(containerID string) (*runtimeapi.
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
resp, err := r.runtimeClient.ContainerStatus(ctx, &runtimeapi.ContainerStatusRequest{
|
resp, err := r.runtimeClient.ContainerStatus(ctx, &runtimeapi.ContainerStatusRequest{
|
||||||
ContainerId: &containerID,
|
ContainerId: containerID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("ContainerStatus %q from runtime service failed: %v", containerID, err)
|
glog.Errorf("ContainerStatus %q from runtime service failed: %v", containerID, err)
|
||||||
@ -256,9 +256,9 @@ func (r *RemoteRuntimeService) ExecSync(containerID string, cmd []string, timeou
|
|||||||
|
|
||||||
timeoutSeconds := int64(timeout.Seconds())
|
timeoutSeconds := int64(timeout.Seconds())
|
||||||
req := &runtimeapi.ExecSyncRequest{
|
req := &runtimeapi.ExecSyncRequest{
|
||||||
ContainerId: &containerID,
|
ContainerId: containerID,
|
||||||
Cmd: cmd,
|
Cmd: cmd,
|
||||||
Timeout: &timeoutSeconds,
|
Timeout: timeoutSeconds,
|
||||||
}
|
}
|
||||||
resp, err := r.runtimeClient.ExecSync(ctx, req)
|
resp, err := r.runtimeClient.ExecSync(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -267,14 +267,14 @@ func (r *RemoteRuntimeService) ExecSync(containerID string, cmd []string, timeou
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = nil
|
err = nil
|
||||||
if resp.GetExitCode() != 0 {
|
if resp.ExitCode != 0 {
|
||||||
err = utilexec.CodeExitError{
|
err = utilexec.CodeExitError{
|
||||||
Err: fmt.Errorf("command '%s' exited with %d: %s", strings.Join(cmd, " "), resp.GetExitCode(), resp.GetStderr()),
|
Err: fmt.Errorf("command '%s' exited with %d: %s", strings.Join(cmd, " "), resp.ExitCode, resp.Stderr),
|
||||||
Code: int(resp.GetExitCode()),
|
Code: int(resp.ExitCode),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.GetStdout(), resp.GetStderr(), err
|
return resp.Stdout, resp.Stderr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
|
// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
|
||||||
@ -284,7 +284,7 @@ func (r *RemoteRuntimeService) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.Ex
|
|||||||
|
|
||||||
resp, err := r.runtimeClient.Exec(ctx, req)
|
resp, err := r.runtimeClient.Exec(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Exec %s '%s' from runtime service failed: %v", req.GetContainerId(), strings.Join(req.GetCmd(), " "), err)
|
glog.Errorf("Exec %s '%s' from runtime service failed: %v", req.ContainerId, strings.Join(req.Cmd, " "), err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ func (r *RemoteRuntimeService) Attach(req *runtimeapi.AttachRequest) (*runtimeap
|
|||||||
|
|
||||||
resp, err := r.runtimeClient.Attach(ctx, req)
|
resp, err := r.runtimeClient.Attach(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Attach %s from runtime service failed: %v", req.GetContainerId(), err)
|
glog.Errorf("Attach %s from runtime service failed: %v", req.ContainerId, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ func (r *RemoteRuntimeService) PortForward(req *runtimeapi.PortForwardRequest) (
|
|||||||
|
|
||||||
resp, err := r.runtimeClient.PortForward(ctx, req)
|
resp, err := r.runtimeClient.PortForward(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("PortForward %s from runtime service failed: %v", req.GetPodSandboxId(), err)
|
glog.Errorf("PortForward %s from runtime service failed: %v", req.PodSandboxId, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user