mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +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)
|
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 prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
||||||
PortForward(ctx context.Context, request *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
|
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
|
// 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
|
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
|
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
|
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
|
// UpdateRuntimeConfig updates the config of a runtime service. The only
|
||||||
// update payload currently supported is the pod CIDR assigned to a node,
|
// update payload currently supported is the pod CIDR assigned to a node,
|
||||||
// and the runtime service just proxies it down to the network plugin.
|
// and the runtime service just proxies it down to the network plugin.
|
||||||
|
@ -34,35 +34,36 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "Version"
|
Version = "Version"
|
||||||
RunPodSandbox = "RunPodSandbox"
|
RunPodSandbox = "RunPodSandbox"
|
||||||
StopPodSandbox = "StopPodSandbox"
|
StopPodSandbox = "StopPodSandbox"
|
||||||
RemovePodSandbox = "RemovePodSandbox"
|
RemovePodSandbox = "RemovePodSandbox"
|
||||||
PodSandboxStatus = "PodSandboxStatus"
|
PodSandboxStatus = "PodSandboxStatus"
|
||||||
ListPodSandbox = "ListPodSandbox"
|
ListPodSandbox = "ListPodSandbox"
|
||||||
CreateContainer = "CreateContainer"
|
CreateContainer = "CreateContainer"
|
||||||
StartContainer = "StartContainer"
|
StartContainer = "StartContainer"
|
||||||
StopContainer = "StopContainer"
|
StopContainer = "StopContainer"
|
||||||
RemoveContainer = "RemoveContainer"
|
RemoveContainer = "RemoveContainer"
|
||||||
ListContainers = "ListContainers"
|
ListContainers = "ListContainers"
|
||||||
ContainerStatus = "ContainerStatus"
|
ContainerStatus = "ContainerStatus"
|
||||||
UpdateContainerResources = "UpdateContainerResources"
|
UpdateContainerResources = "UpdateContainerResources"
|
||||||
ReopenContainerLog = "ReopenContainerLog"
|
ReopenContainerLog = "ReopenContainerLog"
|
||||||
ExecSync = "ExecSync"
|
ExecSync = "ExecSync"
|
||||||
Exec = "Exec"
|
Exec = "Exec"
|
||||||
Attach = "Attach"
|
Attach = "Attach"
|
||||||
PortForward = "PortForward"
|
PortForward = "PortForward"
|
||||||
ContainerStats = "ContainerStats"
|
ContainerStats = "ContainerStats"
|
||||||
ListContainerStats = "ListContainerStats"
|
ListContainerStats = "ListContainerStats"
|
||||||
PodSandboxStats = "PodSandboxStats"
|
PodSandboxStats = "PodSandboxStats"
|
||||||
ListPodSandboxStats = "ListPodSandboxStats"
|
ListPodSandboxStats = "ListPodSandboxStats"
|
||||||
UpdateRuntimeConfig = "UpdateRuntimeConfig"
|
UpdateRuntimeConfig = "UpdateRuntimeConfig"
|
||||||
Status = "Status"
|
Status = "Status"
|
||||||
CheckpointContainer = "CheckpointContainer"
|
CheckpointContainer = "CheckpointContainer"
|
||||||
GetContainerEvents = "GetContainerEvents"
|
GetContainerEvents = "GetContainerEvents"
|
||||||
ListMetricDescriptors = "ListMetricDescriptors"
|
ListMetricDescriptors = "ListMetricDescriptors"
|
||||||
ListPodSandboxMetrics = "ListPodSandboxMetrics"
|
ListPodSandboxMetrics = "ListPodSandboxMetrics"
|
||||||
RuntimeConfig = "RuntimeConfig"
|
RuntimeConfig = "RuntimeConfig"
|
||||||
|
UpdatePodSandboxResources = "UpdatePodSandboxResources"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddInjector inject the error or delay to the next call to the RuntimeService.
|
// 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
|
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.
|
// Status returns the status of the runtime.
|
||||||
func (p *RemoteRuntime) Status(ctx context.Context, req *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error) {
|
func (p *RemoteRuntime) Status(ctx context.Context, req *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error) {
|
||||||
if err := p.runInjectors(Status); err != nil {
|
if err := p.runInjectors(Status); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user