-
Notifications
You must be signed in to change notification settings - Fork 826
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
GSA: Switch LabelSelector to GameServerSelector #2166
GSA: Switch LabelSelector to GameServerSelector #2166
Conversation
Build Failed 😱 Build Id: 743c8ce7-cb7d-4f61-9d8f-0e721e04a6d8 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
31a1736
to
2e82bdf
Compare
Build Succeeded 👏 Build Id: a833e522-8f50-41d9-bc9e-493784c31cd1 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:
|
This is a large PR... I'll try to get to it before the weekend. |
@@ -64,7 +64,7 @@ func ConvertAllocationRequestToGSA(in *pb.AllocationRequest) *allocationv1.GameS | |||
} | |||
|
|||
if ls := convertLabelSelectorToInternalLabelSelector(in.GetRequiredGameServerSelector()); ls != nil { | |||
gsa.Spec.Required = *ls | |||
gsa.Spec.Required = allocationv1.GameServerSelector{LabelSelector: *ls} |
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.
This code will get updates once again once the proto changes, but this allows current functionality to continue working as expected.
@@ -144,5 +265,10 @@ func (gsa *GameServerAllocation) Validate() ([]metav1.StatusCause, bool) { | |||
Message: fmt.Sprintf("Invalid value: %s, value must be either Packed or Distributed", gsa.Spec.Scheduling)}) | |||
} | |||
|
|||
causes, _ = gsa.Spec.Required.Validate("spec.required", causes) |
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.
This will overwrite causes if it's non empty. Both here and below you need to append to causes (like is done on line 263).
(update: re-reading the validate function, I can see why this works, but it's really confusing to read. I think it's simpler to have validate not take causes and have this function do the appending).
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 agree! I will make this change! Same as comment below 👍🏻
MatchLabels: map[string]string{ | ||
"g": "h", | ||
}, | ||
}}, |
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.
What about adding conversion tests for the new fields?
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.
Coming soon to a theatre near you! But once the allocation proto changes are in, because there's nothing to convert things to otherwise.
This embeds the LabelSelector into a GameServerSelector struct, along with the new player and state selector features we need for advanced allocation, and utilising it in the `preferred` and `required` sections of a `GameServerAllocation`. This means the CRD doesn't change, but the Go api surface does. This also moves the logic of validation and selection matching into the GameServerSelector so it can be more easily reused. GameServerAllocations are used pretty much everywhere, so a good chunk of the PR is making that api change. Work on googleforgames#1239
2e82bdf
to
4bce072
Compare
Updated. I'm 50/50 on whether this should be included in this RC or not 🤔 Do we give some end users some pain now in preparation, or wait until the feature is ready to go? |
Build Succeeded 👏 Build Id: 6b522700-32b2-46b9-9452-43189d92aa35 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:
|
Build Succeeded 👏 Build Id: 0f87c2dc-0f98-4f16-b89b-ceab150797c4 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:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markmandel, roberthbailey 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 |
What type of PR is this?
/kind feature
What this PR does / Why we need it:
This embeds the LabelSelector into a GameServerSelector struct, along with the new player and state selector features we need for advanced allocation, and utilising it in the
preferred
andrequired
sections of aGameServerAllocation
.This means the CRD doesn't change, but the Go api surface does.
This also moves the logic of validation and selection matching into the GameServerSelector so it can be more easily reused.
GameServerAllocations are used pretty much everywhere, so a good chunk of the PR is making that api change.
Which issue(s) this PR fixes:
Work on #1239
Special notes for your reviewer:
Sorry for the chunky PR.