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
f4cb2397
Commit
f4cb2397
authored
Oct 06, 2015
by
Janet Kuo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15044 from nikhiljindal/deploymentController
Enabling deployments on kubernernetes-upgrade-gce test suite
parents
123a5bd4
c062afc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
13 deletions
+25
-13
e2e.sh
hack/jenkins/e2e.sh
+1
-0
deployment.go
test/e2e/deployment.go
+23
-12
util.go
test/e2e/util.go
+1
-1
No files found.
hack/jenkins/e2e.sh
View file @
f4cb2397
...
@@ -599,6 +599,7 @@ case ${JOB_NAME} in
...
@@ -599,6 +599,7 @@ case ${JOB_NAME} in
:
${
E2E_UP
:
=
"true"
}
:
${
E2E_UP
:
=
"true"
}
:
${
E2E_TEST
:
=
"false"
}
:
${
E2E_TEST
:
=
"false"
}
:
${
E2E_DOWN
:
=
"false"
}
:
${
E2E_DOWN
:
=
"false"
}
:
${
ENABLE_DEPLOYMENTS
:
=true
}
NUM_MINIONS
=
3
NUM_MINIONS
=
3
;;
;;
...
...
test/e2e/deployment.go
View file @
f4cb2397
...
@@ -95,7 +95,12 @@ func testRollingUpdateDeployment(f *Framework) {
...
@@ -95,7 +95,12 @@ func testRollingUpdateDeployment(f *Framework) {
ns
:=
f
.
Namespace
.
Name
ns
:=
f
.
Namespace
.
Name
c
:=
f
.
Client
c
:=
f
.
Client
// Create nginx pods.
// Create nginx pods.
podLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
}
deploymentPodLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
}
rcPodLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
,
"pod"
:
"nginx"
,
}
rcName
:=
"nginx-controller"
rcName
:=
"nginx-controller"
_
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Create
(
&
api
.
ReplicationController
{
_
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Create
(
&
api
.
ReplicationController
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -103,10 +108,10 @@ func testRollingUpdateDeployment(f *Framework) {
...
@@ -103,10 +108,10 @@ func testRollingUpdateDeployment(f *Framework) {
},
},
Spec
:
api
.
ReplicationControllerSpec
{
Spec
:
api
.
ReplicationControllerSpec
{
Replicas
:
3
,
Replicas
:
3
,
Selector
:
p
odLabels
,
Selector
:
rcP
odLabels
,
Template
:
&
api
.
PodTemplateSpec
{
Template
:
&
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
p
odLabels
,
Labels
:
rcP
odLabels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
...
@@ -140,11 +145,11 @@ func testRollingUpdateDeployment(f *Framework) {
...
@@ -140,11 +145,11 @@ func testRollingUpdateDeployment(f *Framework) {
},
},
Spec
:
experimental
.
DeploymentSpec
{
Spec
:
experimental
.
DeploymentSpec
{
Replicas
:
3
,
Replicas
:
3
,
Selector
:
p
odLabels
,
Selector
:
deploymentP
odLabels
,
UniqueLabelKey
:
"deployment.kubernetes.io/podTemplateHash"
,
UniqueLabelKey
:
"deployment.kubernetes.io/podTemplateHash"
,
Template
:
&
api
.
PodTemplateSpec
{
Template
:
&
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
p
odLabels
,
Labels
:
deploymentP
odLabels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
...
@@ -164,14 +169,19 @@ func testRollingUpdateDeployment(f *Framework) {
...
@@ -164,14 +169,19 @@ func testRollingUpdateDeployment(f *Framework) {
Expect
(
c
.
Deployments
(
ns
)
.
Delete
(
deploymentName
,
nil
))
.
NotTo
(
HaveOccurred
())
Expect
(
c
.
Deployments
(
ns
)
.
Delete
(
deploymentName
,
nil
))
.
NotTo
(
HaveOccurred
())
}()
}()
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
3
,
2
,
4
)
err
=
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
3
,
2
,
4
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
func
testRollingUpdateDeploymentEvents
(
f
*
Framework
)
{
func
testRollingUpdateDeploymentEvents
(
f
*
Framework
)
{
ns
:=
f
.
Namespace
.
Name
ns
:=
f
.
Namespace
.
Name
c
:=
f
.
Client
c
:=
f
.
Client
// Create nginx pods.
// Create nginx pods.
podLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
}
deploymentPodLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
}
rcPodLabels
:=
map
[
string
]
string
{
"name"
:
"sample-pod"
,
"pod"
:
"nginx"
,
}
rcName
:=
"nginx-controller"
rcName
:=
"nginx-controller"
_
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Create
(
&
api
.
ReplicationController
{
_
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Create
(
&
api
.
ReplicationController
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -179,10 +189,10 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
...
@@ -179,10 +189,10 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
},
},
Spec
:
api
.
ReplicationControllerSpec
{
Spec
:
api
.
ReplicationControllerSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
p
odLabels
,
Selector
:
rcP
odLabels
,
Template
:
&
api
.
PodTemplateSpec
{
Template
:
&
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
p
odLabels
,
Labels
:
rcP
odLabels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
...
@@ -216,11 +226,11 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
...
@@ -216,11 +226,11 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
},
},
Spec
:
experimental
.
DeploymentSpec
{
Spec
:
experimental
.
DeploymentSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
p
odLabels
,
Selector
:
deploymentP
odLabels
,
UniqueLabelKey
:
"deployment.kubernetes.io/podTemplateHash"
,
UniqueLabelKey
:
"deployment.kubernetes.io/podTemplateHash"
,
Template
:
&
api
.
PodTemplateSpec
{
Template
:
&
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
p
odLabels
,
Labels
:
deploymentP
odLabels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
...
@@ -240,7 +250,8 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
...
@@ -240,7 +250,8 @@ func testRollingUpdateDeploymentEvents(f *Framework) {
Expect
(
c
.
Deployments
(
ns
)
.
Delete
(
deploymentName
,
nil
))
.
NotTo
(
HaveOccurred
())
Expect
(
c
.
Deployments
(
ns
)
.
Delete
(
deploymentName
,
nil
))
.
NotTo
(
HaveOccurred
())
}()
}()
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
1
,
0
,
2
)
err
=
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
1
,
0
,
2
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Verify that the pods were scaled up and down as expected. We use events to verify that.
// Verify that the pods were scaled up and down as expected. We use events to verify that.
deployment
,
err
:=
c
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
deployment
,
err
:=
c
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
...
test/e2e/util.go
View file @
f4cb2397
...
@@ -1580,7 +1580,7 @@ func waitForRCPodsGone(c *client.Client, rc *api.ReplicationController) error {
...
@@ -1580,7 +1580,7 @@ func waitForRCPodsGone(c *client.Client, rc *api.ReplicationController) error {
// Waits for the deployment to reach desired state.
// Waits for the deployment to reach desired state.
// Returns an error if minAvailable or maxCreated is broken at any times.
// Returns an error if minAvailable or maxCreated is broken at any times.
func
waitForDeploymentStatus
(
c
*
client
.
Client
,
ns
,
deploymentName
string
,
desiredUpdatedReplicas
,
minAvailable
,
maxCreated
int
)
error
{
func
waitForDeploymentStatus
(
c
*
client
.
Client
,
ns
,
deploymentName
string
,
desiredUpdatedReplicas
,
minAvailable
,
maxCreated
int
)
error
{
return
wait
.
Poll
(
poll
,
2
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
return
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
deployment
,
err
:=
c
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
deployment
,
err
:=
c
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
if
err
!=
nil
{
if
err
!=
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