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

Move SDKGracefulTermination To Stable #3231

Merged
merged 19 commits into from
Jun 23, 2023

Conversation

Kalaiselvi84
Copy link
Contributor

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:

Which issue(s) this PR fixes:

Closes #3094

Special notes for your reviewer:

@github-actions github-actions bot added the kind/feature New features for Agones label Jun 22, 2023
@Kalaiselvi84 Kalaiselvi84 changed the title Pr 3094 Move SDKGracefulTermination To Stable Jun 22, 2023
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 7c044ef5-ef45-482f-b100-a5cb683ea374

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

@markmandel
Copy link
Member

This is weird, this unit test seems to be consistently failing across multiple PRs.

--- FAIL: TestAllocatorAllocate (2.62s)
    allocator_test.go:122: 
        	Error Trace:	/go/src/agones.dev/agones/pkg/gameserverallocations/allocator_test.go:122
        	Error:      	Expected value not to be nil.
        	Test:       	TestAllocatorAllocate
    allocator_test.go:123: 
        	Error Trace:	/go/src/agones.dev/agones/pkg/gameserverallocations/allocator_test.go:123
        	Error:      	Not equal: 
        	            	expected: *errors.fundamental(Could not find an Allocatable GameServer)
        	            	actual  : <nil>(<nil>)
        	Test:       	TestAllocatorAllocate
    allocator_test.go:124: 
        	Error Trace:	/go/src/agones.dev/agones/pkg/gameserverallocations/allocator_test.go:124
        	Error:      	Should be false
        	Test:       	TestAllocatorAllocate

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Small fix, but otherwise looks good to go!

Comment on lines 143 to 144
If the `SDKGracefulTermination` feature is enabled, when the SDK server receives the TERM signal before calling SDK.Shutdown(),
the SDK server would stay alive for the period of the terminationGracePeriodSeconds until SDK.Shutdown() has been called
Copy link
Member

Choose a reason for hiding this comment

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

Just some cleanup since the gate doesn't exist, and also since we're here.

Suggested change
If the `SDKGracefulTermination` feature is enabled, when the SDK server receives the TERM signal before calling SDK.Shutdown(),
the SDK server would stay alive for the period of the terminationGracePeriodSeconds until SDK.Shutdown() has been called
If the SDK server receives a TERM signal before calling SDK.Shutdown(),
the SDK server will stay alive for the period of the `terminationGracePeriodSeconds` until `SDK.Shutdown()` has been called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made the changes as per your suggestion

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Kalaiselvi84, 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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: bc855225-f6d1-4897-b2c7-4d51e6031e8f

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

@markmandel
Copy link
Member

markmandel commented Jun 22, 2023

That's a weird flake in generic-1.25, during helm install:

Error: release agones failed, and has been uninstalled due to atomic being set: services "agones-ping-udp-service" not found

@google-oss-prow google-oss-prow bot removed the lgtm label Jun 23, 2023
@google-oss-prow
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 460137b0-b89a-4dec-a069-6c8386a6da6c

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/3231/head:pr_3231 && git checkout pr_3231
  • 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.33.0-dev-7b2ae37-amd64

@Kalaiselvi84
Copy link
Contributor Author

@markmandel, Is there anything pending that we need to wait for before merging this PR? Can we proceed with merging?

@markmandel markmandel merged commit de35cdb into googleforgames:main Jun 23, 2023
@markmandel
Copy link
Member

Thought I had set this to automerge!

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 9051d81a-09d1-4b8a-91b6-fc32e272483a

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

CauhxMilloy added a commit to CauhxMilloy/agones that referenced this pull request Jul 8, 2023
Note that these changes do not affect prod flows, only developer flows when running manually with extra (new) command line arguments.

