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
9fcc25d1
Commit
9fcc25d1
authored
Jun 20, 2017
by
Seth Jennings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't pass CRI error through to waiting state reason
parent
8316bbc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
kuberuntime_container.go
pkg/kubelet/kuberuntime/kuberuntime_container.go
+11
-4
No files found.
pkg/kubelet/kuberuntime/kuberuntime_container.go
View file @
9fcc25d1
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
kuberuntime
package
kuberuntime
import
(
import
(
"errors"
"fmt"
"fmt"
"io"
"io"
"math/rand"
"math/rand"
...
@@ -48,6 +49,12 @@ import (
...
@@ -48,6 +49,12 @@ import (
"k8s.io/kubernetes/pkg/util/tail"
"k8s.io/kubernetes/pkg/util/tail"
)
)
var
(
ErrCreateContainerConfig
=
errors
.
New
(
"CreateContainerConfigError"
)
ErrCreateContainer
=
errors
.
New
(
"CreateContainerError"
)
ErrPostStartHook
=
errors
.
New
(
"PostStartHookError"
)
)
// recordContainerEvent should be used by the runtime manager for all container related events.
// recordContainerEvent should be used by the runtime manager for all container related events.
// it has sanity checks to ensure that we do not write events that can abuse our masters.
// it has sanity checks to ensure that we do not write events that can abuse our masters.
// in particular, it ensures that a containerID never appears in an event message as that
// in particular, it ensures that a containerID never appears in an event message as that
...
@@ -102,12 +109,12 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
...
@@ -102,12 +109,12 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
containerConfig
,
err
:=
m
.
generateContainerConfig
(
container
,
pod
,
restartCount
,
podIP
,
imageRef
)
containerConfig
,
err
:=
m
.
generateContainerConfig
(
container
,
pod
,
restartCount
,
podIP
,
imageRef
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
recordContainerEvent
(
pod
,
container
,
""
,
v1
.
EventTypeWarning
,
events
.
FailedToCreateContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
m
.
recordContainerEvent
(
pod
,
container
,
""
,
v1
.
EventTypeWarning
,
events
.
FailedToCreateContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
return
"Generate Container Config Failed"
,
err
return
grpc
.
ErrorDesc
(
err
),
ErrCreateContainerConfig
}
}
containerID
,
err
:=
m
.
runtimeService
.
CreateContainer
(
podSandboxID
,
containerConfig
,
podSandboxConfig
)
containerID
,
err
:=
m
.
runtimeService
.
CreateContainer
(
podSandboxID
,
containerConfig
,
podSandboxConfig
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeWarning
,
events
.
FailedToCreateContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeWarning
,
events
.
FailedToCreateContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
return
"Create Container Failed"
,
er
r
return
grpc
.
ErrorDesc
(
err
),
ErrCreateContaine
r
}
}
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeNormal
,
events
.
CreatedContainer
,
"Created container"
)
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeNormal
,
events
.
CreatedContainer
,
"Created container"
)
...
@@ -122,7 +129,7 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
...
@@ -122,7 +129,7 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
err
=
m
.
runtimeService
.
StartContainer
(
containerID
)
err
=
m
.
runtimeService
.
StartContainer
(
containerID
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeWarning
,
events
.
FailedToStartContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeWarning
,
events
.
FailedToStartContainer
,
"Error: %v"
,
grpc
.
ErrorDesc
(
err
))
return
"Start Container Failed"
,
er
r
return
grpc
.
ErrorDesc
(
err
),
kubecontainer
.
ErrRunContaine
r
}
}
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeNormal
,
events
.
StartedContainer
,
"Started container"
)
m
.
recordContainerEvent
(
pod
,
container
,
containerID
,
v1
.
EventTypeNormal
,
events
.
StartedContainer
,
"Started container"
)
...
@@ -149,7 +156,7 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
...
@@ -149,7 +156,7 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
if
handlerErr
!=
nil
{
if
handlerErr
!=
nil
{
m
.
recordContainerEvent
(
pod
,
container
,
kubeContainerID
.
ID
,
v1
.
EventTypeWarning
,
events
.
FailedPostStartHook
,
msg
)
m
.
recordContainerEvent
(
pod
,
container
,
kubeContainerID
.
ID
,
v1
.
EventTypeWarning
,
events
.
FailedPostStartHook
,
msg
)
m
.
killContainer
(
pod
,
kubeContainerID
,
container
.
Name
,
"FailedPostStartHook"
,
nil
)
m
.
killContainer
(
pod
,
kubeContainerID
,
container
.
Name
,
"FailedPostStartHook"
,
nil
)
return
"PostStart Hook Failed"
,
err
return
msg
,
ErrPostStartHook
}
}
}
}
...
...
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