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
82dcc56f
Commit
82dcc56f
authored
Feb 23, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve log for debug
parent
ebcce18d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
deployment.go
pkg/util/deployment/deployment.go
+3
-3
util.go
test/e2e/util.go
+8
-8
No files found.
pkg/util/deployment/deployment.go
View file @
82dcc56f
...
@@ -187,13 +187,13 @@ func addHashKeyToRSAndPods(deployment extensions.Deployment, c clientset.Interfa
...
@@ -187,13 +187,13 @@ func addHashKeyToRSAndPods(deployment extensions.Deployment, c clientset.Interfa
updated
.
Spec
.
Template
.
Labels
=
labelsutil
.
AddLabel
(
updated
.
Spec
.
Template
.
Labels
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
updated
.
Spec
.
Template
.
Labels
=
labelsutil
.
AddLabel
(
updated
.
Spec
.
Template
.
Labels
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"error updating rs %s pod template label with template hash: %v"
,
updatedRS
.
Name
,
err
)
}
}
}
}
// Make sure rs pod template is updated so that it won't create pods without the new label (orphaned pods).
// Make sure rs pod template is updated so that it won't create pods without the new label (orphaned pods).
if
updatedRS
.
Generation
>
updatedRS
.
Status
.
ObservedGeneration
{
if
updatedRS
.
Generation
>
updatedRS
.
Status
.
ObservedGeneration
{
if
err
=
waitForReplicaSetUpdated
(
c
,
updatedRS
.
Generation
,
namespace
,
rs
.
Name
);
err
!=
nil
{
if
err
=
waitForReplicaSetUpdated
(
c
,
updatedRS
.
Generation
,
namespace
,
rs
.
Name
);
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"error waiting for rs %s generation %d observed by controller: %v"
,
updatedRS
.
Name
,
updatedRS
.
Generation
,
err
)
}
}
}
}
...
@@ -217,7 +217,7 @@ func addHashKeyToRSAndPods(deployment extensions.Deployment, c clientset.Interfa
...
@@ -217,7 +217,7 @@ func addHashKeyToRSAndPods(deployment extensions.Deployment, c clientset.Interfa
updated
.
Labels
=
labelsutil
.
AddLabel
(
updated
.
Labels
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
updated
.
Labels
=
labelsutil
.
AddLabel
(
updated
.
Labels
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
updated
.
Spec
.
Selector
=
labelsutil
.
AddLabelToSelector
(
updated
.
Spec
.
Selector
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
updated
.
Spec
.
Selector
=
labelsutil
.
AddLabelToSelector
(
updated
.
Spec
.
Selector
,
extensions
.
DefaultDeploymentUniqueLabelKey
,
hash
)
});
err
!=
nil
{
});
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"error updating rs %s label and selector with template hash: %v"
,
updatedRS
.
Name
,
err
)
}
}
// TODO: look for orphaned pods and label them in the background somewhere else periodically
// TODO: look for orphaned pods and label them in the background somewhere else periodically
...
...
test/e2e/util.go
View file @
82dcc56f
...
@@ -2117,7 +2117,7 @@ func waitForReplicaSetPodsGone(c *client.Client, rs *extensions.ReplicaSet) erro
...
@@ -2117,7 +2117,7 @@ func waitForReplicaSetPodsGone(c *client.Client, rs *extensions.ReplicaSet) erro
// 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
clientset
.
Interface
,
ns
,
deploymentName
string
,
desiredUpdatedReplicas
,
minAvailable
,
maxCreated
,
minReadySeconds
int
)
error
{
func
waitForDeploymentStatus
(
c
clientset
.
Interface
,
ns
,
deploymentName
string
,
desiredUpdatedReplicas
,
minAvailable
,
maxCreated
,
minReadySeconds
int
)
error
{
var
oldRSs
,
allRSs
[]
*
extensions
.
ReplicaSet
var
oldRSs
,
all
OldRSs
,
all
RSs
[]
*
extensions
.
ReplicaSet
var
newRS
*
extensions
.
ReplicaSet
var
newRS
*
extensions
.
ReplicaSet
var
deployment
*
extensions
.
Deployment
var
deployment
*
extensions
.
Deployment
err
:=
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
...
@@ -2127,7 +2127,7 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
...
@@ -2127,7 +2127,7 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
oldRSs
,
_
,
err
=
deploymentutil
.
GetOldReplicaSets
(
*
deployment
,
c
)
oldRSs
,
allOldRSs
,
err
=
deploymentutil
.
GetOldReplicaSets
(
*
deployment
,
c
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
...
@@ -2146,12 +2146,12 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
...
@@ -2146,12 +2146,12 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
return
false
,
err
return
false
,
err
}
}
if
totalCreated
>
maxCreated
{
if
totalCreated
>
maxCreated
{
logReplicaSetsOfDeployment
(
deployment
,
o
ldRSs
,
newRS
)
logReplicaSetsOfDeployment
(
deployment
,
allO
ldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
return
false
,
fmt
.
Errorf
(
"total pods created: %d, more than the max allowed: %d"
,
totalCreated
,
maxCreated
)
return
false
,
fmt
.
Errorf
(
"total pods created: %d, more than the max allowed: %d"
,
totalCreated
,
maxCreated
)
}
}
if
totalAvailable
<
minAvailable
{
if
totalAvailable
<
minAvailable
{
logReplicaSetsOfDeployment
(
deployment
,
o
ldRSs
,
newRS
)
logReplicaSetsOfDeployment
(
deployment
,
allO
ldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
return
false
,
fmt
.
Errorf
(
"total pods available: %d, less than the min required: %d"
,
totalAvailable
,
minAvailable
)
return
false
,
fmt
.
Errorf
(
"total pods available: %d, less than the min required: %d"
,
totalAvailable
,
minAvailable
)
}
}
...
@@ -2167,7 +2167,7 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
...
@@ -2167,7 +2167,7 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
})
})
if
err
==
wait
.
ErrWaitTimeout
{
if
err
==
wait
.
ErrWaitTimeout
{
logReplicaSetsOfDeployment
(
deployment
,
o
ldRSs
,
newRS
)
logReplicaSetsOfDeployment
(
deployment
,
allO
ldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
}
}
return
err
return
err
...
@@ -2215,10 +2215,10 @@ func waitForObservedDeployment(c *clientset.Clientset, ns, deploymentName string
...
@@ -2215,10 +2215,10 @@ func waitForObservedDeployment(c *clientset.Clientset, ns, deploymentName string
})
})
}
}
func
logReplicaSetsOfDeployment
(
deployment
*
extensions
.
Deployment
,
o
ldRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
)
{
func
logReplicaSetsOfDeployment
(
deployment
*
extensions
.
Deployment
,
allO
ldRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
)
{
Logf
(
"Deployment = %+v"
,
deployment
)
Logf
(
"Deployment = %+v"
,
deployment
)
for
i
:=
range
o
ldRSs
{
for
i
:=
range
allO
ldRSs
{
Logf
(
"
Old ReplicaSets (%d/%d) of deployment %s: %+v"
,
i
+
1
,
len
(
oldRSs
),
deployment
.
Name
,
o
ldRSs
[
i
])
Logf
(
"
All old ReplicaSets (%d/%d) of deployment %s: %+v"
,
i
+
1
,
len
(
allOldRSs
),
deployment
.
Name
,
allO
ldRSs
[
i
])
}
}
Logf
(
"New ReplicaSet of deployment %s: %+v"
,
deployment
.
Name
,
newRS
)
Logf
(
"New ReplicaSet of deployment %s: %+v"
,
deployment
.
Name
,
newRS
)
}
}
...
...
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