* Updating SDK Server (`sdk-server/main.go`) for "out of cluster" mode.
  * Adding `--kubeconfig` cli flag to pass in a suitable k8s config file.
    * Makes use of `clientcmd.BuildConfigFromFlags()` to connect to the k8s cluster.
    * If the flag is not provided (as is the case for typical prod use), the `BuildConfigFromFlags()` call will internally fall back to the `InClusterConfig()`.
    * This is similar to the `--kubeconfig` cli arg for `cmd/controller/main.go`.
  * Adding `--no-graceful-termination` cli flag.
    * If set (default unset), the context `ctx` object will not be wrapped by the `NewSDKServerContext()` call. This means that exiting the program will not wait (block) for the `GameServer` state to update to `Shutdown`.
    * This flag to disable graceful shutdown is added as a convenient dev flow option, to quickly terminate and restart the SDK Server when testing locally.
    * Graceful termination was first added as an optional feature in googleforgames#2205.
      * Fully rolled into stable (no longer optional feature) in googleforgames#3231.
    * This flag does not affect normal (prod) flows (graceful termination still enabled by default).
* Updating gameservers/controller.go to handle `RequestReady` to `Ready` transition.
  * `RequestReady` is set via SDK Server (from SDK calls). Need to transition to `Ready` to be allocatable.
* Updated "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) with information with running "out of cluster" mode.
  * Also added information about running from source code instead of prebuilt binaries -- which many devs would prefer.
