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
3de46950
Commit
3de46950
authored
Sep 12, 2016
by
d00369826
Committed by
m1093782566
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix petset update(pet) retries bug
Change-Id: I92e2b653ab78fca72ae41cf87945d90fbbc67f44
parent
a062d9fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
pet.go
pkg/controller/petset/pet.go
+12
-9
No files found.
pkg/controller/petset/pet.go
View file @
3de46950
...
...
@@ -197,23 +197,26 @@ func (p *apiServerPetClient) Create(pet *pcb) error {
}
// Update updates the pet in the 'pet' pcb to match the pet in the 'expectedPet' pcb.
// If the pod object of a pet which to be updated has been changed in server side, we
// will get the actual value and set pet identity before retries.
func
(
p
*
apiServerPetClient
)
Update
(
pet
*
pcb
,
expectedPet
*
pcb
)
(
updateErr
error
)
{
var
getErr
error
pc
:=
podClient
(
p
.
c
,
pet
.
parent
.
Namespace
)
pod
,
needsUpdate
,
err
:=
copyPetID
(
pet
,
expectedPet
)
if
err
!=
nil
||
!
needsUpdate
{
return
err
}
glog
.
Infof
(
"Resetting pet %v to match PetSet %v spec"
,
pod
.
Name
,
pet
.
parent
.
Name
)
for
i
,
p
:=
0
,
&
pod
;
;
i
++
{
_
,
updateErr
=
pc
.
Update
(
p
)
for
i
:=
0
;
;
i
++
{
updatePod
,
needsUpdate
,
err
:=
copyPetID
(
pet
,
expectedPet
)
if
err
!=
nil
||
!
needsUpdate
{
return
err
}
glog
.
Infof
(
"Resetting pet %v/%v to match PetSet %v spec"
,
pet
.
pod
.
Namespace
,
pet
.
pod
.
Name
,
pet
.
parent
.
Name
)
_
,
updateErr
=
pc
.
Update
(
&
updatePod
)
if
updateErr
==
nil
||
i
>=
updateRetries
{
return
updateErr
}
if
p
,
getErr
=
pc
.
Get
(
pod
.
Name
);
getErr
!=
nil
{
getPod
,
getErr
:=
pc
.
Get
(
updatePod
.
Name
)
if
getErr
!=
nil
{
return
getErr
}
pet
.
pod
=
getPod
}
}
...
...
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