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
1987b985
Unverified
Commit
1987b985
authored
Sep 25, 2018
by
k8s-ci-robot
Committed by
GitHub
Sep 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68593 from seans3/condition-fix
Removes dependency on internal version of resource
parents
05f277c6
86b12106
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
66 deletions
+10
-66
BUILD
pkg/kubectl/BUILD
+0
-1
conditions.go
pkg/kubectl/conditions.go
+10
-65
No files found.
pkg/kubectl/BUILD
View file @
1987b985
...
@@ -113,7 +113,6 @@ go_library(
...
@@ -113,7 +113,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/kubectl",
importpath = "k8s.io/kubernetes/pkg/kubectl",
deps = [
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/api/legacyscheme:go_default_library",
"//pkg/api/pod:go_default_library",
"//pkg/api/v1/pod:go_default_library",
"//pkg/api/v1/pod:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/apis/core:go_default_library",
...
...
pkg/kubectl/conditions.go
View file @
1987b985
...
@@ -26,9 +26,6 @@ import (
...
@@ -26,9 +26,6 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
corev1client
"k8s.io/client-go/kubernetes/typed/core/v1"
corev1client
"k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/kubernetes/pkg/api/pod"
podv1
"k8s.io/kubernetes/pkg/api/v1/pod"
api
"k8s.io/kubernetes/pkg/apis/core"
)
)
// ControllerHasDesiredReplicas returns a condition that will be true if and only if
// ControllerHasDesiredReplicas returns a condition that will be true if and only if
...
@@ -56,36 +53,6 @@ func ControllerHasDesiredReplicas(rcClient corev1client.ReplicationControllersGe
...
@@ -56,36 +53,6 @@ func ControllerHasDesiredReplicas(rcClient corev1client.ReplicationControllersGe
// the pod has already reached completed state.
// the pod has already reached completed state.
var
ErrPodCompleted
=
fmt
.
Errorf
(
"pod ran to completion"
)
var
ErrPodCompleted
=
fmt
.
Errorf
(
"pod ran to completion"
)
// ErrContainerTerminated is returned by PodContainerRunning in the intermediate
// state where the pod indicates it's still running, but its container is already terminated
var
ErrContainerTerminated
=
fmt
.
Errorf
(
"container terminated"
)
// PodRunning returns true if the pod is running, false if the pod has not yet reached running state,
// returns ErrPodCompleted if the pod has run to completion, or an error in any other case.
func
PodRunning
(
event
watch
.
Event
)
(
bool
,
error
)
{
switch
event
.
Type
{
case
watch
.
Deleted
:
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
}
switch
t
:=
event
.
Object
.
(
type
)
{
case
*
api
.
Pod
:
switch
t
.
Status
.
Phase
{
case
api
.
PodRunning
:
return
true
,
nil
case
api
.
PodFailed
,
api
.
PodSucceeded
:
return
false
,
ErrPodCompleted
}
case
*
corev1
.
Pod
:
switch
t
.
Status
.
Phase
{
case
corev1
.
PodRunning
:
return
true
,
nil
case
corev1
.
PodFailed
,
corev1
.
PodSucceeded
:
return
false
,
ErrPodCompleted
}
}
return
false
,
nil
}
// PodCompleted returns true if the pod has run to completion, false if the pod has not yet
// PodCompleted returns true if the pod has run to completion, false if the pod has not yet
// reached running state, or an error in any other case.
// reached running state, or an error in any other case.
func
PodCompleted
(
event
watch
.
Event
)
(
bool
,
error
)
{
func
PodCompleted
(
event
watch
.
Event
)
(
bool
,
error
)
{
...
@@ -94,11 +61,6 @@ func PodCompleted(event watch.Event) (bool, error) {
...
@@ -94,11 +61,6 @@ func PodCompleted(event watch.Event) (bool, error) {
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
}
}
switch
t
:=
event
.
Object
.
(
type
)
{
switch
t
:=
event
.
Object
.
(
type
)
{
case
*
api
.
Pod
:
switch
t
.
Status
.
Phase
{
case
api
.
PodFailed
,
api
.
PodSucceeded
:
return
true
,
nil
}
case
*
corev1
.
Pod
:
case
*
corev1
.
Pod
:
switch
t
.
Status
.
Phase
{
switch
t
.
Status
.
Phase
{
case
corev1
.
PodFailed
,
corev1
.
PodSucceeded
:
case
corev1
.
PodFailed
,
corev1
.
PodSucceeded
:
...
@@ -117,38 +79,21 @@ func PodRunningAndReady(event watch.Event) (bool, error) {
...
@@ -117,38 +79,21 @@ func PodRunningAndReady(event watch.Event) (bool, error) {
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
}
}
switch
t
:=
event
.
Object
.
(
type
)
{
switch
t
:=
event
.
Object
.
(
type
)
{
case
*
api
.
Pod
:
switch
t
.
Status
.
Phase
{
case
api
.
PodFailed
,
api
.
PodSucceeded
:
return
false
,
ErrPodCompleted
case
api
.
PodRunning
:
return
pod
.
IsPodReady
(
t
),
nil
}
case
*
corev1
.
Pod
:
case
*
corev1
.
Pod
:
switch
t
.
Status
.
Phase
{
switch
t
.
Status
.
Phase
{
case
corev1
.
PodFailed
,
corev1
.
PodSucceeded
:
case
corev1
.
PodFailed
,
corev1
.
PodSucceeded
:
return
false
,
ErrPodCompleted
return
false
,
ErrPodCompleted
case
corev1
.
PodRunning
:
case
corev1
.
PodRunning
:
return
podv1
.
IsPodReady
(
t
),
nil
conditions
:=
t
.
Status
.
Conditions
}
if
conditions
==
nil
{
}
return
false
,
nil
return
false
,
nil
}
}
for
i
:=
range
conditions
{
if
conditions
[
i
]
.
Type
==
corev1
.
PodReady
&&
// PodNotPending returns true if the pod has left the pending state, false if it has not,
conditions
[
i
]
.
Status
==
corev1
.
ConditionTrue
{
// or an error in any other case (such as if the pod was deleted).
return
true
,
nil
func
PodNotPending
(
event
watch
.
Event
)
(
bool
,
error
)
{
}
switch
event
.
Type
{
}
case
watch
.
Deleted
:
return
false
,
errors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"pods"
},
""
)
}
switch
t
:=
event
.
Object
.
(
type
)
{
case
*
api
.
Pod
:
switch
t
.
Status
.
Phase
{
case
api
.
PodPending
:
return
false
,
nil
default
:
return
true
,
nil
}
}
}
}
return
false
,
nil
return
false
,
nil
...
...
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