* Added links between "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) and "Local Game Server" guide page (`docs/Guides/local-game-server.md`) about how they can be used together.
CauhxMilloy added a commit to CauhxMilloy/agones that referenced this pull request Jul 8, 2023
This commit adds better support for integration between Dev Servers (called [Local Game Server](https://agones.dev/site/docs/guides/local-game-server/) in guides) and [Local Development](https://agones.dev/site/docs/guides/client-sdks/local/).
Note that these changes do not affect prod flows, only developer flows when running manually with extra (new) command line arguments.

* Updating SDK Server (`sdk-server/main.go`) for "out of cluster" mode.
  * Adding `--kubeconfig` cli flag to pass in a suitable k8s config file.
    * Makes use of `clientcmd.BuildConfigFromFlags()` to connect to the k8s cluster.
    * If the flag is not provided (as is the case for typical prod use), the `BuildConfigFromFlags()` call will internally fall back to the `InClusterConfig()`.
    * This is similar to the `--kubeconfig` cli arg for `cmd/controller/main.go`.
  * Adding `--no-graceful-termination` cli flag.
    * If set (default unset), the context `ctx` object will not be wrapped by the `NewSDKServerContext()` call. This means that exiting the program will not wait (block) for the `GameServer` state to update to `Shutdown`.
    * This flag to disable graceful shutdown is added as a convenient dev flow option, to quickly terminate and restart the SDK Server when testing locally.
    * Graceful termination was first added as an optional feature in googleforgames#2205.
      * Fully rolled into stable (no longer optional feature) in googleforgames#3231.
    * This flag does not affect normal (prod) flows (graceful termination still enabled by default).
* Updating gameservers/controller.go to handle `RequestReady` to `Ready` transition.
  * `RequestReady` is set via SDK Server (from SDK calls). Need to transition to `Ready` to be allocatable.
* Updated "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) with information with running "out of cluster" mode.
  * Also added information about running from source code instead of prebuilt binaries -- which many devs would prefer.
* Added links between "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) and "Local Game Server" guide page (`docs/Guides/local-game-server.md`) about how they can be used together.
markmandel pushed a commit that referenced this pull request Jul 26, 2023
* More Local Dev Server Support

This commit adds better support for integration between Dev Servers (called [Local Game Server](https://agones.dev/site/docs/guides/local-game-server/) in guides) and [Local Development](https://agones.dev/site/docs/guides/client-sdks/local/).
Note that these changes do not affect prod flows, only developer flows when running manually with extra (new) command line arguments.

* Updating SDK Server (`sdk-server/main.go`) for "out of cluster" mode.
  * Adding `--kubeconfig` cli flag to pass in a suitable k8s config file.
    * Makes use of `clientcmd.BuildConfigFromFlags()` to connect to the k8s cluster.
    * If the flag is not provided (as is the case for typical prod use), the `BuildConfigFromFlags()` call will internally fall back to the `InClusterConfig()`.
    * This is similar to the `--kubeconfig` cli arg for `cmd/controller/main.go`.
  * Adding `--no-graceful-termination` cli flag.
    * If set (default unset), the context `ctx` object will not be wrapped by the `NewSDKServerContext()` call. This means that exiting the program will not wait (block) for the `GameServer` state to update to `Shutdown`.
    * This flag to disable graceful shutdown is added as a convenient dev flow option, to quickly terminate and restart the SDK Server when testing locally.
    * Graceful termination was first added as an optional feature in #2205.
      * Fully rolled into stable (no longer optional feature) in #3231.
    * This flag does not affect normal (prod) flows (graceful termination still enabled by default).
* Updating gameservers/controller.go to handle `RequestReady` to `Ready` transition.
  * `RequestReady` is set via SDK Server (from SDK calls). Need to transition to `Ready` to be allocatable.
* Updated "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) with information with running "out of cluster" mode.
  * Also added information about running from source code instead of prebuilt binaries -- which many devs would prefer.
* Added links between "Local Development" guide page (`docs/Guides/Client SDKs/local.md`) and "Local Game Server" guide page (`docs/Guides/local-game-server.md`) about how they can be used together.

* * Update documentation clarification location... -ation.

* * Fixing formatting (had 1 too many spaces).

* * Fixing ref relative paths.

* * Removing quotes missed in previous cleanups.

* * As per review feedback, updating `GAMESERVER_NAME` and `POD_NAMESPACE` to be passable via cli args instead of only as environment variables.
  * This should still function using environment variables due to calls to `viper.BindEnv()`.
  * Manually verified functionality when running locally with either cli args or environment variables.
  * Moving values to pass through `config` struct, just as other flags are passed.
* Updating documentation to use cli args instead of environment variables.

* * As per review feedback, changing from negative to positive logic for graceful termination flag.
  * Renaming `--no-graceful-termination` to `--graceful-termination`.
  * Setting default value to `true`.
  * Manually verified locally that graceful termination is on by default.
* Updating indention.
* Updating documentation to show renamed cli arg.

* * Updating links to use `ref` instead of absolute site link.

* * Switching "out of cluster" command example to use binary instead of running from source.
  * Done for consistency with other examples.

* * Adding controller test for RequestReady -> Ready state progression.

* * Adding `RequestReady` -> `Ready` state progressing in `TestDevelopmentGameServerLifecycle` e2e test.

* * Fixing call to `StartInformers()` in test.

* * Moving discussion of running from source code down to the bottom.

* * Adding more cross-reference links for game server allocation.

* * Moving "out of cluster" documentation into its own file.
  * Going into much more detail about background and steps to complete.
  * `publishDate` set to `2023-08-15T07:00:00Z` (midnight PST) to not publish doc immediately.
    * `2023-08-15` chosen to coincide with next release, per https://github.com/googleforgames/agones/blob/main/docs/governance/release_process.md#release-calendar.
* Adding links to new page from `Local Game Server` and `Local Development` pages.
  * Links are wrapped by `publishVersion="1.34.0"` to not show immediately. `1.34.0` is the next release, per https://github.com/googleforgames/agones/blob/main/docs/governance/release_process.md#release-calendar.

* * Switching OS/file description back to bulleted form similar to how it was before (but now as 1 set of bullets).

* * Removing link to moved section (covered by "Next Steps" section).

* * Cleaning up some wording.

* * Adding comments about restarting locally run binaries.

* * Proofread and update.
@Kalaiselvi84 Kalaiselvi84 deleted the pr_3094 branch March 15, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/feature New features for Agones size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graduate SDKGracefulTermination to Stable
3 participants