-
Notifications
You must be signed in to change notification settings - Fork 825
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
Add Sigterm handler and readiness probe to extensions #3011
Conversation
Build Failed 😱 Build Id: 64d98169-fe02-486f-993e-eafbdd654a9a To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 23f3423f-baa9-4d31-a0e7-5654b400b598 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
3fc7dad
to
1e82141
Compare
Build Succeeded 👏 Build Id: 2a09eca9-3d77-49d1-bc15-2e2265b30228 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:
|
ad904a4
to
4f4ce23
Compare
Build Failed 😱 Build Id: 1c9f29b5-46d4-46ee-8bd8-1c576ed6e0d9 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: ff5f2f96-d91c-4886-9a43-a9fece08f460 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
e06889e
to
ec31ee1
Compare
Build Succeeded 👏 Build Id: 3bc012d3-823e-4f25-95db-3d5b3956c183 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 Failed 😱 Build Id: 1de1acd8-06da-4291-8072-e79785de2060 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
test/e2e/framework/framework.go
Outdated
@@ -247,6 +247,14 @@ func (f *Framework) CreateGameServerAndWaitUntilReady(t *testing.T, ns string, g | |||
return readyGs, nil | |||
} | |||
|
|||
// CreateGameServer Creates a GameServer. |
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 would either factor this with the above so that CreateGameServerAnd
calls this function, or I would just inline this in the test you wrote. Frankly the latter seems simple enough, since this falls in that "just a wrapper" category that Go tends to avoid.
cmd/extensions/main.go
Outdated
LogLevel: viper.GetString(logLevelFlag), | ||
LogSizeLimitMB: int(viper.GetInt32(logSizeLimitMBFlag)), | ||
AllocationBatchWaitTime: viper.GetDuration(allocationBatchWaitTime), | ||
ReadinessShutdownDuration: time.Duration(viper.GetDuration(readinessShutdownDuration).Seconds()), |
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.
Why are you extracting Seconds when the type is a time.Duration
?
@@ -114,6 +114,8 @@ spec: | |||
fieldPath: metadata.namespace | |||
- name: CONTAINER_NAME | |||
value: "agones-extensions" | |||
- name: READINESS_SHUTDOWN_DURATION | |||
value: {{ .Value.agones.extensions.periodSeconds * .Value.agones.extensions.failureThreshold * 2 | quote }} |
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.
You need the s
I had in the example. So
{{ mumble }}s
to indicate seconds, since it's a duration now.
Build Failed 😱 Build Id: 0596da9e-f785-428c-9a2d-39f273264284 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: eeeda60d-8c35-4550-b288-bba88699b549 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: c029a80a-32b9-497f-a01f-490b998a2718 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
@@ -114,6 +114,8 @@ spec: | |||
fieldPath: metadata.namespace | |||
- name: CONTAINER_NAME | |||
value: "agones-extensions" | |||
- name: READINESS_SHUTDOWN_DURATION | |||
value: {{ mul .Value.agones.extensions.readiness.periodSeconds .Value.agones.extensions.readiness.failureThreshold 2 | quote }}s |
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 looks good. Let's also go ahead and configure terminationGracePeriodSeconds
while we're at it - that way if someone configures things such that it's longer than the 30s kubelet
gives us by default, we have a reasonable configuration. It can be configured for e.g. periodSeconds * failureThreshold * 3
to give another safety envelope, but if we go beyond *2, I'd be shocked.
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
gs := framework.DefaultGameServer(defaultNs) | ||
logger.Infof("Creating game-server %s...", gs.Name) | ||
newGs, err := framework.AgonesClient.AgonesV1().GameServers(defaultNs).Create(context.Background(), gs, metav1.CreateOptions{}) | ||
require.NoError(t, err, "Could not get a GameServer ready") |
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.
It's no longer trying to get it ready, and line 93 should probably go, too.
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.
Removed
Build Failed 😱 Build Id: f16930f4-40f0-4595-affc-eec92bae07f3 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 2d128b65-1d57-416c-abdd-7364c75b8a4c 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:
|
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.
Thanks for your patience. :)
cmd/extensions/main.go
Outdated
}) | ||
|
||
signals.NewSigTermHandler(func() { | ||
logger.Info("pod shutdown has been requested, failing readiness check") |
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.
total nit, but s/pod/Pod/ for consistency with other log messages.
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!
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chiayi, zmerlynn The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank YOU for having the patience to go through this so many times! 😄 @zmerlynn |
Build Succeeded 👏 Build Id: dac644a6-6fca-407b-8ceb-b82ff7766d5f 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:
|
STILL WIP. Added the original e2e extensions test that was flaky due to not being able to reach the extensions pod.
What type of PR is this?
/kind bug
What this PR does / Why we need it:
Ensure that we take care of voluntary extension pod disruption by adding readiness and handler for SIGTERM.
Which issue(s) this PR fixes:
Closes #2999
Special notes for your reviewer:
WIP