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
7d31b44b
Commit
7d31b44b
authored
Dec 20, 2017
by
tianshapjq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup useless functions and variables
parent
3e78c490
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
86 deletions
+0
-86
BUILD
pkg/client/conditions/BUILD
+0
-1
conditions.go
pkg/client/conditions/conditions.go
+0
-85
No files found.
pkg/client/conditions/BUILD
View file @
7d31b44b
...
@@ -10,7 +10,6 @@ go_library(
...
@@ -10,7 +10,6 @@ go_library(
srcs = ["conditions.go"],
srcs = ["conditions.go"],
importpath = "k8s.io/kubernetes/pkg/client/conditions",
importpath = "k8s.io/kubernetes/pkg/client/conditions",
deps = [
deps = [
"//pkg/api/v1/pod:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
...
...
pkg/client/conditions/conditions.go
View file @
7d31b44b
...
@@ -23,17 +23,12 @@ import (
...
@@ -23,17 +23,12 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
podutil
"k8s.io/kubernetes/pkg/api/v1/pod"
)
)
// ErrPodCompleted is returned by PodRunning or PodContainerRunning to indicate that
// ErrPodCompleted is returned by PodRunning or PodContainerRunning to indicate that
// 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,
// 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.
// returns ErrPodCompleted if the pod has run to completion, or an error in any other case.
func
PodRunning
(
event
watch
.
Event
)
(
bool
,
error
)
{
func
PodRunning
(
event
watch
.
Event
)
(
bool
,
error
)
{
...
@@ -70,86 +65,6 @@ func PodCompleted(event watch.Event) (bool, error) {
...
@@ -70,86 +65,6 @@ func PodCompleted(event watch.Event) (bool, error) {
return
false
,
nil
return
false
,
nil
}
}
// PodRunningAndReady returns true if the pod is running and ready, false if the pod has not
// yet reached those states, returns ErrPodCompleted if the pod has run to completion, or
// an error in any other case.
func
PodRunningAndReady
(
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
*
v1
.
Pod
:
switch
t
.
Status
.
Phase
{
case
v1
.
PodFailed
,
v1
.
PodSucceeded
:
return
false
,
ErrPodCompleted
case
v1
.
PodRunning
:
return
podutil
.
IsPodReady
(
t
),
nil
}
}
return
false
,
nil
}
// PodNotPending returns true if the pod has left the pending state, false if it has not,
// or an error in any other case (such as if the pod was deleted).
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
*
v1
.
Pod
:
switch
t
.
Status
.
Phase
{
case
v1
.
PodPending
:
return
false
,
nil
default
:
return
true
,
nil
}
}
return
false
,
nil
}
// PodContainerRunning returns false until the named container has ContainerStatus running (at least once),
// and will return an error if the pod is deleted, runs to completion, or the container pod is not available.
func
PodContainerRunning
(
containerName
string
)
watch
.
ConditionFunc
{
return
func
(
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
*
v1
.
Pod
:
switch
t
.
Status
.
Phase
{
case
v1
.
PodRunning
,
v1
.
PodPending
:
case
v1
.
PodFailed
,
v1
.
PodSucceeded
:
return
false
,
ErrPodCompleted
default
:
return
false
,
nil
}
for
_
,
s
:=
range
t
.
Status
.
ContainerStatuses
{
if
s
.
Name
!=
containerName
{
continue
}
if
s
.
State
.
Terminated
!=
nil
{
return
false
,
ErrContainerTerminated
}
return
s
.
State
.
Running
!=
nil
,
nil
}
for
_
,
s
:=
range
t
.
Status
.
InitContainerStatuses
{
if
s
.
Name
!=
containerName
{
continue
}
if
s
.
State
.
Terminated
!=
nil
{
return
false
,
ErrContainerTerminated
}
return
s
.
State
.
Running
!=
nil
,
nil
}
return
false
,
nil
}
return
false
,
nil
}
}
// ServiceAccountHasSecrets returns true if the service account has at least one secret,
// ServiceAccountHasSecrets returns true if the service account has at least one secret,
// false if it does not, or an error.
// false if it does not, or an error.
func
ServiceAccountHasSecrets
(
event
watch
.
Event
)
(
bool
,
error
)
{
func
ServiceAccountHasSecrets
(
event
watch
.
Event
)
(
bool
,
error
)
{
...
...
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