Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b73dfe02
Commit
b73dfe02
authored
Nov 11, 2016
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dockershim: clean up comments
parent
868f6e1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
docker_container.go
pkg/kubelet/dockershim/docker_container.go
+10
-9
docker_sandbox.go
pkg/kubelet/dockershim/docker_sandbox.go
+1
-1
No files found.
pkg/kubelet/dockershim/docker_container.go
View file @
b73dfe02
...
...
@@ -79,7 +79,8 @@ func (ds *dockerService) ListContainers(filter *runtimeApi.ContainerFilter) ([]*
}
// CreateContainer creates a new container in the given PodSandbox
// Note: docker doesn't use LogPath yet.
// Docker cannot store the log to an arbitrary location (yet), so we create an
// symlink at LogPath, linking to the actual path of the log.
// TODO: check if the default values returned by the runtime API are ok.
func
(
ds
*
dockerService
)
CreateContainer
(
podSandboxID
string
,
config
*
runtimeApi
.
ContainerConfig
,
sandboxConfig
*
runtimeApi
.
PodSandboxConfig
)
(
string
,
error
)
{
if
config
==
nil
{
...
...
@@ -140,7 +141,7 @@ func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeApi
if
rOpts
!=
nil
{
hc
.
Resources
=
dockercontainer
.
Resources
{
Memory
:
rOpts
.
GetMemoryLimitInBytes
(),
MemorySwap
:
-
1
,
// Always disable memory swap.
MemorySwap
:
-
1
,
CPUShares
:
rOpts
.
GetCpuShares
(),
CPUQuota
:
rOpts
.
GetCpuQuota
(),
CPUPeriod
:
rOpts
.
GetCpuPeriod
(),
...
...
@@ -229,10 +230,10 @@ func (ds *dockerService) StartContainer(containerID string) error {
}
// Create container log symlink.
if
err
:=
ds
.
createContainerLogSymlink
(
containerID
);
err
!=
nil
{
// Do not stop the container if
fail to create symlink,
because:
// 1. This is not a critical failure.
// 2. We don't have enough information to properly stop container here.
// Kubelet will surface this error to user
with
event.
// Do not stop the container if
we failed to create symlink
because:
//
1. This is not a critical failure.
//
2. We don't have enough information to properly stop container here.
// Kubelet will surface this error to user
via an
event.
return
err
}
return
nil
...
...
@@ -248,7 +249,7 @@ func (ds *dockerService) StopContainer(containerID string, timeout int64) error
func
(
ds
*
dockerService
)
RemoveContainer
(
containerID
string
)
error
{
// Ideally, log lifecycle should be independent of container lifecycle.
// However, docker will remove container log after container is removed,
// we can't prevent that now, so we also cleanup the symlink here.
// we can't prevent that now, so we also clean
up the symlink here.
err
:=
ds
.
removeContainerLogSymlink
(
containerID
)
if
err
!=
nil
{
return
err
...
...
@@ -279,7 +280,7 @@ func getContainerTimestamps(r *dockertypes.ContainerJSON) (time.Time, time.Time,
return
createdAt
,
startedAt
,
finishedAt
,
nil
}
// ContainerStatus
returns the container
status.
// ContainerStatus
inspects the docker container and returns the
status.
func
(
ds
*
dockerService
)
ContainerStatus
(
containerID
string
)
(
*
runtimeApi
.
ContainerStatus
,
error
)
{
r
,
err
:=
ds
.
client
.
InspectContainer
(
containerID
)
if
err
!=
nil
{
...
...
@@ -292,7 +293,7 @@ func (ds *dockerService) ContainerStatus(containerID string) (*runtimeApi.Contai
return
nil
,
fmt
.
Errorf
(
"failed to parse timestamp for container %q: %v"
,
containerID
,
err
)
}
// Convert the image id to pullable id.
// Convert the image id to
a
pullable id.
ir
,
err
:=
ds
.
client
.
InspectImageByID
(
r
.
Image
)
if
err
!=
nil
{
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
View file @
b73dfe02
...
...
@@ -368,7 +368,7 @@ func sharesHostNetwork(container *dockertypes.ContainerJSON) bool {
func
setSandboxResources
(
hc
*
dockercontainer
.
HostConfig
)
{
hc
.
Resources
=
dockercontainer
.
Resources
{
MemorySwap
:
-
1
,
// Always disable memory swap.
MemorySwap
:
-
1
,
CPUShares
:
defaultSandboxCPUshares
,
// Use docker's default cpu quota/period.
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment