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
c9beb5b3
Commit
c9beb5b3
authored
Sep 01, 2015
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the bug that rolling-update throws error when using generateName
parent
efdcd9f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
rolling_updater.go
pkg/kubectl/rolling_updater.go
+13
-3
No files found.
pkg/kubectl/rolling_updater.go
View file @
c9beb5b3
...
...
@@ -395,7 +395,7 @@ func (r *RollingUpdater) pollForReadyPods(interval, timeout time.Duration, oldRc
// Existing controllers are validated to ensure their sourceIdAnnotation
// matches sourceId; if there's a mismatch, an error is returned.
func
(
r
*
RollingUpdater
)
getOrCreateTargetControllerWithClient
(
controller
*
api
.
ReplicationController
,
sourceId
string
)
(
*
api
.
ReplicationController
,
bool
,
error
)
{
existing
,
err
:=
r
.
c
.
ReplicationControllers
(
controller
.
Namespace
)
.
Get
(
controller
.
Name
)
existing
Rc
,
err
:=
r
.
existingController
(
controller
)
if
err
!=
nil
{
if
!
errors
.
IsNotFound
(
err
)
{
// There was an error trying to find the controller; don't assume we
...
...
@@ -416,13 +416,23 @@ func (r *RollingUpdater) getOrCreateTargetControllerWithClient(controller *api.R
return
newRc
,
false
,
err
}
// Validate and use the existing controller.
annotations
:=
existing
.
Annotations
annotations
:=
existing
Rc
.
Annotations
source
:=
annotations
[
sourceIdAnnotation
]
_
,
ok
:=
annotations
[
desiredReplicasAnnotation
]
if
source
!=
sourceId
||
!
ok
{
return
nil
,
false
,
fmt
.
Errorf
(
"Missing/unexpected annotations for controller %s, expected %s : %s"
,
controller
.
Name
,
sourceId
,
annotations
)
}
return
existing
,
true
,
nil
return
existingRc
,
true
,
nil
}
// existingController verifies if the controller already exists
func
(
r
*
RollingUpdater
)
existingController
(
controller
*
api
.
ReplicationController
)
(
*
api
.
ReplicationController
,
error
)
{
// without rc name but generate name, there's no existing rc
if
len
(
controller
.
Name
)
==
0
&&
len
(
controller
.
GenerateName
)
>
0
{
return
nil
,
errors
.
NewNotFound
(
"ReplicationController"
,
controller
.
Name
)
}
// controller name is required to get rc back
return
r
.
c
.
ReplicationControllers
(
controller
.
Namespace
)
.
Get
(
controller
.
Name
)
}
// cleanupWithClients performs cleanup tasks after the rolling update. Update
...
...
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