Skip to content

Commit c5c461d

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#36664 from yujuhong/fix_comments
Automatic merge from submit-queue dockershim: clean up comments
2 parents 61a5d23 + b73dfe0 commit c5c461d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

pkg/kubelet/dockershim/docker_container.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ func (ds *dockerService) ListContainers(filter *runtimeApi.ContainerFilter) ([]*
7979
}
8080

8181
// CreateContainer creates a new container in the given PodSandbox
82-
// Note: docker doesn't use LogPath yet.
82+
// Docker cannot store the log to an arbitrary location (yet), so we create an
83+
// symlink at LogPath, linking to the actual path of the log.
8384
// TODO: check if the default values returned by the runtime API are ok.
8485
func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeApi.ContainerConfig, sandboxConfig *runtimeApi.PodSandboxConfig) (string, error) {
8586
if config == nil {
@@ -140,7 +141,7 @@ func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeApi
140141
if rOpts != nil {
141142
hc.Resources = dockercontainer.Resources{
142143
Memory: rOpts.GetMemoryLimitInBytes(),
143-
MemorySwap: -1, // Always disable memory swap.
144+
MemorySwap: -1,
144145
CPUShares: rOpts.GetCpuShares(),
145146
CPUQuota: rOpts.GetCpuQuota(),
146147
CPUPeriod: rOpts.GetCpuPeriod(),
@@ -229,10 +230,10 @@ func (ds *dockerService) StartContainer(containerID string) error {
229230
}
230231
// Create container log symlink.
231232
if err := ds.createContainerLogSymlink(containerID); err != nil {
232-
// Do not stop the container if fail to create symlink, because:
233-
// 1. This is not a critical failure.
234-
// 2. We don't have enough information to properly stop container here.
235-
// Kubelet will surface this error to user with event.
233+
// Do not stop the container if we failed to create symlink because:
234+
// 1. This is not a critical failure.
235+
// 2. We don't have enough information to properly stop container here.
236+
// Kubelet will surface this error to user via an event.
236237
return err
237238
}
238239
return nil
@@ -248,7 +249,7 @@ func (ds *dockerService) StopContainer(containerID string, timeout int64) error
248249
func (ds *dockerService) RemoveContainer(containerID string) error {
249250
// Ideally, log lifecycle should be independent of container lifecycle.
250251
// However, docker will remove container log after container is removed,
251-
// we can't prevent that now, so we also cleanup the symlink here.
252+
// we can't prevent that now, so we also clean up the symlink here.
252253
err := ds.removeContainerLogSymlink(containerID)
253254
if err != nil {
254255
return err
@@ -279,7 +280,7 @@ func getContainerTimestamps(r *dockertypes.ContainerJSON) (time.Time, time.Time,
279280
return createdAt, startedAt, finishedAt, nil
280281
}
281282

282-
// ContainerStatus returns the container status.
283+
// ContainerStatus inspects the docker container and returns the status.
283284
func (ds *dockerService) ContainerStatus(containerID string) (*runtimeApi.ContainerStatus, error) {
284285
r, err := ds.client.InspectContainer(containerID)
285286
if err != nil {
@@ -292,7 +293,7 @@ func (ds *dockerService) ContainerStatus(containerID string) (*runtimeApi.Contai
292293
return nil, fmt.Errorf("failed to parse timestamp for container %q: %v", containerID, err)
293294
}
294295

295-
// Convert the image id to pullable id.
296+
// Convert the image id to a pullable id.
296297
ir, err := ds.client.InspectImageByID(r.Image)
297298
if err != nil {
298299
return nil, fmt.Errorf("unable to inspect docker image %q while inspecting docker container %q: %v", r.Image, containerID, err)

pkg/kubelet/dockershim/docker_sandbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ func sharesHostNetwork(container *dockertypes.ContainerJSON) bool {
368368

369369
func setSandboxResources(hc *dockercontainer.HostConfig) {
370370
hc.Resources = dockercontainer.Resources{
371-
MemorySwap: -1, // Always disable memory swap.
371+
MemorySwap: -1,
372372
CPUShares: defaultSandboxCPUshares,
373373
// Use docker's default cpu quota/period.
374374
}

0 commit comments

Comments
 (0)