Skip to content
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

Fix for scaling split allocated GameServerSets #3292

Merged
merged 3 commits into from
Aug 2, 2023

Conversation

markmandel
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking

/kind bug

/kind cleanup
/kind documentation
/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it:

Fixes bug wherein if a set of Allocations occurred across two or more GameServerSets that had yet to be deleted for a RollingUpdate (because of Allocated GameServers), and a scale down operation moved the Fleet replica count to below the current number of Allocated GameServers -- scaling back up would not move above the current number of Allocated GameServers.

Or to put it another way, the current Fleet update logic didn't consider old GameServerSets with Allocated GameServers but a 0 value for Spec.Replicas as a complete rollout when scaling back up, so the logic went back into rolling update logic, and it all went sideways.

This short circuits that scenario up front.

Which issue(s) this PR fixes:

Close #3287

Special notes for your reviewer:

Found a weird Unit Test in there while I was at it. Fixed it.

Fixes bug wherein if a set of Allocations occurred across two or
more GameServerSets that had yet to be deleted for a RollingUpdate
(because of Allocated GameServers), and a scale down operation moved
the Fleet replica count to below the current number of Allocated
GameServers -- scaling back up would not move above the current number
of Allocated GameServers.

Or to put it another way, the current Fleet update logic didn't consider
old GameServerSets with Allocated GameServers but a 0 value for
`Spec.Replicas` as a complete rollout when scaling back up, so the logic
went back into rolling update logic, and it all went sideways.

This short circuits that scenario up front.

Close googleforgames#3287
@markmandel markmandel added kind/bug These are bugs. area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc labels Jul 28, 2023
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 2b7f75c6-f4fa-4ac5-808b-0ab90a9d3b22

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Member Author

Weird errors on 1.27 generic, in and around:

agones.dev/agones/test/e2e/allocator.TestAllocatorAfterDeleteReplica.func2()
	/go/src/agones.dev/agones/test/e2e/allocator/pod_termination_test.go:98

Going to rerun and see if it's consistent.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: aa6c0174-57b7-475e-9096-986ca8a39e05

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gongmax, markmandel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link

New changes are detected. LGTM label has been removed.

@google-oss-prow google-oss-prow bot removed the lgtm label Aug 1, 2023
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: baacce9a-28c2-4dc3-a31f-6359ecbce317

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Member Author

It's still the:

--- FAIL: TestAllocatorAllocateOnGameServerUpdateError (6.53s)
    allocator_test.go:508: 
        	Error Trace:	/go/src/agones.dev/agones/pkg/gameserverallocations/allocator_test.go:508
        	Error:      	Expected nil, but got: &v1.GameServerAllocation{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"gsa-1", GenerateName:"", Namespace:"default", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:v1.GameServerAllocationSpec{MultiClusterSetting:v1.MultiClusterSetting{Enabled:false, PolicySelector:v1.LabelSelector{MatchLabels:map[string]string(nil), MatchExpressions:[]v1.LabelSelectorRequirement(nil)}}, Required:v1.GameServerSelector{LabelSelector:v1.LabelSelector{MatchLabels:map[string]string(nil), MatchExpressions:[]v1.LabelSelectorRequirement(nil)}, GameServerState:(*v1.GameServerState)(0xc0019222c0), Players:(*v1.PlayerSelector)(nil), Counters:map[string]v1.CounterSelector(nil), Lists:map[string]v1.ListSelector(nil)}, Preferred:[]v1.GameServerSelector(nil), Priorities:[]v1.Priority(nil), Selectors:[]v1.GameServerSelector{v1.GameServerSelector{LabelSelector:v1.LabelSelector{MatchLabels:map[string]string(nil), MatchExpressions:[]v1.LabelSelectorRequirement(nil)}, GameServerState:(*v1.GameServerState)(0xc0019222d0), Players:(*v1.PlayerSelector)(nil), Counters:map[string]v1.CounterSelector(nil), Lists:map[string]v1.ListSelector(nil)}}, Scheduling:"Packed", MetaPatch:v1.MetaPatch{Labels:map[string]string(nil), Annotations:map[string]string(nil)}, Counters:map[string]v1.CounterAction(nil), Lists:map[string]v1.ListAction(nil)}, Status:v1.GameServerAllocationStatus{State:"UnAllocated", GameServerName:"", Ports:[]v1.GameServerStatusPort(nil), Address:"", NodeName:"", Source:"", Metadata:(*v1.GameServerMetadata)(nil)}}
        	Test:       	TestAllocatorAllocateOnGameServerUpdateError

I think I'm going to lose the plot here.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: ea6bfebd-63d3-45cf-9d63-56c8461e8c38

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel markmandel enabled auto-merge (squash) August 2, 2023 00:36
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 5bfc0b1d-09e7-46e1-9c42-cd584ebe2575

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/3292/head:pr_3292 && git checkout pr_3292
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.34.0-dev-ea1b999-amd64

@markmandel markmandel merged commit 59940a1 into googleforgames:main Aug 2, 2023
2 checks passed
@markmandel markmandel deleted the bug/fleet-scaling-alloc branch August 2, 2023 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/bug These are bugs. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to scale fleet after an update when there are allocated game servers from both old and new version
3 participants