1
16
17 package cri
18
19 import (
20 "context"
21 "time"
22
23 runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
24 )
25
26
27 type RuntimeVersioner interface {
28
29 Version(ctx context.Context, apiVersion string) (*runtimeapi.VersionResponse, error)
30 }
31
32
33
34 type ContainerManager interface {
35
36 CreateContainer(ctx context.Context, podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
37
38 StartContainer(ctx context.Context, containerID string) error
39
40 StopContainer(ctx context.Context, containerID string, timeout int64) error
41
42 RemoveContainer(ctx context.Context, containerID string) error
43
44 ListContainers(ctx context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
45
46 ContainerStatus(ctx context.Context, containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
47
48
49 UpdateContainerResources(ctx context.Context, containerID string, resources *runtimeapi.ContainerResources) error
50
51
52 ExecSync(ctx context.Context, containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
53
54 Exec(context.Context, *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
55
56 Attach(ctx context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
57
58
59
60 ReopenContainerLog(ctx context.Context, ContainerID string) error
61
62 CheckpointContainer(ctx context.Context, options *runtimeapi.CheckpointContainerRequest) error
63
64 GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error
65 }
66
67
68
69 type PodSandboxManager interface {
70
71
72 RunPodSandbox(ctx context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
73
74
75 StopPodSandbox(pctx context.Context, odSandboxID string) error
76
77
78 RemovePodSandbox(ctx context.Context, podSandboxID string) error
79
80 PodSandboxStatus(ctx context.Context, podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
81
82 ListPodSandbox(ctx context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
83
84 PortForward(context.Context, *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
85 }
86
87
88
89 type ContainerStatsManager interface {
90
91
92 ContainerStats(ctx context.Context, containerID string) (*runtimeapi.ContainerStats, error)
93
94 ListContainerStats(ctx context.Context, filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
95
96
97 PodSandboxStats(ctx context.Context, podSandboxID string) (*runtimeapi.PodSandboxStats, error)
98
99 ListPodSandboxStats(ctx context.Context, filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
100
101 ListMetricDescriptors(ctx context.Context) ([]*runtimeapi.MetricDescriptor, error)
102
103 ListPodSandboxMetrics(ctx context.Context) ([]*runtimeapi.PodSandboxMetrics, error)
104 }
105
106
107
108 type RuntimeService interface {
109 RuntimeVersioner
110 ContainerManager
111 PodSandboxManager
112 ContainerStatsManager
113
114
115 UpdateRuntimeConfig(ctx context.Context, runtimeConfig *runtimeapi.RuntimeConfig) error
116
117 Status(ctx context.Context, verbose bool) (*runtimeapi.StatusResponse, error)
118
119 RuntimeConfig(ctx context.Context) (*runtimeapi.RuntimeConfigResponse, error)
120 }
121
122
123
124
125 type ImageManagerService interface {
126
127 ListImages(ctx context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
128
129 ImageStatus(ctx context.Context, image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
130
131 PullImage(ctx context.Context, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
132
133 RemoveImage(ctx context.Context, image *runtimeapi.ImageSpec) error
134
135 ImageFsInfo(ctx context.Context) (*runtimeapi.ImageFsInfoResponse, error)
136 }
137
View as plain text