mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
update cri-api runtime interface and cri-client add new method
This commit is contained in:
parent
8f11574f3d
commit
b27c303ac2
@ -82,6 +82,12 @@ type PodSandboxManager interface {
|
||||
ListPodSandbox(ctx context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
|
||||
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
||||
PortForward(ctx context.Context, request *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
|
||||
// UpdatePodSandboxResources synchronously updates the PodSandboxConfig with
|
||||
// the pod-level resource configuration. This method is called _after_ the
|
||||
// Kubelet reconfigures the pod-level cgroups.
|
||||
// This request is treated as best effort, and failure will not block the
|
||||
// Kubelet with proceeding with a resize.
|
||||
UpdatePodSandboxResources(ctx context.Context, request *runtimeapi.UpdatePodSandboxResourcesRequest) (*runtimeapi.UpdatePodSandboxResourcesResponse, error)
|
||||
}
|
||||
|
||||
// ContainerStatsManager contains methods for retrieving the container
|
||||
|
@ -794,3 +794,16 @@ func (r *FakeRuntimeService) RuntimeConfig(_ context.Context) (*runtimeapi.Runti
|
||||
|
||||
return &runtimeapi.RuntimeConfigResponse{Linux: r.FakeLinuxConfiguration}, nil
|
||||
}
|
||||
|
||||
// UpdatePodSandboxResources returns the container resource in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) UpdatePodSandboxResources(context.Context, *runtimeapi.UpdatePodSandboxResourcesRequest) (*runtimeapi.UpdatePodSandboxResourcesResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
r.Called = append(r.Called, "UpdatePodSandboxResources")
|
||||
if err := r.popError("UpdatePodSandboxResources"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &runtimeapi.UpdatePodSandboxResourcesResponse{}, nil
|
||||
}
|
||||
|
@ -366,3 +366,8 @@ func (f *RemoteRuntime) RuntimeConfig(ctx context.Context, req *kubeapi.RuntimeC
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdatePodSandboxResources synchronously updates the PodSandboxConfig.
|
||||
func (f *RemoteRuntime) UpdatePodSandboxResources(ctx context.Context, req *kubeapi.UpdatePodSandboxResourcesRequest) (*kubeapi.UpdatePodSandboxResourcesResponse, error) {
|
||||
return f.RuntimeService.UpdatePodSandboxResources(ctx, req)
|
||||
}
|
||||
|
@ -610,6 +610,23 @@ func (r *remoteRuntimeService) portForwardV1(ctx context.Context, req *runtimeap
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdatePodSandboxResources synchronously updates the PodSandboxConfig with
|
||||
// the pod-level resource configuration.
|
||||
func (r *remoteRuntimeService) UpdatePodSandboxResources(ctx context.Context, req *runtimeapi.UpdatePodSandboxResourcesRequest) (*runtimeapi.UpdatePodSandboxResourcesResponse, error) {
|
||||
r.log(10, "[RemoteRuntimeService] UpdatePodSandboxResources", "PodSandboxId", req.PodSandboxId, "timeout", r.timeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, r.timeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := r.runtimeClient.UpdatePodSandboxResources(ctx, req)
|
||||
if err != nil {
|
||||
r.logErr(err, "UpdatePodSandboxResources from runtime service failed", "podSandboxID", req.PodSandboxId)
|
||||
return nil, err
|
||||
}
|
||||
r.log(10, "[RemoteRuntimeService] UpdatePodSandboxResources Response", "podSandboxID", req.PodSandboxId)
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateRuntimeConfig updates the config of a runtime service. The only
|
||||
// update payload currently supported is the pod CIDR assigned to a node,
|
||||
// and the runtime service just proxies it down to the network plugin.
|
||||
|
@ -34,35 +34,36 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = "Version"
|
||||
RunPodSandbox = "RunPodSandbox"
|
||||
StopPodSandbox = "StopPodSandbox"
|
||||
RemovePodSandbox = "RemovePodSandbox"
|
||||
PodSandboxStatus = "PodSandboxStatus"
|
||||
ListPodSandbox = "ListPodSandbox"
|
||||
CreateContainer = "CreateContainer"
|
||||
StartContainer = "StartContainer"
|
||||
StopContainer = "StopContainer"
|
||||
RemoveContainer = "RemoveContainer"
|
||||
ListContainers = "ListContainers"
|
||||
ContainerStatus = "ContainerStatus"
|
||||
UpdateContainerResources = "UpdateContainerResources"
|
||||
ReopenContainerLog = "ReopenContainerLog"
|
||||
ExecSync = "ExecSync"
|
||||
Exec = "Exec"
|
||||
Attach = "Attach"
|
||||
PortForward = "PortForward"
|
||||
ContainerStats = "ContainerStats"
|
||||
ListContainerStats = "ListContainerStats"
|
||||
PodSandboxStats = "PodSandboxStats"
|
||||
ListPodSandboxStats = "ListPodSandboxStats"
|
||||
UpdateRuntimeConfig = "UpdateRuntimeConfig"
|
||||
Status = "Status"
|
||||
CheckpointContainer = "CheckpointContainer"
|
||||
GetContainerEvents = "GetContainerEvents"
|
||||
ListMetricDescriptors = "ListMetricDescriptors"
|
||||
ListPodSandboxMetrics = "ListPodSandboxMetrics"
|
||||
RuntimeConfig = "RuntimeConfig"
|
||||
Version = "Version"
|
||||
RunPodSandbox = "RunPodSandbox"
|
||||
StopPodSandbox = "StopPodSandbox"
|
||||
RemovePodSandbox = "RemovePodSandbox"
|
||||
PodSandboxStatus = "PodSandboxStatus"
|
||||
ListPodSandbox = "ListPodSandbox"
|
||||
CreateContainer = "CreateContainer"
|
||||
StartContainer = "StartContainer"
|
||||
StopContainer = "StopContainer"
|
||||
RemoveContainer = "RemoveContainer"
|
||||
ListContainers = "ListContainers"
|
||||
ContainerStatus = "ContainerStatus"
|
||||
UpdateContainerResources = "UpdateContainerResources"
|
||||
ReopenContainerLog = "ReopenContainerLog"
|
||||
ExecSync = "ExecSync"
|
||||
Exec = "Exec"
|
||||
Attach = "Attach"
|
||||
PortForward = "PortForward"
|
||||
ContainerStats = "ContainerStats"
|
||||
ListContainerStats = "ListContainerStats"
|
||||
PodSandboxStats = "PodSandboxStats"
|
||||
ListPodSandboxStats = "ListPodSandboxStats"
|
||||
UpdateRuntimeConfig = "UpdateRuntimeConfig"
|
||||
Status = "Status"
|
||||
CheckpointContainer = "CheckpointContainer"
|
||||
GetContainerEvents = "GetContainerEvents"
|
||||
ListMetricDescriptors = "ListMetricDescriptors"
|
||||
ListPodSandboxMetrics = "ListPodSandboxMetrics"
|
||||
RuntimeConfig = "RuntimeConfig"
|
||||
UpdatePodSandboxResources = "UpdatePodSandboxResources"
|
||||
)
|
||||
|
||||
// AddInjector inject the error or delay to the next call to the RuntimeService.
|
||||
@ -407,6 +408,15 @@ func (p *RemoteRuntime) UpdateRuntimeConfig(ctx context.Context, req *runtimeapi
|
||||
return &runtimeapi.UpdateRuntimeConfigResponse{}, nil
|
||||
}
|
||||
|
||||
// UpdatePodSandboxResources synchronously updates the PodSandboxConfig.
|
||||
func (p *RemoteRuntime) UpdatePodSandboxResources(ctx context.Context, req *runtimeapi.UpdatePodSandboxResourcesRequest) (*runtimeapi.UpdatePodSandboxResourcesResponse, error) {
|
||||
if err := p.runInjectors(UpdatePodSandboxResources); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return p.runtimeService.UpdatePodSandboxResources(ctx, req)
|
||||
}
|
||||
|
||||
// Status returns the status of the runtime.
|
||||
func (p *RemoteRuntime) Status(ctx context.Context, req *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error) {
|
||||
if err := p.runInjectors(Status); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user