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
b45afc04
Commit
b45afc04
authored
Jul 25, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use nonexistent image instead of minReadySeconds in deployment rollover e2e test
parent
8bc8cfd1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
deployment_util.go
pkg/controller/deployment/util/deployment_util.go
+1
-0
deployment.go
test/e2e/deployment.go
+3
-7
No files found.
pkg/controller/deployment/util/deployment_util.go
View file @
b45afc04
...
@@ -605,6 +605,7 @@ func countAvailablePods(pods []api.Pod, minReadySeconds int32) int32 {
...
@@ -605,6 +605,7 @@ func countAvailablePods(pods []api.Pod, minReadySeconds int32) int32 {
availablePodCount
:=
int32
(
0
)
availablePodCount
:=
int32
(
0
)
for
_
,
pod
:=
range
pods
{
for
_
,
pod
:=
range
pods
{
// TODO: Make the time.Now() as argument to allow unit test this.
// TODO: Make the time.Now() as argument to allow unit test this.
// FIXME: avoid using time.Now
if
IsPodAvailable
(
&
pod
,
minReadySeconds
,
time
.
Now
())
{
if
IsPodAvailable
(
&
pod
,
minReadySeconds
,
time
.
Now
())
{
glog
.
V
(
4
)
.
Infof
(
"Pod %s/%s is available."
,
pod
.
Namespace
,
pod
.
Name
)
glog
.
V
(
4
)
.
Infof
(
"Pod %s/%s is available."
,
pod
.
Namespace
,
pod
.
Name
)
availablePodCount
++
availablePodCount
++
...
...
test/e2e/deployment.go
View file @
b45afc04
...
@@ -86,6 +86,7 @@ var _ = framework.KubeDescribe("Deployment", func() {
...
@@ -86,6 +86,7 @@ var _ = framework.KubeDescribe("Deployment", func() {
It
(
"scaled rollout should not block on annotation check"
,
func
()
{
It
(
"scaled rollout should not block on annotation check"
,
func
()
{
testScaledRolloutDeployment
(
f
)
testScaledRolloutDeployment
(
f
)
})
})
// TODO: add tests that cover deployment.Spec.MinReadySeconds once we solved clock-skew issues
})
})
func
newRS
(
rsName
string
,
replicas
int32
,
rsPodLabels
map
[
string
]
string
,
imageName
string
,
image
string
)
*
extensions
.
ReplicaSet
{
func
newRS
(
rsName
string
,
replicas
int32
,
rsPodLabels
map
[
string
]
string
,
imageName
string
,
image
string
)
*
extensions
.
ReplicaSet
{
...
@@ -514,19 +515,15 @@ func testRolloverDeployment(f *framework.Framework) {
...
@@ -514,19 +515,15 @@ func testRolloverDeployment(f *framework.Framework) {
framework
.
Logf
(
"error in waiting for pods to come up: %s"
,
err
)
framework
.
Logf
(
"error in waiting for pods to come up: %s"
,
err
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
// Wait for the required pods to be ready for at least minReadySeconds (be available)
deploymentMinReadySeconds
:=
int32
(
5
)
err
=
framework
.
WaitForPodsReady
(
c
,
ns
,
podName
,
int
(
deploymentMinReadySeconds
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Create a deployment to delete nginx pods and instead bring up redis-slave pods.
// Create a deployment to delete nginx pods and instead bring up redis-slave pods.
// We use a nonexistent image here, so that we make sure it won't finish
deploymentName
,
deploymentImageName
:=
"test-rollover-deployment"
,
"redis-slave"
deploymentName
,
deploymentImageName
:=
"test-rollover-deployment"
,
"redis-slave"
deploymentReplicas
:=
int32
(
4
)
deploymentReplicas
:=
int32
(
4
)
deploymentImage
:=
"gcr.io/google_samples/gb-redisslave:
v1
"
deploymentImage
:=
"gcr.io/google_samples/gb-redisslave:
nonexistent
"
deploymentStrategyType
:=
extensions
.
RollingUpdateDeploymentStrategyType
deploymentStrategyType
:=
extensions
.
RollingUpdateDeploymentStrategyType
framework
.
Logf
(
"Creating deployment %s"
,
deploymentName
)
framework
.
Logf
(
"Creating deployment %s"
,
deploymentName
)
newDeployment
:=
newDeployment
(
deploymentName
,
deploymentReplicas
,
deploymentPodLabels
,
deploymentImageName
,
deploymentImage
,
deploymentStrategyType
,
nil
)
newDeployment
:=
newDeployment
(
deploymentName
,
deploymentReplicas
,
deploymentPodLabels
,
deploymentImageName
,
deploymentImage
,
deploymentStrategyType
,
nil
)
newDeployment
.
Spec
.
MinReadySeconds
=
deploymentMinReadySeconds
newDeployment
.
Spec
.
Strategy
.
RollingUpdate
=
&
extensions
.
RollingUpdateDeployment
{
newDeployment
.
Spec
.
Strategy
.
RollingUpdate
=
&
extensions
.
RollingUpdateDeployment
{
MaxUnavailable
:
intstr
.
FromInt
(
1
),
MaxUnavailable
:
intstr
.
FromInt
(
1
),
MaxSurge
:
intstr
.
FromInt
(
1
),
MaxSurge
:
intstr
.
FromInt
(
1
),
...
@@ -544,7 +541,6 @@ func testRolloverDeployment(f *framework.Framework) {
...
@@ -544,7 +541,6 @@ func testRolloverDeployment(f *framework.Framework) {
_
,
newRS
:=
checkDeploymentRevision
(
c
,
ns
,
deploymentName
,
"1"
,
deploymentImageName
,
deploymentImage
)
_
,
newRS
:=
checkDeploymentRevision
(
c
,
ns
,
deploymentName
,
"1"
,
deploymentImageName
,
deploymentImage
)
// Before the deployment finishes, update the deployment to rollover the above 2 ReplicaSets and bring up redis pods.
// Before the deployment finishes, update the deployment to rollover the above 2 ReplicaSets and bring up redis pods.
// If the deployment already finished here, the test would fail. When this happens, increase its minReadySeconds or replicas to prevent it.
Expect
(
newRS
.
Spec
.
Replicas
)
.
Should
(
BeNumerically
(
"<"
,
deploymentReplicas
))
Expect
(
newRS
.
Spec
.
Replicas
)
.
Should
(
BeNumerically
(
"<"
,
deploymentReplicas
))
updatedDeploymentImageName
,
updatedDeploymentImage
:=
redisImageName
,
redisImage
updatedDeploymentImageName
,
updatedDeploymentImage
:=
redisImageName
,
redisImage
deployment
,
err
=
framework
.
UpdateDeploymentWithRetries
(
c
,
ns
,
newDeployment
.
Name
,
func
(
update
*
extensions
.
Deployment
)
{
deployment
,
err
=
framework
.
UpdateDeploymentWithRetries
(
c
,
ns
,
newDeployment
.
Name
,
func
(
update
*
extensions
.
Deployment
)
{
...
...
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