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
e535e27e
Commit
e535e27e
authored
Sep 22, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14279 from pweil-/ipc-followup
Auto commit by PR queue bot
parents
014947c1
20361e33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
validation_test.go
pkg/api/validation/validation_test.go
+14
-1
manager.go
pkg/kubelet/dockertools/manager.go
+8
-3
manager_test.go
pkg/kubelet/dockertools/manager_test.go
+2
-2
No files found.
pkg/api/validation/validation_test.go
View file @
e535e27e
...
@@ -1259,6 +1259,20 @@ func TestValidatePodSpec(t *testing.T) {
...
@@ -1259,6 +1259,20 @@ func TestValidatePodSpec(t *testing.T) {
RestartPolicy
:
api
.
RestartPolicyAlways
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
DNSPolicy
:
api
.
DNSClusterFirst
,
},
},
{
// Populate HostIPC.
HostIPC
:
true
,
Volumes
:
[]
api
.
Volume
{{
Name
:
"vol"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{}}}},
Containers
:
[]
api
.
Container
{{
Name
:
"ctr"
,
Image
:
"image"
,
ImagePullPolicy
:
"IfNotPresent"
}},
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
},
{
// Populate HostPID.
HostPID
:
true
,
Volumes
:
[]
api
.
Volume
{{
Name
:
"vol"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{}}}},
Containers
:
[]
api
.
Container
{{
Name
:
"ctr"
,
Image
:
"image"
,
ImagePullPolicy
:
"IfNotPresent"
}},
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
},
}
}
for
i
:=
range
successCases
{
for
i
:=
range
successCases
{
if
errs
:=
ValidatePodSpec
(
&
successCases
[
i
]);
len
(
errs
)
!=
0
{
if
errs
:=
ValidatePodSpec
(
&
successCases
[
i
]);
len
(
errs
)
!=
0
{
...
@@ -1306,7 +1320,6 @@ func TestValidatePodSpec(t *testing.T) {
...
@@ -1306,7 +1320,6 @@ func TestValidatePodSpec(t *testing.T) {
},
},
},
},
HostNetwork
:
true
,
HostNetwork
:
true
,
HostIPC
:
true
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
DNSPolicy
:
api
.
DNSClusterFirst
,
},
},
...
...
pkg/kubelet/dockertools/manager.go
View file @
e535e27e
...
@@ -1557,7 +1557,7 @@ func (dm *DockerManager) createPodInfraContainer(pod *api.Pod) (kubeletTypes.Doc
...
@@ -1557,7 +1557,7 @@ func (dm *DockerManager) createPodInfraContainer(pod *api.Pod) (kubeletTypes.Doc
return
""
,
err
return
""
,
err
}
}
id
,
err
:=
dm
.
runContainerInPod
(
pod
,
container
,
netNamespace
,
getIPCMode
(
pod
,
""
),
getPidMode
(
pod
))
id
,
err
:=
dm
.
runContainerInPod
(
pod
,
container
,
netNamespace
,
getIPCMode
(
pod
),
getPidMode
(
pod
))
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -1812,8 +1812,12 @@ func (dm *DockerManager) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, pod
...
@@ -1812,8 +1812,12 @@ func (dm *DockerManager) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, pod
}
}
// TODO(dawnchen): Check RestartPolicy.DelaySeconds before restart a container
// TODO(dawnchen): Check RestartPolicy.DelaySeconds before restart a container
// Note: when configuring the pod's containers anything that can be configured by pointing
// to the namespace of the infra container should use namespaceMode. This includes things like the net namespace
// and IPC namespace. PID mode cannot point to another container right now.
// See createPodInfraContainer for infra container setup.
namespaceMode
:=
fmt
.
Sprintf
(
"container:%v"
,
podInfraContainerID
)
namespaceMode
:=
fmt
.
Sprintf
(
"container:%v"
,
podInfraContainerID
)
_
,
err
=
dm
.
runContainerInPod
(
pod
,
container
,
namespaceMode
,
getIPCMode
(
pod
,
namespaceMode
)
,
getPidMode
(
pod
))
_
,
err
=
dm
.
runContainerInPod
(
pod
,
container
,
namespaceMode
,
namespaceMode
,
getPidMode
(
pod
))
dm
.
updateReasonCache
(
pod
,
container
,
"RunContainerError"
,
err
)
dm
.
updateReasonCache
(
pod
,
container
,
"RunContainerError"
,
err
)
if
err
!=
nil
{
if
err
!=
nil
{
// TODO(bburns) : Perhaps blacklist a container after N failures?
// TODO(bburns) : Perhaps blacklist a container after N failures?
...
@@ -1938,7 +1942,8 @@ func getPidMode(pod *api.Pod) string {
...
@@ -1938,7 +1942,8 @@ func getPidMode(pod *api.Pod) string {
}
}
// getIPCMode returns the ipc mode to use on the docker container based on pod.Spec.HostIPC.
// getIPCMode returns the ipc mode to use on the docker container based on pod.Spec.HostIPC.
func
getIPCMode
(
pod
*
api
.
Pod
,
ipcMode
string
)
string
{
func
getIPCMode
(
pod
*
api
.
Pod
)
string
{
ipcMode
:=
""
if
pod
.
Spec
.
HostIPC
{
if
pod
.
Spec
.
HostIPC
{
ipcMode
=
"host"
ipcMode
=
"host"
}
}
...
...
pkg/kubelet/dockertools/manager_test.go
View file @
e535e27e
...
@@ -2071,7 +2071,7 @@ func TestGetPidMode(t *testing.T) {
...
@@ -2071,7 +2071,7 @@ func TestGetPidMode(t *testing.T) {
func
TestGetIPCMode
(
t
*
testing
.
T
)
{
func
TestGetIPCMode
(
t
*
testing
.
T
)
{
// test false
// test false
pod
:=
&
api
.
Pod
{}
pod
:=
&
api
.
Pod
{}
ipcMode
:=
getIPCMode
(
pod
,
""
)
ipcMode
:=
getIPCMode
(
pod
)
if
ipcMode
!=
""
{
if
ipcMode
!=
""
{
t
.
Errorf
(
"expected empty ipc mode for pod but got %v"
,
ipcMode
)
t
.
Errorf
(
"expected empty ipc mode for pod but got %v"
,
ipcMode
)
...
@@ -2079,7 +2079,7 @@ func TestGetIPCMode(t *testing.T) {
...
@@ -2079,7 +2079,7 @@ func TestGetIPCMode(t *testing.T) {
// test true
// test true
pod
.
Spec
.
HostIPC
=
true
pod
.
Spec
.
HostIPC
=
true
ipcMode
=
getIPCMode
(
pod
,
""
)
ipcMode
=
getIPCMode
(
pod
)
if
ipcMode
!=
"host"
{
if
ipcMode
!=
"host"
{
t
.
Errorf
(
"expected host ipc mode for pod but got %v"
,
ipcMode
)
t
.
Errorf
(
"expected host ipc mode for pod but got %v"
,
ipcMode
)
}
}
...
...
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