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
9a4171c9
Commit
9a4171c9
authored
Feb 29, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22202 from janetkuo/fix-rollback-flake
Auto commit by PR queue bot
parents
c9bd9e9c
50d43ef6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
17 deletions
+56
-17
deployment.go
test/e2e/deployment.go
+0
-0
util.go
test/e2e/util.go
+56
-17
No files found.
test/e2e/deployment.go
View file @
9a4171c9
This diff is collapsed.
Click to expand it.
test/e2e/util.go
View file @
9a4171c9
...
...
@@ -2296,7 +2296,62 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
logReplicaSetsOfDeployment
(
deployment
,
allOldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
}
return
err
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error waiting for deployment %s status to match expectation: %v"
,
deploymentName
,
err
)
}
return
nil
}
// waitForDeploymentRollbackCleared waits for given deployment either started rolling back or doesn't need to rollback.
// Note that rollback should be cleared shortly, so we only wait for 1 minute here to fail early.
func
waitForDeploymentRollbackCleared
(
c
clientset
.
Interface
,
ns
,
deploymentName
string
)
error
{
err
:=
wait
.
Poll
(
poll
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
deployment
,
err
:=
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
if
err
!=
nil
{
return
false
,
err
}
// Rollback not set or is kicked off
if
deployment
.
Spec
.
RollbackTo
==
nil
{
return
true
,
nil
}
return
false
,
nil
})
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error waiting for deployment %s rollbackTo to be cleared: %v"
,
deploymentName
,
err
)
}
return
nil
}
// waitForDeploymentRevisionAndImage waits for the deployment's and its new RS's revision and container image to match the given revision and image.
// Note that deployment revision and its new RS revision should be updated shortly, so we only wait for 1 minute here to fail early.
func
waitForDeploymentRevisionAndImage
(
c
clientset
.
Interface
,
ns
,
deploymentName
string
,
revision
,
image
string
)
error
{
var
deployment
*
extensions
.
Deployment
var
newRS
*
extensions
.
ReplicaSet
err
:=
wait
.
Poll
(
poll
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
var
err
error
deployment
,
err
=
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
if
err
!=
nil
{
return
false
,
err
}
newRS
,
err
=
deploymentutil
.
GetNewReplicaSet
(
deployment
,
c
)
if
err
!=
nil
{
return
false
,
err
}
// Check revision of this deployment, and of the new replica set of this deployment
if
deployment
.
Annotations
==
nil
||
deployment
.
Annotations
[
deploymentutil
.
RevisionAnnotation
]
!=
revision
||
newRS
.
Annotations
==
nil
||
newRS
.
Annotations
[
deploymentutil
.
RevisionAnnotation
]
!=
revision
||
deployment
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
!=
image
||
newRS
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
!=
image
{
return
false
,
nil
}
return
true
,
nil
})
if
err
==
wait
.
ErrWaitTimeout
{
logReplicaSetsOfDeployment
(
deployment
,
nil
,
newRS
)
}
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error waiting for deployment %s revision and image to match expectation: %v"
,
deploymentName
,
err
)
}
return
nil
}
func
waitForPodsReady
(
c
*
clientset
.
Clientset
,
ns
,
name
string
,
minReadySeconds
int
)
error
{
...
...
@@ -2390,22 +2445,6 @@ func waitForPartialEvents(c *client.Client, ns string, objOrRef runtime.Object,
})
}
// waitForRollbackDone waits for the given deployment finishes rollback.
func
waitForRollbackDone
(
c
*
clientset
.
Clientset
,
deployment
*
extensions
.
Deployment
)
(
err
error
)
{
deployments
:=
c
.
Extensions
()
.
Deployments
(
deployment
.
Namespace
)
name
:=
deployment
.
Name
return
wait
.
Poll
(
10
*
time
.
Millisecond
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
if
deployment
,
err
=
deployments
.
Get
(
name
);
err
!=
nil
{
return
false
,
err
}
// When deployment's RollbackTo is empty, the rollback is done.
if
deployment
.
Spec
.
RollbackTo
==
nil
{
return
true
,
nil
}
return
false
,
nil
})
}
type
updateDeploymentFunc
func
(
d
*
extensions
.
Deployment
)
func
updateDeploymentWithRetries
(
c
*
clientset
.
Clientset
,
namespace
,
name
string
,
applyUpdate
updateDeploymentFunc
)
(
deployment
*
extensions
.
Deployment
,
err
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