-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fleet update strategy: Replace #199
Fleet update strategy: Replace #199
Conversation
bc820a0
to
a3eec8b
Compare
Build Failed 😱 Build Id: 03705ece-f3ca-4033-8039-af427c17c88d Build Logs
|
Build Failed 😱 Build Id: 97f15f10-ed60-492d-b963-057fe19878ef Build Logs
|
e463233
to
980ad2d
Compare
Build Succeeded 👏 Build Id: 7964e4de-35f8-4011-a62c-aa15b13bddda The following development artifacts have been built, and will exist for the next 30 days:
|
docs/create_fleet.md
Outdated
We can also change the configuration of the `GameServer` of the running `Fleet`, and have the changes | ||
roll out, without interrupting the currently `Allocated` `GameServers`. | ||
|
||
Let's take this for a spin! Run `kubectl edit fleet simple-udp` and set the `repicas` field to back to `5`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: replicas
field back to 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -173,39 +224,102 @@ func (c *Controller) syncFleet(key string) error { | |||
return err | |||
} | |||
|
|||
var activeGsSet *stablev1alpha1.GameServerSet | |||
activeGsSet, rest := c.filterGameServerSetByActive(fleet, list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to make sure I understand this piece of code. This method returns the active gameserver set a a list of previous one. We then go on to set the replicas count to 0 on those and then deleting them. What happens if one of those replicas was allocated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent question - any previously Allocated
GameServers
that part of the "inactive" GameServerSet
are left alone, and the GameServerSet
will stay alive until the Allocated
GameServer
shuts itself down or is otherwise terminated.
For reference you can see the code for scaling down GameServerSet
here, and how it ignores Allocated
GameServers
.
For a live demo, you can actually see it in action on this twitch video (only live for 13 more days, will push to YouTube at some point today).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an interesting note - this is why deleteEmptyGameServerSets
(code) only deletes a GameServerSet
when the gsSet.Status.Replicas == 0
- because this will never be 0 when there are still Allocated
GameServers
.
0324093
to
833eb56
Compare
Build Succeeded 👏 Build Id: 6ab82750-e6a4-46d5-b2b3-ab6f9a1c4392 The following development artifacts have been built, and will exist for the next 30 days:
|
@enocom see anything that needs improvement in my Go code? 😄 |
833eb56
to
1533a4e
Compare
Build Succeeded 👏 Build Id: 5ba15b9c-2f8f-47a7-808f-6455efac4c7e The following development artifacts have been built, and will exist for the next 30 days:
|
pkg/fleets/controller.go
Outdated
if err != nil { | ||
return errors.Wrapf(err, "error creating gameserverset for fleet %s", fleet.ObjectMeta.Name) | ||
} | ||
|
||
c.recorder.Eventf(fleet, corev1.EventTypeNormal, "CreatingGameServerSet", | ||
"Created GameServerSet %s", activeGsSet.ObjectMeta.Name) | ||
"Created GameServerSet %s", gsSet.ObjectMeta.Name) | ||
} else if replicas != gsSet.Spec.Replicas { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than use an else if
statement here, you could add a return nil
to the if
block above, and a return nil
to the else if
block. That way the control flow is easier to follow and more idiomatic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. That should be better. Definitely seems more readable 👍
When the template for a Fleet is edited, a deployment strategy can be defined. At the moment, this is just the `Replace` strategy, which terminates all current non-allocated GameServers and immeadiately starts up new GameServers to replace them. Includes documentation as well.
1533a4e
to
5fa785c
Compare
Build Succeeded 👏 Build Id: 7896b68f-b00f-47f0-9620-fe7a98f3c73f The following development artifacts have been built, and will exist for the next 30 days:
|
Build Succeeded 👏 Build Id: 64432286-bef7-4463-9b9c-8554ca97fb43 The following development artifacts have been built, and will exist for the next 30 days:
|
@enocom @EricFortin gentle bump 😄 Please let me know if there is anything else to change, otherwise, would love an approval 😊 Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Build Succeeded 👏 Build Id: 1cdf188e-ff09-476e-bf7b-73cec6ad2193 The following development artifacts have been built, and will exist for the next 30 days:
|
Build Failed 😱 Build Id: 5eff556d-6af2-4565-a768-0e8845b7d20c Build Logs
|
When the template for a Fleet is edited, a deployment strategy can be defined. At the moment, this is just the
Replace
strategy, which terminates all current non-allocated GameServers and immediately starts up new GameServers to replace them.Includes documentation as well.