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
1f4ece84
Commit
1f4ece84
authored
Jun 22, 2015
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9490 from andronat/add_reason_2_pods
Adding Reason to PodStatus
parents
a14e1176
101739a6
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
64 additions
and
12 deletions
+64
-12
v1.json
api/swagger-spec/v1.json
+4
-0
v1beta3.json
api/swagger-spec/v1beta3.json
+4
-0
deep_copy_generated.go
pkg/api/deep_copy_generated.go
+1
-0
types.go
pkg/api/types.go
+2
-0
conversion_generated.go
pkg/api/v1/conversion_generated.go
+2
-0
deep_copy_generated.go
pkg/api/v1/deep_copy_generated.go
+1
-0
types.go
pkg/api/v1/types.go
+2
-0
conversion_generated.go
pkg/api/v1beta3/conversion_generated.go
+2
-0
deep_copy_generated.go
pkg/api/v1beta3/deep_copy_generated.go
+1
-0
types.go
pkg/api/v1beta3/types.go
+2
-0
resource_printer.go
pkg/kubectl/resource_printer.go
+4
-0
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+21
-5
kubelet.go
pkg/kubelet/kubelet.go
+18
-7
No files found.
api/swagger-spec/v1.json
View file @
1f4ece84
...
@@ -12663,6 +12663,10 @@
...
@@ -12663,6 +12663,10 @@
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"human readable message indicating details about why the pod is in this condition"
"description"
:
"human readable message indicating details about why the pod is in this condition"
},
},
"reason"
:
{
"type"
:
"string"
,
"description"
:
"(brief-CamelCase) reason indicating details about why the pod is in this condition"
},
"hostIP"
:
{
"hostIP"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"IP address of the host to which the pod is assigned; empty if not yet scheduled"
"description"
:
"IP address of the host to which the pod is assigned; empty if not yet scheduled"
...
...
api/swagger-spec/v1beta3.json
View file @
1f4ece84
...
@@ -12665,6 +12665,10 @@
...
@@ -12665,6 +12665,10 @@
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"human readable message indicating details about why the pod is in this condition"
"description"
:
"human readable message indicating details about why the pod is in this condition"
},
},
"reason"
:
{
"type"
:
"string"
,
"description"
:
"(brief-CamelCase) reason indicating details about why the pod is in this condition"
},
"hostIP"
:
{
"hostIP"
:
{
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"IP address of the host to which the pod is assigned; empty if not yet scheduled"
"description"
:
"IP address of the host to which the pod is assigned; empty if not yet scheduled"
...
...
pkg/api/deep_copy_generated.go
View file @
1f4ece84
...
@@ -1407,6 +1407,7 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner)
...
@@ -1407,6 +1407,7 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner)
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
...
pkg/api/types.go
View file @
1f4ece84
...
@@ -911,6 +911,8 @@ type PodStatus struct {
...
@@ -911,6 +911,8 @@ type PodStatus struct {
Conditions
[]
PodCondition
`json:"conditions,omitempty"`
Conditions
[]
PodCondition
`json:"conditions,omitempty"`
// A human readable message indicating details about why the pod is in this state.
// A human readable message indicating details about why the pod is in this state.
Message
string
`json:"message,omitempty"`
Message
string
`json:"message,omitempty"`
// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'OutOfDisk'
Reason
string
`json:"reason,omitempty" description:"(brief-CamelCase) reason indicating details about why the pod is in this condition"`
HostIP
string
`json:"hostIP,omitempty"`
HostIP
string
`json:"hostIP,omitempty"`
PodIP
string
`json:"podIP,omitempty"`
PodIP
string
`json:"podIP,omitempty"`
...
...
pkg/api/v1/conversion_generated.go
View file @
1f4ece84
...
@@ -1549,6 +1549,7 @@ func convert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s
...
@@ -1549,6 +1549,7 @@ func convert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
@@ -3859,6 +3860,7 @@ func convert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s
...
@@ -3859,6 +3860,7 @@ func convert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
...
pkg/api/v1/deep_copy_generated.go
View file @
1f4ece84
...
@@ -1338,6 +1338,7 @@ func deepCopy_v1_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) e
...
@@ -1338,6 +1338,7 @@ func deepCopy_v1_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) e
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
...
pkg/api/v1/types.go
View file @
1f4ece84
...
@@ -913,6 +913,8 @@ type PodStatus struct {
...
@@ -913,6 +913,8 @@ type PodStatus struct {
Conditions
[]
PodCondition
`json:"conditions,omitempty" description:"current service state of pod" patchStrategy:"merge" patchMergeKey:"type"`
Conditions
[]
PodCondition
`json:"conditions,omitempty" description:"current service state of pod" patchStrategy:"merge" patchMergeKey:"type"`
// A human readable message indicating details about why the pod is in this state.
// A human readable message indicating details about why the pod is in this state.
Message
string
`json:"message,omitempty" description:"human readable message indicating details about why the pod is in this condition"`
Message
string
`json:"message,omitempty" description:"human readable message indicating details about why the pod is in this condition"`
// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'OutOfDisk'
Reason
string
`json:"reason,omitempty" description:"(brief-CamelCase) reason indicating details about why the pod is in this condition"`
HostIP
string
`json:"hostIP,omitempty" description:"IP address of the host to which the pod is assigned; empty if not yet scheduled"`
HostIP
string
`json:"hostIP,omitempty" description:"IP address of the host to which the pod is assigned; empty if not yet scheduled"`
PodIP
string
`json:"podIP,omitempty" description:"IP address allocated to the pod; routable at least within the cluster; empty if not yet allocated"`
PodIP
string
`json:"podIP,omitempty" description:"IP address allocated to the pod; routable at least within the cluster; empty if not yet allocated"`
...
...
pkg/api/v1beta3/conversion_generated.go
View file @
1f4ece84
...
@@ -1345,6 +1345,7 @@ func convert_api_PodStatus_To_v1beta3_PodStatus(in *api.PodStatus, out *PodStatu
...
@@ -1345,6 +1345,7 @@ func convert_api_PodStatus_To_v1beta3_PodStatus(in *api.PodStatus, out *PodStatu
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
@@ -3409,6 +3410,7 @@ func convert_v1beta3_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatu
...
@@ -3409,6 +3410,7 @@ func convert_v1beta3_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatu
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
...
pkg/api/v1beta3/deep_copy_generated.go
View file @
1f4ece84
...
@@ -1342,6 +1342,7 @@ func deepCopy_v1beta3_PodStatus(in PodStatus, out *PodStatus, c *conversion.Clon
...
@@ -1342,6 +1342,7 @@ func deepCopy_v1beta3_PodStatus(in PodStatus, out *PodStatus, c *conversion.Clon
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
...
...
pkg/api/v1beta3/types.go
View file @
1f4ece84
...
@@ -917,6 +917,8 @@ type PodStatus struct {
...
@@ -917,6 +917,8 @@ type PodStatus struct {
Conditions
[]
PodCondition
`json:"Condition,omitempty" description:"current service state of pod" patchStrategy:"merge" patchMergeKey:"type"`
Conditions
[]
PodCondition
`json:"Condition,omitempty" description:"current service state of pod" patchStrategy:"merge" patchMergeKey:"type"`
// A human readable message indicating details about why the pod is in this state.
// A human readable message indicating details about why the pod is in this state.
Message
string
`json:"message,omitempty" description:"human readable message indicating details about why the pod is in this condition"`
Message
string
`json:"message,omitempty" description:"human readable message indicating details about why the pod is in this condition"`
// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'OutOfDisk'
Reason
string
`json:"reason,omitempty" description:"(brief-CamelCase) reason indicating details about why the pod is in this condition"`
HostIP
string
`json:"hostIP,omitempty" description:"IP address of the host to which the pod is assigned; empty if not yet scheduled"`
HostIP
string
`json:"hostIP,omitempty" description:"IP address of the host to which the pod is assigned; empty if not yet scheduled"`
PodIP
string
`json:"podIP,omitempty" description:"IP address allocated to the pod; routable at least within the cluster; empty if not yet allocated"`
PodIP
string
`json:"podIP,omitempty" description:"IP address allocated to the pod; routable at least within the cluster; empty if not yet allocated"`
...
...
pkg/kubectl/resource_printer.go
View file @
1f4ece84
...
@@ -377,7 +377,11 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool) error {
...
@@ -377,7 +377,11 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool) error {
restarts
:=
0
restarts
:=
0
totalContainers
:=
len
(
pod
.
Spec
.
Containers
)
totalContainers
:=
len
(
pod
.
Spec
.
Containers
)
readyContainers
:=
0
readyContainers
:=
0
reason
:=
string
(
pod
.
Status
.
Phase
)
reason
:=
string
(
pod
.
Status
.
Phase
)
if
pod
.
Status
.
Reason
!=
""
{
reason
=
pod
.
Status
.
Reason
}
for
i
:=
len
(
pod
.
Status
.
ContainerStatuses
)
-
1
;
i
>=
0
;
i
--
{
for
i
:=
len
(
pod
.
Status
.
ContainerStatuses
)
-
1
;
i
>=
0
;
i
--
{
container
:=
pod
.
Status
.
ContainerStatuses
[
i
]
container
:=
pod
.
Status
.
ContainerStatuses
[
i
]
...
...
pkg/kubectl/resource_printer_test.go
View file @
1f4ece84
...
@@ -979,11 +979,11 @@ func TestPrintPod(t *testing.T) {
...
@@ -979,11 +979,11 @@ func TestPrintPod(t *testing.T) {
Phase
:
"podPhase"
,
Phase
:
"podPhase"
,
ContainerStatuses
:
[]
api
.
ContainerStatus
{
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
Ready
:
true
,
RestartCount
:
3
,
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{}}},
{
Ready
:
true
,
RestartCount
:
3
,
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{}}},
{
State
:
api
.
ContainerState
{
Waiting
:
&
api
.
ContainerStateWaiting
{
Reason
:
"
c
ontainerWaitingReason"
}},
RestartCount
:
3
},
{
State
:
api
.
ContainerState
{
Waiting
:
&
api
.
ContainerStateWaiting
{
Reason
:
"
C
ontainerWaitingReason"
}},
RestartCount
:
3
},
},
},
},
},
},
},
"test2
\t
1/2
\t
c
ontainerWaitingReason
\t
6
\t
"
,
"test2
\t
1/2
\t
C
ontainerWaitingReason
\t
6
\t
"
,
},
},
{
{
// Test the same as the above but with Terminated state and the first container overwrites the rest
// Test the same as the above but with Terminated state and the first container overwrites the rest
...
@@ -993,12 +993,12 @@ func TestPrintPod(t *testing.T) {
...
@@ -993,12 +993,12 @@ func TestPrintPod(t *testing.T) {
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Phase
:
"podPhase"
,
Phase
:
"podPhase"
,
ContainerStatuses
:
[]
api
.
ContainerStatus
{
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
State
:
api
.
ContainerState
{
Waiting
:
&
api
.
ContainerStateWaiting
{
Reason
:
"
c
ontainerWaitingReason"
}},
RestartCount
:
3
},
{
State
:
api
.
ContainerState
{
Waiting
:
&
api
.
ContainerStateWaiting
{
Reason
:
"
C
ontainerWaitingReason"
}},
RestartCount
:
3
},
{
State
:
api
.
ContainerState
{
Terminated
:
&
api
.
ContainerStateTerminated
{
Reason
:
"
c
ontainerTerminatedReason"
}},
RestartCount
:
3
},
{
State
:
api
.
ContainerState
{
Terminated
:
&
api
.
ContainerStateTerminated
{
Reason
:
"
C
ontainerTerminatedReason"
}},
RestartCount
:
3
},
},
},
},
},
},
},
"test3
\t
0/2
\t
c
ontainerWaitingReason
\t
6
\t
"
,
"test3
\t
0/2
\t
C
ontainerWaitingReason
\t
6
\t
"
,
},
},
{
{
// Test ready is not enough for reporting running
// Test ready is not enough for reporting running
...
@@ -1015,6 +1015,22 @@ func TestPrintPod(t *testing.T) {
...
@@ -1015,6 +1015,22 @@ func TestPrintPod(t *testing.T) {
},
},
"test4
\t
1/2
\t
podPhase
\t
6
\t
"
,
"test4
\t
1/2
\t
podPhase
\t
6
\t
"
,
},
},
{
// Test ready is not enough for reporting running
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test5"
},
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
)},
Status
:
api
.
PodStatus
{
Reason
:
"OutOfDisk"
,
Phase
:
"podPhase"
,
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
Ready
:
true
,
RestartCount
:
3
,
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{}}},
{
Ready
:
true
,
RestartCount
:
3
},
},
},
},
"test5
\t
1/2
\t
OutOfDisk
\t
6
\t
"
,
},
}
}
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
...
...
pkg/kubelet/kubelet.go
View file @
1f4ece84
...
@@ -1584,9 +1584,11 @@ func (kl *Kubelet) handleOutOfDisk(pods []*api.Pod, podSyncTypes map[types.UID]S
...
@@ -1584,9 +1584,11 @@ func (kl *Kubelet) handleOutOfDisk(pods []*api.Pod, podSyncTypes map[types.UID]S
pod
:=
pods
[
i
]
pod
:=
pods
[
i
]
// Only reject pods that didn't start yet.
// Only reject pods that didn't start yet.
if
podSyncTypes
[
pod
.
UID
]
==
SyncPodCreate
{
if
podSyncTypes
[
pod
.
UID
]
==
SyncPodCreate
{
kl
.
recorder
.
Eventf
(
pod
,
"OutOfDisk"
,
"Cannot start the pod due to lack of disk space."
)
reason
:=
"OutOfDisk"
kl
.
recorder
.
Eventf
(
pod
,
reason
,
"Cannot start the pod due to lack of disk space."
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
Phase
:
api
.
PodFailed
,
Phase
:
api
.
PodFailed
,
Reason
:
reason
,
Message
:
"Pod cannot be started due to lack of disk space."
})
Message
:
"Pod cannot be started due to lack of disk space."
})
continue
continue
}
}
...
@@ -1621,23 +1623,29 @@ func (kl *Kubelet) checkNodeSelectorMatching(pods []*api.Pod) (fitting []*api.Po
...
@@ -1621,23 +1623,29 @@ func (kl *Kubelet) checkNodeSelectorMatching(pods []*api.Pod) (fitting []*api.Po
func
(
kl
*
Kubelet
)
handleNotFittingPods
(
pods
[]
*
api
.
Pod
)
[]
*
api
.
Pod
{
func
(
kl
*
Kubelet
)
handleNotFittingPods
(
pods
[]
*
api
.
Pod
)
[]
*
api
.
Pod
{
fitting
,
notFitting
:=
checkHostPortConflicts
(
pods
)
fitting
,
notFitting
:=
checkHostPortConflicts
(
pods
)
for
_
,
pod
:=
range
notFitting
{
for
_
,
pod
:=
range
notFitting
{
kl
.
recorder
.
Eventf
(
pod
,
"hostPortConflict"
,
"Cannot start the pod due to host port conflict."
)
reason
:=
"HostPortConflict"
kl
.
recorder
.
Eventf
(
pod
,
reason
,
"Cannot start the pod due to host port conflict."
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
Phase
:
api
.
PodFailed
,
Phase
:
api
.
PodFailed
,
Reason
:
reason
,
Message
:
"Pod cannot be started due to host port conflict"
})
Message
:
"Pod cannot be started due to host port conflict"
})
}
}
fitting
,
notFitting
=
kl
.
checkNodeSelectorMatching
(
fitting
)
fitting
,
notFitting
=
kl
.
checkNodeSelectorMatching
(
fitting
)
for
_
,
pod
:=
range
notFitting
{
for
_
,
pod
:=
range
notFitting
{
kl
.
recorder
.
Eventf
(
pod
,
"nodeSelectorMismatching"
,
"Cannot start the pod due to node selector mismatch."
)
reason
:=
"NodeSelectorMismatching"
kl
.
recorder
.
Eventf
(
pod
,
reason
,
"Cannot start the pod due to node selector mismatch."
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
Phase
:
api
.
PodFailed
,
Phase
:
api
.
PodFailed
,
Reason
:
reason
,
Message
:
"Pod cannot be started due to node selector mismatch"
})
Message
:
"Pod cannot be started due to node selector mismatch"
})
}
}
fitting
,
notFitting
=
kl
.
checkCapacityExceeded
(
fitting
)
fitting
,
notFitting
=
kl
.
checkCapacityExceeded
(
fitting
)
for
_
,
pod
:=
range
notFitting
{
for
_
,
pod
:=
range
notFitting
{
kl
.
recorder
.
Eventf
(
pod
,
"capacityExceeded"
,
"Cannot start the pod due to exceeded capacity."
)
reason
:=
"CapacityExceeded"
kl
.
recorder
.
Eventf
(
pod
,
reason
,
"Cannot start the pod due to exceeded capacity."
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
kl
.
statusManager
.
SetPodStatus
(
pod
,
api
.
PodStatus
{
Phase
:
api
.
PodFailed
,
Phase
:
api
.
PodFailed
,
Reason
:
reason
,
Message
:
"Pod cannot be started due to exceeded capacity"
})
Message
:
"Pod cannot be started due to exceeded capacity"
})
}
}
return
fitting
return
fitting
...
@@ -2138,9 +2146,11 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
...
@@ -2138,9 +2146,11 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
// TODO: Consider include the container information.
// TODO: Consider include the container information.
if
kl
.
pastActiveDeadline
(
pod
)
{
if
kl
.
pastActiveDeadline
(
pod
)
{
kl
.
recorder
.
Eventf
(
pod
,
"deadline"
,
"Pod was active on the node longer than specified deadline"
)
reason
:=
"DeadlineExceeded"
kl
.
recorder
.
Eventf
(
pod
,
reason
,
"Pod was active on the node longer than specified deadline"
)
return
api
.
PodStatus
{
return
api
.
PodStatus
{
Phase
:
api
.
PodFailed
,
Phase
:
api
.
PodFailed
,
Reason
:
reason
,
Message
:
"Pod was active on the node longer than specified deadline"
},
nil
Message
:
"Pod was active on the node longer than specified deadline"
},
nil
}
}
...
@@ -2153,14 +2163,15 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
...
@@ -2153,14 +2163,15 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
if
strings
.
Contains
(
err
.
Error
(),
"resource temporarily unavailable"
)
{
if
strings
.
Contains
(
err
.
Error
(),
"resource temporarily unavailable"
)
{
// Leave upstream layer to decide what to do
// Leave upstream layer to decide what to do
return
api
.
PodStatus
{},
err
return
api
.
PodStatus
{},
err
}
else
{
}
pendingStatus
:=
api
.
PodStatus
{
pendingStatus
:=
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
Phase
:
api
.
PodPending
,
Reason
:
"GeneralError"
,
Message
:
fmt
.
Sprintf
(
"Query container info failed with error (%v)"
,
err
),
Message
:
fmt
.
Sprintf
(
"Query container info failed with error (%v)"
,
err
),
}
}
return
pendingStatus
,
nil
return
pendingStatus
,
nil
}
}
}
// Assume info is ready to process
// Assume info is ready to process
podStatus
.
Phase
=
GetPhase
(
spec
,
podStatus
.
ContainerStatuses
)
podStatus
.
Phase
=
GetPhase
(
spec
,
podStatus
.
ContainerStatuses
)
...
...
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