-
Notifications
You must be signed in to change notification settings - Fork 820
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
If the user has specified cluster autoscaling behavior for their gameserver then don't overwrite it #2754
If the user has specified cluster autoscaling behavior for their gameserver then don't overwrite it #2754
Conversation
pkg/apis/agones/v1/gameserver.go
Outdated
pod.ObjectMeta.Annotations["cluster-autoscaler.kubernetes.io/safe-to-evict"] = "false" | ||
// (and evict the Pod in the process). Only set the value if it has not already | ||
// been configured in the pod template (to not override user specified behavior). | ||
if _, exists := pod.ObjectMeta.Annotations["cluster-autoscaler.kubernetes.io/safe-to-evict"]; !exists { |
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.
Should "cluster-autoscaler.kubernetes.io/safe-to-evict" be a const? Might make it a bit easier to read.
As a possible other simplification (suggesting a possible const):
if _, exists := pod.ObjectMeta.Annotations[safeToEvicAnnotation]; !exists && gs.Spec.Scheduling == apis.Packed {
pod.ObjectMeta.Annotations[safeToEvicAnnotation] = "false"
}
Make it one line? WDYT?
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 like that. I picked a name for the constant that was a bit longer but more closely matched the name used by the cluster autoscaler implementation (although they used "Key" instead of "Annotation" as the last part of their name which I found less descriptive).
Build Succeeded 👏 Build Id: e9390570-9b03-4c9a-9a3c-95858df11f11 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:
|
99c9a11
to
b4ef919
Compare
Build Succeeded 👏 Build Id: fd9af2f2-0507-4cea-bb19-c86f072c13d2 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: 6d9ea271-937d-458a-a3ba-0293a4fa8a86 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:
|
b4ef919
to
a754f31
Compare
gameplay by adding the annotation [`"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"`](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node) | ||
to the backing Pod. | ||
|
||
However, if a gameserver can tolerate being evicted (generally in combination with setting an appropriate graceful termination period |
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.
However, if a gameserver can tolerate being evicted (generally in combination with setting an appropriate graceful termination period | |
However, if a gameserver can tolerate [being evicted](https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/#how-api-initiated-eviction-works) (generally in combination with setting an appropriate graceful termination period |
Nit: Linking back to K8s documentation so that "eviction" is clear.
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.
good idea.
gameserver then don't overwrite it.
a754f31
to
cdccd6b
Compare
Build Succeeded 👏 Build Id: 4a32c280-fa71-4d7a-852a-ad0149c1effa 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 |
Build Succeeded 👏 Build Id: 2a2c0c73-586a-4ef5-84d3-9012f62e4a94 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:
|
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
This change allows the object metadata annotation that controls the cluster autoscaler behavior to be passed along through the pod template to the game server pod. Previously, the annotation was always set by Agones, which would override any attempt by a user to set this annotation.
This change allows game servers to mark themselves as being able to be preempted and removed by the cluster autoscaler, which allows the cluster autoscaler to compact nodes when there is space to downsize a cluster.
Which issue(s) this PR fixes:
Closes #2747
Special notes for your reviewer: