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
8c60068b
Commit
8c60068b
authored
Feb 25, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21794 from caesarxuchao/fix-19715
Auto commit by PR queue bot
parents
307ec46b
3efd3c62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
stop.go
pkg/kubectl/stop.go
+5
-4
job.go
test/e2e/job.go
+1
-1
kubectl.go
test/e2e/kubectl.go
+3
-3
No files found.
pkg/kubectl/stop.go
View file @
8c60068b
...
...
@@ -42,7 +42,8 @@ const (
// A Reaper handles terminating an object as gracefully as possible.
// timeout is how long we'll wait for the termination to be successful
// gracePeriod is time given to an API object for it to delete itself cleanly (e.g. pod shutdown)
// gracePeriod is time given to an API object for it to delete itself cleanly,
// e.g., pod shutdown. It may or may not be supported by the API object.
type
Reaper
interface
{
Stop
(
namespace
,
name
string
,
timeout
time
.
Duration
,
gracePeriod
*
api
.
DeleteOptions
)
error
}
...
...
@@ -272,7 +273,7 @@ func (reaper *ReplicaSetReaper) Stop(namespace, name string, timeout time.Durati
}
}
if
err
:=
rsc
.
Delete
(
name
,
gracePeriod
);
err
!=
nil
{
if
err
:=
rsc
.
Delete
(
name
,
nil
);
err
!=
nil
{
return
err
}
return
nil
...
...
@@ -355,7 +356,7 @@ func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gra
return
utilerrors
.
NewAggregate
(
errList
)
}
// once we have all the pods removed we can safely remove the job itself
return
jobs
.
Delete
(
name
,
gracePeriod
)
return
jobs
.
Delete
(
name
,
nil
)
}
func
(
reaper
*
DeploymentReaper
)
Stop
(
namespace
,
name
string
,
timeout
time
.
Duration
,
gracePeriod
*
api
.
DeleteOptions
)
error
{
...
...
@@ -406,7 +407,7 @@ func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Durati
// Delete deployment at the end.
// Note: We delete deployment at the end so that if removing RSs fails, we atleast have the deployment to retry.
return
deployments
.
Delete
(
name
,
gracePeriod
)
return
deployments
.
Delete
(
name
,
nil
)
}
type
updateDeploymentFunc
func
(
d
*
extensions
.
Deployment
)
...
...
test/e2e/job.go
View file @
8c60068b
...
...
@@ -264,7 +264,7 @@ func createJob(c *client.Client, ns string, job *extensions.Job) (*extensions.Jo
}
func
deleteJob
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
return
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
name
,
api
.
NewDeleteOptions
(
0
)
)
return
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
name
,
nil
)
}
// Wait for all pods to become Running. Only use when pods will run for a long time, or it will be racy.
...
...
test/e2e/kubectl.go
View file @
8c60068b
...
...
@@ -448,7 +448,7 @@ var _ = Describe("Kubectl client", func() {
execOrDie
()
Expect
(
runOutput
)
.
To
(
ContainSubstring
(
"abcd1234"
))
Expect
(
runOutput
)
.
To
(
ContainSubstring
(
"stdin closed"
))
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test"
,
api
.
NewDeleteOptions
(
0
)
))
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test"
,
nil
))
.
To
(
BeNil
())
By
(
"executing a command with run and attach without stdin"
)
runOutput
=
newKubectlCommand
(
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"run"
,
"run-test-2"
,
"--image=busybox"
,
"--restart=Never"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
...
...
@@ -456,7 +456,7 @@ var _ = Describe("Kubectl client", func() {
execOrDie
()
Expect
(
runOutput
)
.
ToNot
(
ContainSubstring
(
"abcd1234"
))
Expect
(
runOutput
)
.
To
(
ContainSubstring
(
"stdin closed"
))
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-2"
,
api
.
NewDeleteOptions
(
0
)
))
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-2"
,
nil
))
.
To
(
BeNil
())
By
(
"executing a command with run and attach with stdin with open stdin should remain running"
)
runOutput
=
newKubectlCommand
(
nsFlag
,
"run"
,
"run-test-3"
,
"--image=busybox"
,
"--restart=Never"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
...
...
@@ -486,7 +486,7 @@ var _ = Describe("Kubectl client", func() {
}
Expect
(
err
)
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-3"
,
api
.
NewDeleteOptions
(
0
)
))
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-3"
,
nil
))
.
To
(
BeNil
())
})
It
(
"should support port-forward"
,
func
()
{
...
...
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