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

Add Sigterm handler and readiness probe to extensions #3011

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

chiayi
Copy link
Contributor

@chiayi chiayi commented Mar 2, 2023

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?

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

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 64d98169-fe02-486f-993e-eafbdd654a9a

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 23f3423f-baa9-4d31-a0e7-5654b400b598

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

@chiayi chiayi force-pushed the agoneshabranch branch 2 times, most recently from 3fc7dad to 1e82141 Compare March 2, 2023 00:47
@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3011/head:pr_3011 && git checkout pr_3011
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-1e82141-amd64

@chiayi chiayi force-pushed the agoneshabranch branch 2 times, most recently from ad904a4 to 4f4ce23 Compare March 2, 2023 19:10
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 1c9f29b5-46d4-46ee-8bd8-1c576ed6e0d9

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: ff5f2f96-d91c-4886-9a43-a9fece08f460

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

@chiayi chiayi requested review from zmerlynn and removed request for cyriltovena and aLekSer March 2, 2023 21:54
cmd/extensions/main.go Outdated Show resolved Hide resolved
@chiayi chiayi force-pushed the agoneshabranch branch 2 times, most recently from e06889e to ec31ee1 Compare March 2, 2023 22:46
@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3011/head:pr_3011 && git checkout pr_3011
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.31.0-ec31ee1-amd64

@chiayi chiayi marked this pull request as ready for review March 3, 2023 00:23
@chiayi chiayi requested review from roberthbailey and removed request for cyriltovena March 3, 2023 00:24
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 1de1acd8-06da-4291-8072-e79785de2060

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

@@ -247,6 +247,14 @@ func (f *Framework) CreateGameServerAndWaitUntilReady(t *testing.T, ns string, g
return readyGs, nil
}

// CreateGameServer Creates a GameServer.
Copy link
Collaborator

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.

LogLevel: viper.GetString(logLevelFlag),
LogSizeLimitMB: int(viper.GetInt32(logSizeLimitMBFlag)),
AllocationBatchWaitTime: viper.GetDuration(allocationBatchWaitTime),
ReadinessShutdownDuration: time.Duration(viper.GetDuration(readinessShutdownDuration).Seconds()),
Copy link
Collaborator

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 }}
Copy link
Collaborator

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.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 0596da9e-f785-428c-9a2d-39f273264284

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: eeeda60d-8c35-4550-b288-bba88699b549

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: c029a80a-32b9-497f-a01f-490b998a2718

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

cmd/extensions/main.go Show resolved Hide resolved
@@ -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
Copy link
Collaborator

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.

Copy link
Contributor Author

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")
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: f16930f4-40f0-4595-affc-eec92bae07f3

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

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3011/head:pr_3011 && git checkout pr_3011
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.31.0-043497e-amd64

Copy link
Collaborator

@zmerlynn zmerlynn left a 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. :)

})

signals.NewSigTermHandler(func() {
logger.Info("pod shutdown has been requested, failing readiness check")
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@google-oss-prow google-oss-prow bot added the lgtm label Mar 6, 2023
@google-oss-prow google-oss-prow bot removed the lgtm label Mar 7, 2023
@google-oss-prow google-oss-prow bot added the lgtm label Mar 7, 2023
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chiayi, zmerlynn
Once this PR has been reviewed and has the lgtm label, please assign alekser for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zmerlynn zmerlynn enabled auto-merge (squash) March 7, 2023 00:22
@chiayi
Copy link
Contributor Author

chiayi commented Mar 7, 2023

Thank YOU for having the patience to go through this so many times! 😄 @zmerlynn

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3011/head:pr_3011 && git checkout pr_3011
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.31.0-0e7e5ed-amd64

@zmerlynn zmerlynn merged commit 8792066 into googleforgames:main Mar 7, 2023
@Kalaiselvi84 Kalaiselvi84 added the kind/bug These are bugs. label Apr 10, 2023
@Kalaiselvi84 Kalaiselvi84 added this to the 1.31.0 milestone Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure agones-extensions is HA
4 participants