From 03dae9f67f8faf4b4473c8f08f1a5154be7c0049 Mon Sep 17 00:00:00 2001 From: igooch Date: Thu, 11 Jul 2024 14:43:09 -0700 Subject: [PATCH] Adds a command to generate the zz_generated.deepcopy.go files for the apis (#3900) * Adds a command to generate the zz_generated.deepcopy.go files for the apis * Combines CRD client and deepcopy code generation into one script * Updates boilerplate headers to 2024 * Generated code from gen-all-sdk-grpc * Small update to template comment agones-{extensions,allocator}: Make servers context aware (#3845) * agones-{extensions,allocator}: Make servers context aware, add gRPC health check * adds an `httpserver` utility package to handle the `Run` function that controller/extensions use. Make that context aware using the same method as https.Run: https://github.com/googleforgames/agones/blob/dfa414e5e4da37798833bbf8c33919acb5f3c2ea/pkg/util/https/server.go#L127-L130 * also plumbs context-awareness through the allocator run{Mux,REST,GRPC} functions. * adds a gRPC health server to the allocator, calls .Shutdown() on it during graceful termination - this seems to push the client off correctly. Tested with e2e in a loop. Towards #3853 * Move from context.Background() * Use Shutdown/GracefulStop * Relax deadline slightly (original had none), also delete pod from GetAllocatorClient Update Slack invite link (#3896) Looks like the Slack invite link expired somewhere along the way, so this is a new, shiny updated one! --- .github/ISSUE_TEMPLATE/kubernetes_update.md | 6 +- build/Makefile | 29 ++-- build/README.md | 8 +- build/boilerplate.go.txt | 2 +- build/boilerplate.yaml.txt | 2 +- .../{gen-crd-client.sh => gen-crd-code.sh} | 8 + cloudbuild.yaml | 6 +- cmd/allocator/main.go | 81 ++++++--- cmd/controller/main.go | 27 +-- cmd/extensions/main.go | 27 +-- go.mod | 4 +- pkg/apis/agones/v1/zz_generated.deepcopy.go | 2 +- .../allocation/v1/zz_generated.deepcopy.go | 2 +- .../autoscaling/v1/zz_generated.deepcopy.go | 2 +- .../multicluster/v1/zz_generated.deepcopy.go | 2 +- .../agones/v1/aggregatedcounterstatus.go | 2 +- .../agones/v1/aggregatedliststatus.go | 2 +- .../agones/v1/aggregatedplayerstatus.go | 2 +- .../agones/v1/allocationoverflow.go | 2 +- .../agones/v1/counterstatus.go | 2 +- .../applyconfiguration/agones/v1/eviction.go | 2 +- .../applyconfiguration/agones/v1/fleet.go | 2 +- .../applyconfiguration/agones/v1/fleetspec.go | 2 +- .../agones/v1/fleetstatus.go | 2 +- .../agones/v1/gameserver.go | 2 +- .../agones/v1/gameserverport.go | 2 +- .../agones/v1/gameserverset.go | 2 +- .../agones/v1/gameserversetspec.go | 2 +- .../agones/v1/gameserversetstatus.go | 2 +- .../agones/v1/gameserverspec.go | 2 +- .../agones/v1/gameserverstatus.go | 2 +- .../agones/v1/gameserverstatusport.go | 2 +- .../agones/v1/gameservertemplatespec.go | 2 +- .../applyconfiguration/agones/v1/health.go | 2 +- .../agones/v1/liststatus.go | 2 +- .../agones/v1/playersspec.go | 2 +- .../agones/v1/playerstatus.go | 2 +- .../applyconfiguration/agones/v1/priority.go | 2 +- .../applyconfiguration/agones/v1/sdkserver.go | 2 +- .../autoscaling/v1/bufferpolicy.go | 2 +- .../autoscaling/v1/counterpolicy.go | 2 +- .../autoscaling/v1/fixedintervalsync.go | 2 +- .../autoscaling/v1/fleetautoscaler.go | 2 +- .../autoscaling/v1/fleetautoscalerpolicy.go | 2 +- .../autoscaling/v1/fleetautoscalerspec.go | 2 +- .../autoscaling/v1/fleetautoscalerstatus.go | 2 +- .../autoscaling/v1/fleetautoscalersync.go | 2 +- .../autoscaling/v1/listpolicy.go | 2 +- .../autoscaling/v1/webhookpolicy.go | 2 +- .../applyconfiguration/internal/internal.go | 2 +- .../multicluster/v1/clusterconnectioninfo.go | 2 +- .../v1/gameserverallocationpolicy.go | 2 +- .../v1/gameserverallocationpolicyspec.go | 2 +- pkg/client/applyconfiguration/utils.go | 2 +- pkg/client/clientset/versioned/clientset.go | 2 +- .../versioned/fake/clientset_generated.go | 2 +- pkg/client/clientset/versioned/fake/doc.go | 2 +- .../clientset/versioned/fake/register.go | 2 +- pkg/client/clientset/versioned/scheme/doc.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- .../typed/agones/v1/agones_client.go | 2 +- .../versioned/typed/agones/v1/doc.go | 2 +- .../versioned/typed/agones/v1/fake/doc.go | 2 +- .../agones/v1/fake/fake_agones_client.go | 2 +- .../typed/agones/v1/fake/fake_fleet.go | 2 +- .../typed/agones/v1/fake/fake_gameserver.go | 2 +- .../agones/v1/fake/fake_gameserverset.go | 2 +- .../versioned/typed/agones/v1/fleet.go | 2 +- .../versioned/typed/agones/v1/gameserver.go | 2 +- .../typed/agones/v1/gameserverset.go | 2 +- .../typed/agones/v1/generated_expansion.go | 2 +- .../typed/allocation/v1/allocation_client.go | 2 +- .../versioned/typed/allocation/v1/doc.go | 2 +- .../versioned/typed/allocation/v1/fake/doc.go | 2 +- .../v1/fake/fake_allocation_client.go | 2 +- .../v1/fake/fake_gameserverallocation.go | 2 +- .../allocation/v1/gameserverallocation.go | 2 +- .../allocation/v1/generated_expansion.go | 2 +- .../autoscaling/v1/autoscaling_client.go | 2 +- .../versioned/typed/autoscaling/v1/doc.go | 2 +- .../typed/autoscaling/v1/fake/doc.go | 2 +- .../v1/fake/fake_autoscaling_client.go | 2 +- .../v1/fake/fake_fleetautoscaler.go | 2 +- .../typed/autoscaling/v1/fleetautoscaler.go | 2 +- .../autoscaling/v1/generated_expansion.go | 2 +- .../versioned/typed/multicluster/v1/doc.go | 2 +- .../typed/multicluster/v1/fake/doc.go | 2 +- .../fake/fake_gameserverallocationpolicy.go | 2 +- .../v1/fake/fake_multicluster_client.go | 2 +- .../v1/gameserverallocationpolicy.go | 2 +- .../multicluster/v1/generated_expansion.go | 2 +- .../multicluster/v1/multicluster_client.go | 2 +- .../externalversions/agones/interface.go | 2 +- .../externalversions/agones/v1/fleet.go | 2 +- .../externalversions/agones/v1/gameserver.go | 2 +- .../agones/v1/gameserverset.go | 2 +- .../externalversions/agones/v1/interface.go | 2 +- .../externalversions/autoscaling/interface.go | 2 +- .../autoscaling/v1/fleetautoscaler.go | 2 +- .../autoscaling/v1/interface.go | 2 +- .../informers/externalversions/factory.go | 2 +- .../informers/externalversions/generic.go | 2 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../multicluster/interface.go | 2 +- .../v1/gameserverallocationpolicy.go | 2 +- .../multicluster/v1/interface.go | 2 +- .../listers/agones/v1/expansion_generated.go | 2 +- pkg/client/listers/agones/v1/fleet.go | 2 +- pkg/client/listers/agones/v1/gameserver.go | 2 +- pkg/client/listers/agones/v1/gameserverset.go | 2 +- .../autoscaling/v1/expansion_generated.go | 2 +- .../listers/autoscaling/v1/fleetautoscaler.go | 2 +- .../multicluster/v1/expansion_generated.go | 2 +- .../v1/gameserverallocationpolicy.go | 2 +- pkg/sdk/alpha/alpha.pb.go | 2 +- pkg/sdk/alpha/alpha.pb.gw.go | 2 +- pkg/sdk/alpha/alpha_grpc.pb.go | 2 +- pkg/sdk/beta/beta.pb.go | 2 +- pkg/sdk/beta/beta.pb.gw.go | 2 +- pkg/sdk/beta/beta_grpc.pb.go | 2 +- pkg/sdk/sdk.pb.go | 2 +- pkg/sdk/sdk.pb.gw.go | 2 +- pkg/sdk/sdk_grpc.pb.go | 2 +- pkg/util/https/server.go | 4 +- pkg/util/https/server_test.go | 2 +- pkg/util/httpserver/server.go | 59 +++++++ sdks/cpp/include/agones/sdk.grpc.pb.h | 2 +- sdks/cpp/include/agones/sdk.pb.h | 2 +- sdks/cpp/include/google/api/annotations.pb.h | 2 +- sdks/cpp/include/google/api/http.pb.h | 2 +- .../options/annotations.pb.h | 2 +- .../options/openapiv2.pb.h | 2 +- sdks/cpp/src/agones/sdk.grpc.pb.cc | 2 +- sdks/cpp/src/agones/sdk.pb.cc | 2 +- sdks/cpp/src/google/annotations.pb.cc | 2 +- sdks/cpp/src/google/http.pb.cc | 2 +- .../protoc-gen-openapiv2/annotations.pb.cc | 2 +- .../src/protoc-gen-openapiv2/openapiv2.pb.cc | 2 +- sdks/nodejs/lib/alpha/alpha_grpc_pb.js | 2 +- sdks/nodejs/lib/alpha/alpha_pb.js | 2 +- .../lib/alpha/google/api/annotations_pb.js | 2 +- sdks/nodejs/lib/alpha/google/api/http_pb.js | 2 +- .../options/annotations_pb.js | 2 +- .../options/openapiv2_pb.js | 2 +- sdks/nodejs/lib/beta/beta_grpc_pb.js | 2 +- sdks/nodejs/lib/beta/beta_pb.js | 2 +- .../lib/beta/google/api/annotations_pb.js | 2 +- sdks/nodejs/lib/beta/google/api/http_pb.js | 2 +- .../options/annotations_pb.js | 2 +- .../options/openapiv2_pb.js | 2 +- sdks/nodejs/lib/google/api/annotations_pb.js | 2 +- sdks/nodejs/lib/google/api/http_pb.js | 2 +- .../options/annotations_pb.js | 2 +- .../options/openapiv2_pb.js | 2 +- sdks/nodejs/lib/sdk_grpc_pb.js | 2 +- sdks/nodejs/lib/sdk_pb.js | 2 +- test/e2e/allocator/pod_termination_test.go | 72 ++++---- test/e2e/allocator_test.go | 16 +- test/e2e/allochelper/helper_func.go | 75 +++++--- test/sdk/restapi/alpha/swagger/api_sdk.go | 2 +- test/sdk/restapi/alpha/swagger/client.go | 2 +- .../restapi/alpha/swagger/configuration.go | 2 +- .../restapi/alpha/swagger/model_alpha_bool.go | 2 +- .../alpha/swagger/model_alpha_count.go | 2 +- .../alpha/swagger/model_alpha_empty.go | 2 +- .../alpha/swagger/model_alpha_player_id.go | 2 +- .../swagger/model_alpha_player_id_list.go | 2 +- test/sdk/restapi/alpha/swagger/response.go | 2 +- test/sdk/restapi/beta/swagger/api_sdk.go | 2 +- test/sdk/restapi/beta/swagger/client.go | 2 +- .../sdk/restapi/beta/swagger/configuration.go | 2 +- .../beta/swagger/model_beta_counter.go | 2 +- .../model_beta_counter_update_request.go | 2 +- .../restapi/beta/swagger/model_beta_list.go | 2 +- .../swagger/model_lists_nameadd_value_body.go | 2 +- .../model_lists_nameremove_value_body.go | 2 +- .../beta/swagger/model_the_list_to_update.go | 2 +- ...requested_update_to_make_to_the_counter.go | 2 +- test/sdk/restapi/beta/swagger/response.go | 2 +- test/sdk/restapi/swagger/api_sdk.go | 2 +- test/sdk/restapi/swagger/client.go | 2 +- test/sdk/restapi/swagger/configuration.go | 2 +- .../swagger/model_game_server_object_meta.go | 2 +- .../restapi/swagger/model_game_server_spec.go | 2 +- .../restapi/swagger/model_googlerpc_status.go | 2 +- .../sdk/restapi/swagger/model_sdk_duration.go | 2 +- test/sdk/restapi/swagger/model_sdk_empty.go | 2 +- .../restapi/swagger/model_sdk_game_server.go | 2 +- .../swagger/model_sdk_game_server_status.go | 2 +- .../restapi/swagger/model_sdk_key_value.go | 2 +- test/sdk/restapi/swagger/model_spec_health.go | 2 +- .../restapi/swagger/model_status_address.go | 2 +- .../swagger/model_status_counter_status.go | 2 +- .../swagger/model_status_list_status.go | 2 +- .../swagger/model_status_player_status.go | 2 +- test/sdk/restapi/swagger/model_status_port.go | 2 +- .../model_stream_result_of_sdk_game_server.go | 2 +- test/sdk/restapi/swagger/response.go | 2 +- .../google.golang.org/grpc/health/client.go | 117 +++++++++++++ .../google.golang.org/grpc/health/logging.go | 23 +++ .../google.golang.org/grpc/health/server.go | 163 ++++++++++++++++++ vendor/modules.txt | 1 + 202 files changed, 742 insertions(+), 352 deletions(-) rename build/build-image/{gen-crd-client.sh => gen-crd-code.sh} (81%) create mode 100644 pkg/util/httpserver/server.go create mode 100644 vendor/google.golang.org/grpc/health/client.go create mode 100644 vendor/google.golang.org/grpc/health/logging.go create mode 100644 vendor/google.golang.org/grpc/health/server.go diff --git a/.github/ISSUE_TEMPLATE/kubernetes_update.md b/.github/ISSUE_TEMPLATE/kubernetes_update.md index 9f77819bf6..9a4af7045e 100644 --- a/.github/ISSUE_TEMPLATE/kubernetes_update.md +++ b/.github/ISSUE_TEMPLATE/kubernetes_update.md @@ -26,7 +26,7 @@ List of items to do for upgrading to {version_1} {version_2} {version_3} - [ ] Update CRD API reference to {version_2} - [ ] Update links to k8s documentation in `site/assets/templates/crd-doc-config.json` - [ ] Regenerate crd api reference docs - `make gen-api-docs` - - [ ] Regenerate crd client libraries - `make gen-crd-client` + - [ ] Regenerate crd client libraries and generated code - `make gen-crd-code` - [ ] Regenerate Kubernetes resource includes (e.g. ObjectMeta, PodTemplateSpec) - [ ] Start a cluster with `make gcloud-test-cluster` (this cluster will use Kubernetes {version_2}), uninstall agones using `helm uninstall agones -n agones-system`, and then run `make gen-embedded-openapi` and `make gen-install` - [ ] Update documentation for creating clusters and k8s API references to align with the above clusters versions and the k8s API version @@ -41,11 +41,11 @@ List of items to do for upgrading to {version_1} {version_2} {version_3} - [ ] Update the `grpc_release_tag` in the SDK [base image grpc version](https://github.com/googleforgames/agones/blob/main/build/includes/sdk.mk). - [ ] Update the gRPC version number in C++ gRPC Dependency documentation [here](https://github.com/googleforgames/agones/blob/main/site/content/en/docs/Guides/Client%20SDKs/cpp.md). - [ ] Update the gRPC version - ([Dockerfile](https://github.com/googleforgames/agones/blob/main/examples/cpp-simple/Dockerfile)) and + ([Dockerfile](https://github.com/googleforgames/agones/blob/main/examples/cpp-simple/Dockerfile)) and increment the image tag ([Makefile](https://github.com/googleforgames/agones/blob/main/examples/cpp-simple/Makefile)) in the C++ `cpp-simple` example. - - [ ] Regenerate all client sdks: [make gen-all-sdk-grpc](https://github.com/googleforgames/agones/blob/main/build/README.md#make-gen-all-sdk-grpc) + - [ ] Regenerate all client sdks: [make gen-all-sdk-grpc](https://github.com/googleforgames/agones/blob/main/build/README.md#make-gen-all-sdk-grpc) This can take 20 minutes or so, as the above changes force a rebuild. Plan your day accordingly 😃. - [ ] Regenerate allocated API endpoints: [make gen-allocation-grpc](https://github.com/googleforgames/agones/blob/main/build/README.md#make-gen-allocation-grpc) - [ ] Confirm the update works as expected by running e2e tests diff --git a/build/Makefile b/build/Makefile index 96c5d022be..5bdcb43fa7 100644 --- a/build/Makefile +++ b/build/Makefile @@ -738,12 +738,12 @@ gen-install: $(ensure-build-image) --set agones.crds.cleanupOnDelete=false \ > $(mount_path)/install/yaml/install.yaml' -# Generate the client for our CustomResourceDefinition -gen-crd-client: $(ensure-build-image) +# Generate the client, conversions, deepcopy, and defaults code for our CustomResourceDefinition +gen-crd-code: $(ensure-build-image) docker run --rm \ $(common_mounts) -w $(workdir_path) $(build_tag) bash -c "\ $(git_safe) && \ - /root/gen-crd-client.sh && \ + /root/gen-crd-code.sh && \ cd $(workdir_path)/pkg && goimports -w ." # Run a bash shell with the developer tools in it. (Creates the image if it doesn't exist) @@ -848,14 +848,23 @@ update-go-deps: $(DOCKER_RUN) go mod tidy $(DOCKER_RUN) go mod vendor -test-gen-crd-client: - mkdir -p build/tmp - mv ../pkg/client build/tmp - make gen-crd-client - diff_output=$$(diff -bBr build/tmp/client ../pkg/client); \ - if [ -z "$$diff_output" ]; then \ - echo "No differences found. Deleting build/tmp"; \ +test-gen-crd-code: + mkdir -p build/tmp/apis | mkdir -p build/tmp/client; \ + cp -r ../pkg/apis/* build/tmp/apis | cp -r ../pkg/client/* build/tmp/client; \ + make gen-crd-code; \ + $(MAKE) diff-directory DIRECTORY=apis + $(MAKE) diff-directory DIRECTORY=client + # Delete build/tmp if the directory is empty + if [ ! "$(ls -A build/tmp)" ]; then \ + echo "No differences found. Deleting empty directory build/tmp."; \ rm -r build/tmp; \ + fi + +diff-directory: + diff_output=$$(diff -bBr build/tmp/$(DIRECTORY) ../pkg/$(DIRECTORY)); \ + if [ -z "$$diff_output" ]; then \ + echo "No differences found. Deleting build/tmp/$(DIRECTORY)"; \ + rm -r build/tmp/$(DIRECTORY); \ else \ echo "Differences found."; \ echo "$$diff_output"; \ diff --git a/build/README.md b/build/README.md index 44786ba17a..d7a5eca43b 100644 --- a/build/README.md +++ b/build/README.md @@ -64,7 +64,7 @@ Table of Contents * [make build-agones-sdk-image](#make-build-agones-sdk-image) * [make gen-install](#make-gen-install) * [make gen-embedded-openapi](#make-gen-embedded-openapi) - * [make gen-crd-client](#make-gen-crd-client) + * [make gen-crd-code](#make-gen-crd-code) * [make gen-allocation-grpc](#make-gen-allocation-grpc) * [make gen-all-sdk-grpc](#make-gen-all-sdk-grpc) * [make gen-sdk-grpc](#make-gen-sdk-grpc) @@ -585,7 +585,7 @@ make test-e2e-integration ARGS='-run TestGameServerReserve' Run controller failure portion of the end-to-end tests. #### `make test-e2e-allocator-crash` -Run allocator failure portion of the end-to-end test. +Run allocator failure portion of the end-to-end test. #### `make setup-prometheus` @@ -675,8 +675,8 @@ Generate the embedded OpenAPI specs for existing Kubernetes Objects, such as `Po This should be run against a clean or brand new cluster, as external CRD's or schemas could cause errors to occur. -#### `make gen-crd-client` -Generate the Custom Resource Definition client(s) +#### `make gen-crd-code` +Generate the Custom Resource Definition client(s), conversions, deepcopy, and defaults code. #### `make gen-allocation-grpc` Generate the allocator gRPC code diff --git a/build/boilerplate.go.txt b/build/boilerplate.go.txt index 7350e851da..2e1bea8fed 100644 --- a/build/boilerplate.go.txt +++ b/build/boilerplate.go.txt @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/build/boilerplate.yaml.txt b/build/boilerplate.yaml.txt index 7be643e234..820aceb75c 100644 --- a/build/boilerplate.yaml.txt +++ b/build/boilerplate.yaml.txt @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC All Rights Reserved. +# Copyright 2024 Google LLC All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build/build-image/gen-crd-client.sh b/build/build-image/gen-crd-code.sh similarity index 81% rename from build/build-image/gen-crd-client.sh rename to build/build-image/gen-crd-code.sh index 5c48ad0036..e0b0896ce4 100755 --- a/build/build-image/gen-crd-client.sh +++ b/build/build-image/gen-crd-code.sh @@ -38,3 +38,11 @@ kube::codegen::gen_client \ /go/src/agones.dev/agones/pkg/apis echo "CRD client code generation complete." + +echo "Generating CRD conversions, deepcopy, and defaults code..." + +kube::codegen::gen_helpers \ + --boilerplate /go/src/agones.dev/agones/build/boilerplate.go.txt \ + /go/src/agones.dev/agones/pkg/apis + +echo "CRD conversions, deepcopy, and defaults code generation complete." diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 2468b4e163..6376a4e873 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -116,10 +116,10 @@ steps: # Preventing Broken PR Merges in CI # - name: make-docker - id: test-gen-crd-client + id: test-gen-crd-code waitFor: [pull-build-image] dir: build - args: [test-gen-crd-client] + args: [test-gen-crd-code] # # Runs the linter -- but also builds the build image, if not able to download @@ -128,7 +128,7 @@ steps: id: lint waitFor: - pull-build-image - - test-gen-crd-client + - test-gen-crd-code - test-gen-all-sdk-grpc dir: build args: [lint] # pull the build image if it exists diff --git a/cmd/allocator/main.go b/cmd/allocator/main.go index 9e31cbda83..b7168f2b2b 100644 --- a/cmd/allocator/main.go +++ b/cmd/allocator/main.go @@ -35,6 +35,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + grpchealth "google.golang.org/grpc/health" + "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/status" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -52,6 +54,7 @@ import ( "agones.dev/agones/pkg/gameserverallocations" "agones.dev/agones/pkg/gameservers" "agones.dev/agones/pkg/util/fswatch" + "agones.dev/agones/pkg/util/httpserver" "agones.dev/agones/pkg/util/runtime" "agones.dev/agones/pkg/util/signals" ) @@ -218,19 +221,18 @@ func main() { health, closer := setupMetricsRecorder(conf) defer closer() - // http.DefaultServerMux is used for http connection, not for https - http.Handle("/", health) - kubeClient, agonesClient, err := getClients(conf) if err != nil { logger.WithError(err).Fatal("could not create clients") } + listenCtx, cancelListenCtx := context.WithCancel(context.Background()) + // This will test the connection to agones on each readiness probe // so if one of the allocator pod can't reach Kubernetes it will be removed // from the Kubernetes service. - ctx, cancelCtx := context.WithCancel(context.Background()) podReady = true + grpcHealth := grpchealth.NewServer() // only used for gRPC, ignored o/w health.AddReadinessCheck("allocator-agones-client", func() error { if !podReady { return errors.New("asked to shut down, failed readiness check") @@ -245,16 +247,15 @@ func main() { signals.NewSigTermHandler(func() { logger.Info("Pod shutdown has been requested, failing readiness check") podReady = false + grpcHealth.Shutdown() time.Sleep(conf.ReadinessShutdownDuration) - cancelCtx() - logger.Infof("Readiness shutdown duration has passed, context cancelled") - time.Sleep(1 * time.Second) // allow a brief time for cleanup, but force exit if main doesn't - os.Exit(0) + cancelListenCtx() }) grpcUnallocatedStatusCode := grpcCodeFromHTTPStatus(conf.httpUnallocatedStatusCode) - h := newServiceHandler(ctx, kubeClient, agonesClient, health, conf.MTLSDisabled, conf.TLSDisabled, conf.remoteAllocationTimeout, conf.totalRemoteAllocationTimeout, conf.allocationBatchWaitTime, grpcUnallocatedStatusCode) + workerCtx, cancelWorkerCtx := context.WithCancel(context.Background()) + h := newServiceHandler(workerCtx, kubeClient, agonesClient, health, conf.MTLSDisabled, conf.TLSDisabled, conf.remoteAllocationTimeout, conf.totalRemoteAllocationTimeout, conf.allocationBatchWaitTime, grpcUnallocatedStatusCode) if !h.tlsDisabled { cancelTLS, err := fswatch.Watch(logger, tlsDir, time.Second, func() { @@ -294,21 +295,31 @@ func main() { // If grpc and http use the same port then use a mux. if conf.GRPCPort == conf.HTTPPort { - runMux(h, conf.HTTPPort) + runMux(listenCtx, workerCtx, h, grpcHealth, conf.HTTPPort) } else { // Otherwise, run each on a dedicated port. if validPort(conf.HTTPPort) { - runREST(h, conf.HTTPPort) + runREST(listenCtx, workerCtx, h, conf.HTTPPort) } if validPort(conf.GRPCPort) { - runGRPC(h, conf.GRPCPort) + runGRPC(listenCtx, h, grpcHealth, conf.GRPCPort) } } - // Finally listen on 8080 (http) and block the main goroutine - // this is used to serve /live and /ready handlers for Kubernetes probes. - err = http.ListenAndServe(":8080", http.DefaultServeMux) - logger.WithError(err).Fatal("allocation service crashed") + // Finally listen on 8080 (http), used to serve /live and /ready handlers for Kubernetes probes. + healthserver := httpserver.Server{Logger: logger} + healthserver.Handle("/", health) + go func() { _ = healthserver.Run(listenCtx, 0) }() + + // TODO: This is messy. Contexts are the wrong way to handle this - we should be using shutdown, + // and a cascading graceful shutdown instead of multiple contexts and sleeps. + <-listenCtx.Done() + logger.Infof("Listen context cancelled") + time.Sleep(5 * time.Second) + cancelWorkerCtx() + logger.Infof("Worker context cancelled") + time.Sleep(1 * time.Second) + logger.Info("Shut down allocator") } func validPort(port int) bool { @@ -316,29 +327,30 @@ func validPort(port int) bool { return port >= 0 && port < maxPort } -func runMux(h *serviceHandler, httpPort int) { +func runMux(listenCtx context.Context, workerCtx context.Context, h *serviceHandler, grpcHealth *grpchealth.Server, httpPort int) { logger.Infof("Running the mux handler on port %d", httpPort) grpcServer := grpc.NewServer(h.getMuxServerOptions()...) pb.RegisterAllocationServiceServer(grpcServer, h) + grpc_health_v1.RegisterHealthServer(grpcServer, grpcHealth) mux := runtime.NewServerMux() if err := pb.RegisterAllocationServiceHandlerServer(context.Background(), mux, h); err != nil { panic(err) } - runHTTP(h, httpPort, grpcHandlerFunc(grpcServer, mux)) + runHTTP(listenCtx, workerCtx, h, httpPort, grpcHandlerFunc(grpcServer, mux)) } -func runREST(h *serviceHandler, httpPort int) { +func runREST(listenCtx context.Context, workerCtx context.Context, h *serviceHandler, httpPort int) { logger.WithField("port", httpPort).Info("Running the rest handler") mux := runtime.NewServerMux() if err := pb.RegisterAllocationServiceHandlerServer(context.Background(), mux, h); err != nil { panic(err) } - runHTTP(h, httpPort, mux) + runHTTP(listenCtx, workerCtx, h, httpPort, mux) } -func runHTTP(h *serviceHandler, httpPort int, handler http.Handler) { +func runHTTP(listenCtx context.Context, workerCtx context.Context, h *serviceHandler, httpPort int, handler http.Handler) { cfg := &tls.Config{} if !h.tlsDisabled { cfg.GetCertificate = h.getTLSCert @@ -356,6 +368,11 @@ func runHTTP(h *serviceHandler, httpPort int, handler http.Handler) { } go func() { + go func() { + <-listenCtx.Done() + _ = server.Shutdown(workerCtx) + }() + var err error if !h.tlsDisabled { err = server.ListenAndServeTLS("", "") @@ -363,14 +380,17 @@ func runHTTP(h *serviceHandler, httpPort int, handler http.Handler) { err = server.ListenAndServe() } - if err != nil { + if err == http.ErrServerClosed { + logger.WithError(err).Info("HTTP/HTTPS server closed") + os.Exit(0) + } else { logger.WithError(err).Fatal("Unable to start HTTP/HTTPS listener") os.Exit(1) } }() } -func runGRPC(h *serviceHandler, grpcPort int) { +func runGRPC(ctx context.Context, h *serviceHandler, grpcHealth *grpchealth.Server, grpcPort int) { logger.WithField("port", grpcPort).Info("Running the grpc handler on port") listener, err := net.Listen("tcp", fmt.Sprintf(":%d", grpcPort)) if err != nil { @@ -380,11 +400,22 @@ func runGRPC(h *serviceHandler, grpcPort int) { grpcServer := grpc.NewServer(h.getGRPCServerOptions()...) pb.RegisterAllocationServiceServer(grpcServer, h) + grpc_health_v1.RegisterHealthServer(grpcServer, grpcHealth) go func() { + go func() { + <-ctx.Done() + grpcServer.GracefulStop() + }() + err := grpcServer.Serve(listener) - logger.WithError(err).Fatal("allocation service crashed") - os.Exit(1) + if err != nil { + logger.WithError(err).Fatal("allocation service crashed") + os.Exit(1) + } else { + logger.Info("allocation server closed") + os.Exit(0) + } }() } diff --git a/cmd/controller/main.go b/cmd/controller/main.go index a48dceaa41..115a8519af 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -20,7 +20,6 @@ import ( "encoding/json" "fmt" "io" - "net/http" "os" "path/filepath" "strings" @@ -54,6 +53,7 @@ import ( "agones.dev/agones/pkg/gameservers" "agones.dev/agones/pkg/gameserversets" "agones.dev/agones/pkg/metrics" + "agones.dev/agones/pkg/util/httpserver" "agones.dev/agones/pkg/util/runtime" "agones.dev/agones/pkg/util/signals" ) @@ -171,7 +171,7 @@ func main() { agonesInformerFactory := externalversions.NewSharedInformerFactory(agonesClient, defaultResync) kubeInformerFactory := informers.NewSharedInformerFactory(kubeClient, defaultResync) - server := &httpServer{} + server := &httpserver.Server{Logger: logger} var rs []runner var health healthcheck.Handler @@ -547,10 +547,6 @@ type runner interface { Run(ctx context.Context, workers int) error } -type httpServer struct { - http.ServeMux -} - func whenLeader(ctx context.Context, cancel context.CancelFunc, logger *logrus.Entry, doLeaderElection bool, kubeClient *kubernetes.Clientset, namespace string, start func(_ context.Context)) { if !doLeaderElection { start(ctx) @@ -600,22 +596,3 @@ func whenLeader(ctx context.Context, cancel context.CancelFunc, logger *logrus.E }, }) } - -func (h *httpServer) Run(_ context.Context, _ int) error { - logger.Info("Starting http server...") - srv := &http.Server{ - Addr: ":8080", - Handler: h, - } - defer srv.Close() // nolint: errcheck - - if err := srv.ListenAndServe(); err != nil { - if err == http.ErrServerClosed { - logger.WithError(err).Info("http server closed") - } else { - wrappedErr := errors.Wrap(err, "Could not listen on :8080") - runtime.HandleError(logger.WithError(wrappedErr), wrappedErr) - } - } - return nil -} diff --git a/cmd/extensions/main.go b/cmd/extensions/main.go index 31987b1037..d01be204f0 100644 --- a/cmd/extensions/main.go +++ b/cmd/extensions/main.go @@ -18,7 +18,6 @@ package main import ( "context" "io" - "net/http" "os" "path/filepath" "strings" @@ -46,6 +45,7 @@ import ( "agones.dev/agones/pkg/metrics" "agones.dev/agones/pkg/util/apiserver" "agones.dev/agones/pkg/util/https" + "agones.dev/agones/pkg/util/httpserver" "agones.dev/agones/pkg/util/runtime" "agones.dev/agones/pkg/util/signals" "agones.dev/agones/pkg/util/webhooks" @@ -150,7 +150,7 @@ func main() { agonesInformerFactory := externalversions.NewSharedInformerFactory(agonesClient, defaultResync) kubeInformerFactory := informers.NewSharedInformerFactory(kubeClient, defaultResync) - server := &httpServer{} + server := &httpserver.Server{Logger: logger} var health healthcheck.Handler // Stackdriver metrics @@ -340,26 +340,3 @@ type config struct { type runner interface { Run(ctx context.Context, workers int) error } - -type httpServer struct { - http.ServeMux -} - -func (h *httpServer) Run(_ context.Context, _ int) error { - logger.Info("Starting http server...") - srv := &http.Server{ - Addr: ":8080", - Handler: h, - } - defer srv.Close() // nolint: errcheck - - if err := srv.ListenAndServe(); err != nil { - if err == http.ErrServerClosed { - logger.WithError(err).Info("http server closed") - } else { - wrappedErr := errors.Wrap(err, "Could not listen on :8080") - runtime.HandleError(logger.WithError(wrappedErr), wrappedErr) - } - } - return nil -} diff --git a/go.mod b/go.mod index 6e5e5e6162..5c14ccafeb 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( contrib.go.opencensus.io/exporter/stackdriver v0.8.0 fortio.org/fortio v1.3.1 github.com/ahmetb/gen-crd-api-reference-docs v0.3.0 + github.com/evanphx/json-patch v4.12.0+incompatible github.com/fsnotify/fsnotify v1.6.0 github.com/go-openapi/spec v0.19.5 github.com/google/go-cmp v0.5.9 @@ -23,7 +24,6 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.16.0 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/cast v1.3.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.8.2 @@ -60,7 +60,6 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -94,6 +93,7 @@ require ( github.com/robfig/cron/v3 v3.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/cast v1.3.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect golang.org/x/crypto v0.21.0 // indirect diff --git a/pkg/apis/agones/v1/zz_generated.deepcopy.go b/pkg/apis/agones/v1/zz_generated.deepcopy.go index 5bba8c0e5b..92a802e624 100644 --- a/pkg/apis/agones/v1/zz_generated.deepcopy.go +++ b/pkg/apis/agones/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/apis/allocation/v1/zz_generated.deepcopy.go b/pkg/apis/allocation/v1/zz_generated.deepcopy.go index fc7d72250e..5063ad1506 100644 --- a/pkg/apis/allocation/v1/zz_generated.deepcopy.go +++ b/pkg/apis/allocation/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/apis/autoscaling/v1/zz_generated.deepcopy.go b/pkg/apis/autoscaling/v1/zz_generated.deepcopy.go index 02b5cb1661..f8cd7b55f1 100644 --- a/pkg/apis/autoscaling/v1/zz_generated.deepcopy.go +++ b/pkg/apis/autoscaling/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/apis/multicluster/v1/zz_generated.deepcopy.go b/pkg/apis/multicluster/v1/zz_generated.deepcopy.go index 8b32cd4204..a875537829 100644 --- a/pkg/apis/multicluster/v1/zz_generated.deepcopy.go +++ b/pkg/apis/multicluster/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/aggregatedcounterstatus.go b/pkg/client/applyconfiguration/agones/v1/aggregatedcounterstatus.go index 2608a8393b..6fce969f1f 100644 --- a/pkg/client/applyconfiguration/agones/v1/aggregatedcounterstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/aggregatedcounterstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/aggregatedliststatus.go b/pkg/client/applyconfiguration/agones/v1/aggregatedliststatus.go index 41f291d715..df35ed2dba 100644 --- a/pkg/client/applyconfiguration/agones/v1/aggregatedliststatus.go +++ b/pkg/client/applyconfiguration/agones/v1/aggregatedliststatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/aggregatedplayerstatus.go b/pkg/client/applyconfiguration/agones/v1/aggregatedplayerstatus.go index 71775c245f..7bce46291f 100644 --- a/pkg/client/applyconfiguration/agones/v1/aggregatedplayerstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/aggregatedplayerstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/allocationoverflow.go b/pkg/client/applyconfiguration/agones/v1/allocationoverflow.go index 4c7f6573e0..3bafcef5ce 100644 --- a/pkg/client/applyconfiguration/agones/v1/allocationoverflow.go +++ b/pkg/client/applyconfiguration/agones/v1/allocationoverflow.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/counterstatus.go b/pkg/client/applyconfiguration/agones/v1/counterstatus.go index aff52b4815..5224977770 100644 --- a/pkg/client/applyconfiguration/agones/v1/counterstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/counterstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/eviction.go b/pkg/client/applyconfiguration/agones/v1/eviction.go index a1fcc5a888..cc72468b50 100644 --- a/pkg/client/applyconfiguration/agones/v1/eviction.go +++ b/pkg/client/applyconfiguration/agones/v1/eviction.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/fleet.go b/pkg/client/applyconfiguration/agones/v1/fleet.go index 1f3030c668..170e3db718 100644 --- a/pkg/client/applyconfiguration/agones/v1/fleet.go +++ b/pkg/client/applyconfiguration/agones/v1/fleet.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/fleetspec.go b/pkg/client/applyconfiguration/agones/v1/fleetspec.go index a9a9126485..35cd0d88dd 100644 --- a/pkg/client/applyconfiguration/agones/v1/fleetspec.go +++ b/pkg/client/applyconfiguration/agones/v1/fleetspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/fleetstatus.go b/pkg/client/applyconfiguration/agones/v1/fleetstatus.go index 4b83841c2a..cee66f9ccb 100644 --- a/pkg/client/applyconfiguration/agones/v1/fleetstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/fleetstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserver.go b/pkg/client/applyconfiguration/agones/v1/gameserver.go index f4eeb2e7a1..c12507a821 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserver.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserverport.go b/pkg/client/applyconfiguration/agones/v1/gameserverport.go index d0766564a0..4d50f727b1 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserverport.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserverport.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserverset.go b/pkg/client/applyconfiguration/agones/v1/gameserverset.go index 4e9237ce60..d459d09cfa 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserverset.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserverset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserversetspec.go b/pkg/client/applyconfiguration/agones/v1/gameserversetspec.go index 95189d7692..3e79f97d74 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserversetspec.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserversetspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserversetstatus.go b/pkg/client/applyconfiguration/agones/v1/gameserversetstatus.go index 25b396eeb5..427178df94 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserversetstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserversetstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserverspec.go b/pkg/client/applyconfiguration/agones/v1/gameserverspec.go index 1870d82772..8992f48fec 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserverspec.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserverspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserverstatus.go b/pkg/client/applyconfiguration/agones/v1/gameserverstatus.go index 04e3968c75..4bac4fdc84 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserverstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserverstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameserverstatusport.go b/pkg/client/applyconfiguration/agones/v1/gameserverstatusport.go index cd90e08c7b..6a5f4a8834 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameserverstatusport.go +++ b/pkg/client/applyconfiguration/agones/v1/gameserverstatusport.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/gameservertemplatespec.go b/pkg/client/applyconfiguration/agones/v1/gameservertemplatespec.go index 3b0468fb7d..279aeff2dc 100644 --- a/pkg/client/applyconfiguration/agones/v1/gameservertemplatespec.go +++ b/pkg/client/applyconfiguration/agones/v1/gameservertemplatespec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/health.go b/pkg/client/applyconfiguration/agones/v1/health.go index 96368abee3..8eb8c229e4 100644 --- a/pkg/client/applyconfiguration/agones/v1/health.go +++ b/pkg/client/applyconfiguration/agones/v1/health.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/liststatus.go b/pkg/client/applyconfiguration/agones/v1/liststatus.go index 4329e54a79..879727fed0 100644 --- a/pkg/client/applyconfiguration/agones/v1/liststatus.go +++ b/pkg/client/applyconfiguration/agones/v1/liststatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/playersspec.go b/pkg/client/applyconfiguration/agones/v1/playersspec.go index 766337adc0..b43e60a98f 100644 --- a/pkg/client/applyconfiguration/agones/v1/playersspec.go +++ b/pkg/client/applyconfiguration/agones/v1/playersspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/playerstatus.go b/pkg/client/applyconfiguration/agones/v1/playerstatus.go index be475b7a97..2aa39a1be1 100644 --- a/pkg/client/applyconfiguration/agones/v1/playerstatus.go +++ b/pkg/client/applyconfiguration/agones/v1/playerstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/priority.go b/pkg/client/applyconfiguration/agones/v1/priority.go index 05627a119a..6f78f34219 100644 --- a/pkg/client/applyconfiguration/agones/v1/priority.go +++ b/pkg/client/applyconfiguration/agones/v1/priority.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/agones/v1/sdkserver.go b/pkg/client/applyconfiguration/agones/v1/sdkserver.go index 828b7932bc..eaad7482fe 100644 --- a/pkg/client/applyconfiguration/agones/v1/sdkserver.go +++ b/pkg/client/applyconfiguration/agones/v1/sdkserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/bufferpolicy.go b/pkg/client/applyconfiguration/autoscaling/v1/bufferpolicy.go index 5503e1b2d5..246e80fff3 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/bufferpolicy.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/bufferpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/counterpolicy.go b/pkg/client/applyconfiguration/autoscaling/v1/counterpolicy.go index a47e73130c..7bca4e0417 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/counterpolicy.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/counterpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fixedintervalsync.go b/pkg/client/applyconfiguration/autoscaling/v1/fixedintervalsync.go index a897768284..44de0a9aa2 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fixedintervalsync.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fixedintervalsync.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscaler.go b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscaler.go index 600f89b2de..aaa8a129d8 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscaler.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscaler.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerpolicy.go b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerpolicy.go index c1d9b00dfd..1441bd4eee 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerpolicy.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerspec.go b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerspec.go index 804d70be1e..631b5cc5de 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerspec.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerstatus.go b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerstatus.go index 705bb92957..5e9ccf3a59 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerstatus.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerstatus.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalersync.go b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalersync.go index 5826450554..b80ce3a35f 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalersync.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalersync.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/listpolicy.go b/pkg/client/applyconfiguration/autoscaling/v1/listpolicy.go index a4489d3c6f..10be5846bf 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/listpolicy.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/listpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/autoscaling/v1/webhookpolicy.go b/pkg/client/applyconfiguration/autoscaling/v1/webhookpolicy.go index 806207e900..217d020b99 100644 --- a/pkg/client/applyconfiguration/autoscaling/v1/webhookpolicy.go +++ b/pkg/client/applyconfiguration/autoscaling/v1/webhookpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/internal/internal.go b/pkg/client/applyconfiguration/internal/internal.go index 5dfdc1101f..11861c1ab2 100644 --- a/pkg/client/applyconfiguration/internal/internal.go +++ b/pkg/client/applyconfiguration/internal/internal.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/multicluster/v1/clusterconnectioninfo.go b/pkg/client/applyconfiguration/multicluster/v1/clusterconnectioninfo.go index 4a6280c7ca..60f640f198 100644 --- a/pkg/client/applyconfiguration/multicluster/v1/clusterconnectioninfo.go +++ b/pkg/client/applyconfiguration/multicluster/v1/clusterconnectioninfo.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicy.go b/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicy.go index 178aa038cf..b8e9b9ae3d 100644 --- a/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicy.go +++ b/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicyspec.go b/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicyspec.go index ddfcf4bde1..4f969d4722 100644 --- a/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicyspec.go +++ b/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicyspec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go index 88e0bb5401..57e9be63bf 100644 --- a/pkg/client/applyconfiguration/utils.go +++ b/pkg/client/applyconfiguration/utils.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 069c2e1e5b..e658fb04ef 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index f42399dd06..f0c3142a4c 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go index 49a678fa23..c27e45abb4 100644 --- a/pkg/client/clientset/versioned/fake/doc.go +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 9ccfefbe2e..efadc517dc 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go index c1ba9cb285..420ba83698 100644 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 2af8b6515c..325f0833ab 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/agones_client.go b/pkg/client/clientset/versioned/typed/agones/v1/agones_client.go index ea47c5fc23..a51c7dd7ff 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/agones_client.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/agones_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/doc.go b/pkg/client/clientset/versioned/typed/agones/v1/doc.go index 2eefc71236..fa2914eb47 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/agones/v1/fake/doc.go index 149efaffad..ce141bf145 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_agones_client.go b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_agones_client.go index 243f4351fb..911a823ce1 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_agones_client.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_agones_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_fleet.go b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_fleet.go index 8f73ea6676..9c4bd7e262 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_fleet.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_fleet.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserver.go b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserver.go index b871f0f0cd..2034e51558 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserver.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserverset.go b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserverset.go index e7405bbf88..34b6a30760 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserverset.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fake/fake_gameserverset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/fleet.go b/pkg/client/clientset/versioned/typed/agones/v1/fleet.go index ade1ca84ce..b4d6523884 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/fleet.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/fleet.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/gameserver.go b/pkg/client/clientset/versioned/typed/agones/v1/gameserver.go index b458b1aaea..5ec6c9f52d 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/gameserver.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/gameserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/gameserverset.go b/pkg/client/clientset/versioned/typed/agones/v1/gameserverset.go index d6bbc07044..bfd1c12b44 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/gameserverset.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/gameserverset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/agones/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/agones/v1/generated_expansion.go index 8dfee819e4..b9851b422b 100644 --- a/pkg/client/clientset/versioned/typed/agones/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/agones/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/allocation_client.go b/pkg/client/clientset/versioned/typed/allocation/v1/allocation_client.go index 1eb5e25c58..aa8e16d4fc 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/allocation_client.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/allocation_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/doc.go b/pkg/client/clientset/versioned/typed/allocation/v1/doc.go index 2eefc71236..fa2914eb47 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/allocation/v1/fake/doc.go index 149efaffad..ce141bf145 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_allocation_client.go b/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_allocation_client.go index 94718c57fc..82175a0c60 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_allocation_client.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_allocation_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_gameserverallocation.go b/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_gameserverallocation.go index 31b262b19f..6d4351b805 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_gameserverallocation.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/fake/fake_gameserverallocation.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/gameserverallocation.go b/pkg/client/clientset/versioned/typed/allocation/v1/gameserverallocation.go index 742be97ce8..74f53dfafe 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/gameserverallocation.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/gameserverallocation.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/allocation/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/allocation/v1/generated_expansion.go index cb687b5426..0c1932382f 100644 --- a/pkg/client/clientset/versioned/typed/allocation/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/allocation/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/autoscaling_client.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/autoscaling_client.go index 722b171a25..6a01558cc9 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/autoscaling_client.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/autoscaling_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/doc.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/doc.go index 2eefc71236..fa2914eb47 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/doc.go index 149efaffad..ce141bf145 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_autoscaling_client.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_autoscaling_client.go index a36793a056..f7e4f24f41 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_autoscaling_client.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_autoscaling_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_fleetautoscaler.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_fleetautoscaler.go index 232a42f136..64d0a73b1c 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_fleetautoscaler.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/fake/fake_fleetautoscaler.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/fleetautoscaler.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/fleetautoscaler.go index bad2b02394..98afbb8881 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/fleetautoscaler.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/fleetautoscaler.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/autoscaling/v1/generated_expansion.go index 151d477372..45e1ec9cc5 100644 --- a/pkg/client/clientset/versioned/typed/autoscaling/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/doc.go b/pkg/client/clientset/versioned/typed/multicluster/v1/doc.go index 2eefc71236..fa2914eb47 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/doc.go index 149efaffad..ce141bf145 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_gameserverallocationpolicy.go b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_gameserverallocationpolicy.go index 7be340034c..a207a71659 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_gameserverallocationpolicy.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_gameserverallocationpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_multicluster_client.go b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_multicluster_client.go index d427f60917..bafcb07157 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_multicluster_client.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/fake/fake_multicluster_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/gameserverallocationpolicy.go b/pkg/client/clientset/versioned/typed/multicluster/v1/gameserverallocationpolicy.go index 143e55f670..9caca4e426 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/gameserverallocationpolicy.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/gameserverallocationpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/multicluster/v1/generated_expansion.go index 1c1106c623..a002645346 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/clientset/versioned/typed/multicluster/v1/multicluster_client.go b/pkg/client/clientset/versioned/typed/multicluster/v1/multicluster_client.go index bd694ec486..211ecdb1b2 100644 --- a/pkg/client/clientset/versioned/typed/multicluster/v1/multicluster_client.go +++ b/pkg/client/clientset/versioned/typed/multicluster/v1/multicluster_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/agones/interface.go b/pkg/client/informers/externalversions/agones/interface.go index 6281975f15..ed754d0225 100644 --- a/pkg/client/informers/externalversions/agones/interface.go +++ b/pkg/client/informers/externalversions/agones/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/agones/v1/fleet.go b/pkg/client/informers/externalversions/agones/v1/fleet.go index 9dfb7be635..725ca1aa72 100644 --- a/pkg/client/informers/externalversions/agones/v1/fleet.go +++ b/pkg/client/informers/externalversions/agones/v1/fleet.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/agones/v1/gameserver.go b/pkg/client/informers/externalversions/agones/v1/gameserver.go index 89e91eae05..2b8a9acc5a 100644 --- a/pkg/client/informers/externalversions/agones/v1/gameserver.go +++ b/pkg/client/informers/externalversions/agones/v1/gameserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/agones/v1/gameserverset.go b/pkg/client/informers/externalversions/agones/v1/gameserverset.go index cc068ec87b..a481bd826b 100644 --- a/pkg/client/informers/externalversions/agones/v1/gameserverset.go +++ b/pkg/client/informers/externalversions/agones/v1/gameserverset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/agones/v1/interface.go b/pkg/client/informers/externalversions/agones/v1/interface.go index 2bcbed4c53..8342e4e8d7 100644 --- a/pkg/client/informers/externalversions/agones/v1/interface.go +++ b/pkg/client/informers/externalversions/agones/v1/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/autoscaling/interface.go b/pkg/client/informers/externalversions/autoscaling/interface.go index 998e429100..7631d94503 100644 --- a/pkg/client/informers/externalversions/autoscaling/interface.go +++ b/pkg/client/informers/externalversions/autoscaling/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/autoscaling/v1/fleetautoscaler.go b/pkg/client/informers/externalversions/autoscaling/v1/fleetautoscaler.go index 9e17dcd4a7..23018c965d 100644 --- a/pkg/client/informers/externalversions/autoscaling/v1/fleetautoscaler.go +++ b/pkg/client/informers/externalversions/autoscaling/v1/fleetautoscaler.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/autoscaling/v1/interface.go b/pkg/client/informers/externalversions/autoscaling/v1/interface.go index c634311308..142085f198 100644 --- a/pkg/client/informers/externalversions/autoscaling/v1/interface.go +++ b/pkg/client/informers/externalversions/autoscaling/v1/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index ad977a9597..9782803168 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 64e2b11aa1..315fdbe08a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index dca998484a..b3de7493f9 100644 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/multicluster/interface.go b/pkg/client/informers/externalversions/multicluster/interface.go index a7a6e18d72..d9580e8c66 100644 --- a/pkg/client/informers/externalversions/multicluster/interface.go +++ b/pkg/client/informers/externalversions/multicluster/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/multicluster/v1/gameserverallocationpolicy.go b/pkg/client/informers/externalversions/multicluster/v1/gameserverallocationpolicy.go index db7c145b62..9026274ae6 100644 --- a/pkg/client/informers/externalversions/multicluster/v1/gameserverallocationpolicy.go +++ b/pkg/client/informers/externalversions/multicluster/v1/gameserverallocationpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/informers/externalversions/multicluster/v1/interface.go b/pkg/client/informers/externalversions/multicluster/v1/interface.go index 8658dd5595..e657029f85 100644 --- a/pkg/client/informers/externalversions/multicluster/v1/interface.go +++ b/pkg/client/informers/externalversions/multicluster/v1/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/agones/v1/expansion_generated.go b/pkg/client/listers/agones/v1/expansion_generated.go index 4e735222fc..d96ec37d31 100644 --- a/pkg/client/listers/agones/v1/expansion_generated.go +++ b/pkg/client/listers/agones/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/agones/v1/fleet.go b/pkg/client/listers/agones/v1/fleet.go index 755830db99..9429379bb0 100644 --- a/pkg/client/listers/agones/v1/fleet.go +++ b/pkg/client/listers/agones/v1/fleet.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/agones/v1/gameserver.go b/pkg/client/listers/agones/v1/gameserver.go index 6986bb97fc..ac74f8e863 100644 --- a/pkg/client/listers/agones/v1/gameserver.go +++ b/pkg/client/listers/agones/v1/gameserver.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/agones/v1/gameserverset.go b/pkg/client/listers/agones/v1/gameserverset.go index 2aca35e01a..e703f038ad 100644 --- a/pkg/client/listers/agones/v1/gameserverset.go +++ b/pkg/client/listers/agones/v1/gameserverset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/autoscaling/v1/expansion_generated.go b/pkg/client/listers/autoscaling/v1/expansion_generated.go index 38529b0ead..8e4cc95858 100644 --- a/pkg/client/listers/autoscaling/v1/expansion_generated.go +++ b/pkg/client/listers/autoscaling/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/autoscaling/v1/fleetautoscaler.go b/pkg/client/listers/autoscaling/v1/fleetautoscaler.go index 92060ceb6c..628958cb89 100644 --- a/pkg/client/listers/autoscaling/v1/fleetautoscaler.go +++ b/pkg/client/listers/autoscaling/v1/fleetautoscaler.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/multicluster/v1/expansion_generated.go b/pkg/client/listers/multicluster/v1/expansion_generated.go index d161774279..c106629e40 100644 --- a/pkg/client/listers/multicluster/v1/expansion_generated.go +++ b/pkg/client/listers/multicluster/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/client/listers/multicluster/v1/gameserverallocationpolicy.go b/pkg/client/listers/multicluster/v1/gameserverallocationpolicy.go index 58d6a97d9e..38535eef6a 100644 --- a/pkg/client/listers/multicluster/v1/gameserverallocationpolicy.go +++ b/pkg/client/listers/multicluster/v1/gameserverallocationpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/alpha/alpha.pb.go b/pkg/sdk/alpha/alpha.pb.go index ad7b760e4b..ae663a9b13 100644 --- a/pkg/sdk/alpha/alpha.pb.go +++ b/pkg/sdk/alpha/alpha.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/alpha/alpha.pb.gw.go b/pkg/sdk/alpha/alpha.pb.gw.go index 4cebb86351..9d5296fd54 100644 --- a/pkg/sdk/alpha/alpha.pb.gw.go +++ b/pkg/sdk/alpha/alpha.pb.gw.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/alpha/alpha_grpc.pb.go b/pkg/sdk/alpha/alpha_grpc.pb.go index c4ea827209..153e95860b 100644 --- a/pkg/sdk/alpha/alpha_grpc.pb.go +++ b/pkg/sdk/alpha/alpha_grpc.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/beta/beta.pb.go b/pkg/sdk/beta/beta.pb.go index 05caebb831..5c7bb10c75 100644 --- a/pkg/sdk/beta/beta.pb.go +++ b/pkg/sdk/beta/beta.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/beta/beta.pb.gw.go b/pkg/sdk/beta/beta.pb.gw.go index 3ca52d3c3c..3fc4577dd0 100644 --- a/pkg/sdk/beta/beta.pb.gw.go +++ b/pkg/sdk/beta/beta.pb.gw.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/beta/beta_grpc.pb.go b/pkg/sdk/beta/beta_grpc.pb.go index a52f32c956..889552efe9 100644 --- a/pkg/sdk/beta/beta_grpc.pb.go +++ b/pkg/sdk/beta/beta_grpc.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/sdk.pb.go b/pkg/sdk/sdk.pb.go index fade8499ae..41372a607e 100644 --- a/pkg/sdk/sdk.pb.go +++ b/pkg/sdk/sdk.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/sdk.pb.gw.go b/pkg/sdk/sdk.pb.gw.go index 8f820cbc58..b652044247 100644 --- a/pkg/sdk/sdk.pb.gw.go +++ b/pkg/sdk/sdk.pb.gw.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/sdk/sdk_grpc.pb.go b/pkg/sdk/sdk_grpc.pb.go index e4c3b06ff0..96cea069e3 100644 --- a/pkg/sdk/sdk_grpc.pb.go +++ b/pkg/sdk/sdk_grpc.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/util/https/server.go b/pkg/util/https/server.go index 34a2a471b8..7d472fd8c7 100644 --- a/pkg/util/https/server.go +++ b/pkg/util/https/server.go @@ -33,7 +33,7 @@ const ( // tls is a http server interface to enable easier testing type tls interface { - Close() error + Shutdown(context.Context) error ListenAndServeTLS(certFile, keyFile string) error } @@ -126,7 +126,7 @@ func (s *Server) WatchForCertificateChanges() (func(), error) { func (s *Server) Run(ctx context.Context, _ int) error { go func() { <-ctx.Done() - s.tls.Close() // nolint: errcheck,gosec + _ = s.tls.Shutdown(context.Background()) }() s.logger.WithField("server", s).Infof("https server started") diff --git a/pkg/util/https/server_test.go b/pkg/util/https/server_test.go index 95348e6308..a03739f453 100644 --- a/pkg/util/https/server_test.go +++ b/pkg/util/https/server_test.go @@ -27,7 +27,7 @@ type testServer struct { server *httptest.Server } -func (ts *testServer) Close() error { +func (ts *testServer) Shutdown(_ context.Context) error { ts.server.Close() return nil } diff --git a/pkg/util/httpserver/server.go b/pkg/util/httpserver/server.go new file mode 100644 index 0000000000..2a4811fdc5 --- /dev/null +++ b/pkg/util/httpserver/server.go @@ -0,0 +1,59 @@ +// Copyright 2024 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpserver implements an http server that conforms to the +// controller runner interface. +package httpserver + +import ( + "context" + "net/http" + + "agones.dev/agones/pkg/util/runtime" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +// Server is a HTTPs server that conforms to the runner interface +// we use in /cmd/controller. +// +//nolint:govet // ignore field alignment complaint, this is a singleton +type Server struct { + http.ServeMux + + Logger *logrus.Entry +} + +// Run runs an http server on port :8080. +func (s *Server) Run(ctx context.Context, _ int) error { + s.Logger.Info("Starting http server...") + srv := &http.Server{ + Addr: ":8080", + Handler: s, + } + go func() { + <-ctx.Done() + _ = srv.Shutdown(context.Background()) + }() + + if err := srv.ListenAndServe(); err != nil { + if err == http.ErrServerClosed { + s.Logger.WithError(err).Info("http server closed") + } else { + wrappedErr := errors.Wrap(err, "Could not listen on :8080") + runtime.HandleError(s.Logger.WithError(wrappedErr), wrappedErr) + } + } + return nil +} diff --git a/sdks/cpp/include/agones/sdk.grpc.pb.h b/sdks/cpp/include/agones/sdk.grpc.pb.h index 97ac497e5b..9b8ff5acf0 100644 --- a/sdks/cpp/include/agones/sdk.grpc.pb.h +++ b/sdks/cpp/include/agones/sdk.grpc.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/include/agones/sdk.pb.h b/sdks/cpp/include/agones/sdk.pb.h index 63c0fdce55..03f85b97a3 100644 --- a/sdks/cpp/include/agones/sdk.pb.h +++ b/sdks/cpp/include/agones/sdk.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/include/google/api/annotations.pb.h b/sdks/cpp/include/google/api/annotations.pb.h index f14b4814e2..177ac5e1be 100644 --- a/sdks/cpp/include/google/api/annotations.pb.h +++ b/sdks/cpp/include/google/api/annotations.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/include/google/api/http.pb.h b/sdks/cpp/include/google/api/http.pb.h index d7a3900e0f..bb963f8a22 100644 --- a/sdks/cpp/include/google/api/http.pb.h +++ b/sdks/cpp/include/google/api/http.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/include/protoc-gen-openapiv2/options/annotations.pb.h b/sdks/cpp/include/protoc-gen-openapiv2/options/annotations.pb.h index 53fca248b3..e8d1f68e93 100644 --- a/sdks/cpp/include/protoc-gen-openapiv2/options/annotations.pb.h +++ b/sdks/cpp/include/protoc-gen-openapiv2/options/annotations.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/include/protoc-gen-openapiv2/options/openapiv2.pb.h b/sdks/cpp/include/protoc-gen-openapiv2/options/openapiv2.pb.h index e613dc26f7..48dabd8b15 100644 --- a/sdks/cpp/include/protoc-gen-openapiv2/options/openapiv2.pb.h +++ b/sdks/cpp/include/protoc-gen-openapiv2/options/openapiv2.pb.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/agones/sdk.grpc.pb.cc b/sdks/cpp/src/agones/sdk.grpc.pb.cc index 0f55fe439c..57ff3a8ac7 100644 --- a/sdks/cpp/src/agones/sdk.grpc.pb.cc +++ b/sdks/cpp/src/agones/sdk.grpc.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/agones/sdk.pb.cc b/sdks/cpp/src/agones/sdk.pb.cc index 230d03f507..2ccd379980 100644 --- a/sdks/cpp/src/agones/sdk.pb.cc +++ b/sdks/cpp/src/agones/sdk.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/google/annotations.pb.cc b/sdks/cpp/src/google/annotations.pb.cc index 362b88c90b..27a838670e 100644 --- a/sdks/cpp/src/google/annotations.pb.cc +++ b/sdks/cpp/src/google/annotations.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/google/http.pb.cc b/sdks/cpp/src/google/http.pb.cc index 23b38bef3d..91591510f7 100644 --- a/sdks/cpp/src/google/http.pb.cc +++ b/sdks/cpp/src/google/http.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/protoc-gen-openapiv2/annotations.pb.cc b/sdks/cpp/src/protoc-gen-openapiv2/annotations.pb.cc index 2e3d2f6da5..a109970732 100644 --- a/sdks/cpp/src/protoc-gen-openapiv2/annotations.pb.cc +++ b/sdks/cpp/src/protoc-gen-openapiv2/annotations.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/cpp/src/protoc-gen-openapiv2/openapiv2.pb.cc b/sdks/cpp/src/protoc-gen-openapiv2/openapiv2.pb.cc index 047f71693b..5f8fcd17ad 100644 --- a/sdks/cpp/src/protoc-gen-openapiv2/openapiv2.pb.cc +++ b/sdks/cpp/src/protoc-gen-openapiv2/openapiv2.pb.cc @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js index b798c82be1..0517f349aa 100644 --- a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/alpha_pb.js b/sdks/nodejs/lib/alpha/alpha_pb.js index 47dceaf890..bca104b3f5 100644 --- a/sdks/nodejs/lib/alpha/alpha_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/google/api/annotations_pb.js b/sdks/nodejs/lib/alpha/google/api/annotations_pb.js index fbfedf1b12..bcfb5ebe81 100644 --- a/sdks/nodejs/lib/alpha/google/api/annotations_pb.js +++ b/sdks/nodejs/lib/alpha/google/api/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/google/api/http_pb.js b/sdks/nodejs/lib/alpha/google/api/http_pb.js index 28eebe9f0d..c05531bd54 100644 --- a/sdks/nodejs/lib/alpha/google/api/http_pb.js +++ b/sdks/nodejs/lib/alpha/google/api/http_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/annotations_pb.js b/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/annotations_pb.js index b4c8aff3ff..f185b0b67a 100644 --- a/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/annotations_pb.js +++ b/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/openapiv2_pb.js b/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/openapiv2_pb.js index e34a7e5065..0788135194 100644 --- a/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/openapiv2_pb.js +++ b/sdks/nodejs/lib/alpha/protoc-gen-openapiv2/options/openapiv2_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/beta_grpc_pb.js b/sdks/nodejs/lib/beta/beta_grpc_pb.js index bc0f1bf2c4..22716e4f2d 100644 --- a/sdks/nodejs/lib/beta/beta_grpc_pb.js +++ b/sdks/nodejs/lib/beta/beta_grpc_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/beta_pb.js b/sdks/nodejs/lib/beta/beta_pb.js index bf935feb9f..ccf9a5ec81 100644 --- a/sdks/nodejs/lib/beta/beta_pb.js +++ b/sdks/nodejs/lib/beta/beta_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/google/api/annotations_pb.js b/sdks/nodejs/lib/beta/google/api/annotations_pb.js index fbfedf1b12..bcfb5ebe81 100644 --- a/sdks/nodejs/lib/beta/google/api/annotations_pb.js +++ b/sdks/nodejs/lib/beta/google/api/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/google/api/http_pb.js b/sdks/nodejs/lib/beta/google/api/http_pb.js index 28eebe9f0d..c05531bd54 100644 --- a/sdks/nodejs/lib/beta/google/api/http_pb.js +++ b/sdks/nodejs/lib/beta/google/api/http_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/annotations_pb.js b/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/annotations_pb.js index b4c8aff3ff..f185b0b67a 100644 --- a/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/annotations_pb.js +++ b/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/openapiv2_pb.js b/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/openapiv2_pb.js index e34a7e5065..0788135194 100644 --- a/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/openapiv2_pb.js +++ b/sdks/nodejs/lib/beta/protoc-gen-openapiv2/options/openapiv2_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/google/api/annotations_pb.js b/sdks/nodejs/lib/google/api/annotations_pb.js index fbfedf1b12..bcfb5ebe81 100644 --- a/sdks/nodejs/lib/google/api/annotations_pb.js +++ b/sdks/nodejs/lib/google/api/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/google/api/http_pb.js b/sdks/nodejs/lib/google/api/http_pb.js index 28eebe9f0d..c05531bd54 100644 --- a/sdks/nodejs/lib/google/api/http_pb.js +++ b/sdks/nodejs/lib/google/api/http_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/protoc-gen-openapiv2/options/annotations_pb.js b/sdks/nodejs/lib/protoc-gen-openapiv2/options/annotations_pb.js index b4c8aff3ff..f185b0b67a 100644 --- a/sdks/nodejs/lib/protoc-gen-openapiv2/options/annotations_pb.js +++ b/sdks/nodejs/lib/protoc-gen-openapiv2/options/annotations_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/protoc-gen-openapiv2/options/openapiv2_pb.js b/sdks/nodejs/lib/protoc-gen-openapiv2/options/openapiv2_pb.js index e34a7e5065..0788135194 100644 --- a/sdks/nodejs/lib/protoc-gen-openapiv2/options/openapiv2_pb.js +++ b/sdks/nodejs/lib/protoc-gen-openapiv2/options/openapiv2_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/sdk_grpc_pb.js b/sdks/nodejs/lib/sdk_grpc_pb.js index 3c4b55e7b8..049ba5b3ed 100644 --- a/sdks/nodejs/lib/sdk_grpc_pb.js +++ b/sdks/nodejs/lib/sdk_grpc_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/sdks/nodejs/lib/sdk_pb.js b/sdks/nodejs/lib/sdk_pb.js index bab08877a0..4ea5013b8c 100644 --- a/sdks/nodejs/lib/sdk_pb.js +++ b/sdks/nodejs/lib/sdk_pb.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/e2e/allocator/pod_termination_test.go b/test/e2e/allocator/pod_termination_test.go index fc051b739a..60ade418a8 100644 --- a/test/e2e/allocator/pod_termination_test.go +++ b/test/e2e/allocator/pod_termination_test.go @@ -26,7 +26,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/status" - v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/wait" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,34 +41,23 @@ func TestAllocatorAfterDeleteReplica(t *testing.T) { ctx := context.Background() logger := e2e.TestLogger(t) - var list *v1.PodList - - dep, err := framework.KubeClient.AppsV1().Deployments("agones-system").Get(ctx, "agones-allocator", metav1.GetOptions{}) - require.NoError(t, err, "Failed to get replicas") - replicaCnt := int(*(dep.Spec.Replicas)) - logger.Infof("Replica count config is %d", replicaCnt) + // initialize gRPC client, which tests the connection + grpcClient, err := helper.GetAllocatorClient(ctx, t, framework) + require.NoError(t, err, "Could not initialize rpc client") - // poll and wait until all allocator pods are running - _ = wait.PollUntilContextTimeout(context.Background(), retryInterval, retryTimeout, true, func(ctx context.Context) (done bool, err error) { - list, err = helper.GetAgonesAllocatorPods(ctx, framework) + // poll and wait until all allocator pods are available + err = wait.PollUntilContextTimeout(context.Background(), retryInterval, retryTimeout, true, func(ctx context.Context) (done bool, err error) { + deployment, err := framework.KubeClient.AppsV1().Deployments("agones-system").Get(ctx, "agones-allocator", metav1.GetOptions{}) if err != nil { return true, err } - - if len(list.Items) != replicaCnt { + if deployment.Status.Replicas != deployment.Status.AvailableReplicas { + logger.Infof("Waiting for agones-allocator to stabilize: %d/%d replicas available", deployment.Status.AvailableReplicas, deployment.Status.ReadyReplicas) return false, nil } - - for _, allocpod := range list.Items { - podstatus := string(allocpod.Status.Phase) - logger.Infof("Allocator Pod %s, has status of %s", allocpod.ObjectMeta.Name, podstatus) - if podstatus != "Running" { - return false, nil - } - } - return true, nil }) + require.NoError(t, err, "Failed to stabilize agones-allocator") // create fleet flt, err := helper.CreateFleet(ctx, framework.Namespace, framework) @@ -77,7 +66,23 @@ func TestAllocatorAfterDeleteReplica(t *testing.T) { } framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - var response *pb.AllocationResponse + logger.Infof("=== agones-allocator available, gRPC client initialized ===") + + // One probe into the test, delete all of the allocators except 1 + go func() { + time.Sleep(retryInterval) + + list, err := framework.KubeClient.CoreV1().Pods("agones-system").List( + ctx, metav1.ListOptions{LabelSelector: labels.Set{"multicluster.agones.dev/role": "allocator"}.String()}) + if assert.NoError(t, err, "Could not list allocator pods") { + for _, pod := range list.Items[1:] { + logger.Infof("Deleting Pod %s", pod.ObjectMeta.Name) + err = helper.DeleteAgonesPod(ctx, pod.ObjectMeta.Name, "agones-system", framework) + assert.NoError(t, err, "Could not delete allocator pod") + } + } + }() + request := &pb.AllocationRequest{ Namespace: framework.Namespace, PreferredGameServerSelectors: []*pb.GameServerSelector{{MatchLabels: map[string]string{agonesv1.FleetNameLabel: flt.ObjectMeta.Name}}}, @@ -85,23 +90,18 @@ func TestAllocatorAfterDeleteReplica(t *testing.T) { Metadata: &pb.MetaPatch{Labels: map[string]string{"gslabel": "allocatedbytest"}}, } - // delete all of the allocators except 1 - for _, pod := range list.Items[1:] { - err = helper.DeleteAgonesAllocatorPod(ctx, pod.ObjectMeta.Name, framework) - require.NoError(t, err, "Could not delete allocator pod") - } - - grpcClient, err := helper.GetAllocatorClient(ctx, t, framework) - require.NoError(t, err, "Could not initialize rpc client") - // Wait and keep making calls till we know the draining time has passed _ = wait.PollUntilContextTimeout(context.Background(), retryInterval, retryTimeout, true, func(ctx context.Context) (bool, error) { - response, err = grpcClient.Allocate(context.Background(), request) + ctx, cancelCtx := context.WithTimeout(ctx, retryInterval*2) + defer cancelCtx() + + response, err := grpcClient.Allocate(ctx, request) logger.Infof("err = %v (code = %v), response = %v", err, status.Code(err), response) - helper.ValidateAllocatorResponse(t, response) - require.NoError(t, err, "Failed grpc allocation request") - err = helper.DeleteAgonesPod(ctx, response.GameServerName, framework.Namespace, framework) - require.NoError(t, err, "Failed to delete game server pod %s", response.GameServerName) + if assert.NoError(t, err, "Failed grpc allocation request") { + helper.ValidateAllocatorResponse(t, response) + err = helper.DeleteAgonesPod(ctx, response.GameServerName, framework.Namespace, framework) + assert.NoError(t, err, "Failed to delete game server pod %s", response.GameServerName) + } return false, nil }) } diff --git a/test/e2e/allocator_test.go b/test/e2e/allocator_test.go index 0997a95a65..4e79a3831b 100644 --- a/test/e2e/allocator_test.go +++ b/test/e2e/allocator_test.go @@ -87,12 +87,12 @@ func TestAllocatorWithDeprecatedRequired(t *testing.T) { // wait for the allocation system to come online err = wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { // create the grpc client each time, as we may end up looking at an old cert - dialOpts, err := helper.CreateRemoteClusterDialOption(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) + dialOpts, err := helper.CreateRemoteClusterDialOptions(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) if err != nil { return false, err } - conn, err := grpc.Dial(requestURL, dialOpts) + conn, err := grpc.Dial(requestURL, dialOpts...) if err != nil { logrus.WithError(err).Info("failing grpc.Dial") return false, nil @@ -181,12 +181,12 @@ func TestAllocatorWithSelectors(t *testing.T) { // wait for the allocation system to come online err = wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { // create the grpc client each time, as we may end up looking at an old cert - dialOpts, err := helper.CreateRemoteClusterDialOption(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) + dialOpts, err := helper.CreateRemoteClusterDialOptions(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) if err != nil { return false, err } - conn, err := grpc.Dial(requestURL, dialOpts) + conn, err := grpc.Dial(requestURL, dialOpts...) if err != nil { logrus.WithError(err).Info("failing grpc.Dial") return false, nil @@ -357,11 +357,11 @@ func TestAllocatorWithCountersAndLists(t *testing.T) { }, } err = wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { - dialOpts, err := helper.CreateRemoteClusterDialOption(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) + dialOpts, err := helper.CreateRemoteClusterDialOptions(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) if err != nil { return false, err } - conn, err := grpc.Dial(requestURL, dialOpts) + conn, err := grpc.Dial(requestURL, dialOpts...) if err != nil { logrus.WithError(err).Info("failing grpc.Dial") return false, nil @@ -612,12 +612,12 @@ func TestAllocatorCrossNamespace(t *testing.T) { // wait for the allocation system to come online err = wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { // create the grpc client each time, as we may end up looking at an old cert - dialOpts, err := helper.CreateRemoteClusterDialOption(ctx, namespaceA, allocatorClientSecretName, tlsCA, framework) + dialOpts, err := helper.CreateRemoteClusterDialOptions(ctx, namespaceA, allocatorClientSecretName, tlsCA, framework) if err != nil { return false, err } - conn, err := grpc.Dial(requestURL, dialOpts) + conn, err := grpc.Dial(requestURL, dialOpts...) if err != nil { logrus.WithError(err).Info("failing grpc.Dial") return false, nil diff --git a/test/e2e/allochelper/helper_func.go b/test/e2e/allochelper/helper_func.go index 9f2ff6721b..f2fbf0bd7b 100644 --- a/test/e2e/allochelper/helper_func.go +++ b/test/e2e/allochelper/helper_func.go @@ -38,8 +38,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" - corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" @@ -56,6 +56,21 @@ const ( allocatorClientSecretName = "allocator-client.default" allocatorClientSecretNamespace = "default" replicasCount = 5 + + gRPCRetryPolicy = `{ + "methodConfig": [{ + "name": [{}], + "waitForReady": true, + + "retryPolicy": { + "MaxAttempts": 4, + "InitialBackoff": ".01s", + "MaxBackoff": ".01s", + "BackoffMultiplier": 1.0, + "RetryableStatusCodes": [ "UNAVAILABLE" ] + } + }] + }` ) // CopyDefaultAllocatorClientSecret copys the allocator client secret @@ -106,16 +121,26 @@ func GetAllocatorEndpoint(ctx context.Context, t *testing.T, framework *e2e.Fram return svc.Status.LoadBalancer.Ingress[0].IP, port.Port } -// CreateRemoteClusterDialOption creates a grpc client dial option with proper certs to make a remote call. -// -//nolint:unparam -func CreateRemoteClusterDialOption(ctx context.Context, namespace, clientSecretName string, tlsCA []byte, framework *e2e.Framework) (grpc.DialOption, error) { +// CreateRemoteClusterDialOptions creates a grpc client dial option with proper certs to make a remote call. +func CreateRemoteClusterDialOptions(ctx context.Context, namespace, clientSecretName string, tlsCA []byte, framework *e2e.Framework) ([]grpc.DialOption, error) { tlsConfig, err := GetTLSConfig(ctx, namespace, clientSecretName, tlsCA, framework) if err != nil { return nil, err } - return grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)), nil + return []grpc.DialOption{ + grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)), + grpc.WithDefaultServiceConfig(gRPCRetryPolicy), + grpc.WithConnectParams(grpc.ConnectParams{ + Backoff: backoff.Config{ + BaseDelay: time.Duration(100) * time.Millisecond, + Multiplier: 1.6, + Jitter: 0.2, + MaxDelay: 30 * time.Second, + }, + MinConnectTimeout: time.Second, + }), + }, nil } // GetTLSConfig gets the namesapce client secret @@ -260,11 +285,6 @@ func ValidateAllocatorResponse(t *testing.T, resp *pb.AllocationResponse) { assert.NotEmpty(t, resp.Metadata.Annotations) } -// DeleteAgonesAllocatorPod deletes a Agones allocator pod -func DeleteAgonesAllocatorPod(ctx context.Context, podName string, framework *e2e.Framework) error { - return DeleteAgonesPod(ctx, podName, "agones-system", framework) -} - // DeleteAgonesPod deletes an Agones pod with the specified namespace and podname func DeleteAgonesPod(ctx context.Context, podName string, namespace string, framework *e2e.Framework) error { policy := metav1.DeletePropagationBackground @@ -273,14 +293,11 @@ func DeleteAgonesPod(ctx context.Context, podName string, namespace string, fram return err } -// GetAgonesAllocatorPods returns all the Agones allocator pods -func GetAgonesAllocatorPods(ctx context.Context, framework *e2e.Framework) (*corev1.PodList, error) { - opts := metav1.ListOptions{LabelSelector: labels.Set{"multicluster.agones.dev/role": "allocator"}.String()} - return framework.KubeClient.CoreV1().Pods("agones-system").List(ctx, opts) -} - -// GetAllocatorClient creates a client and ensure that it can be connected to +// GetAllocatorClient creates an allocator client and ensures that it can be connected to. Returns +// a client that has at least once successfully allocated from a fleet. The fleet used to test +// the client is leaked. func GetAllocatorClient(ctx context.Context, t *testing.T, framework *e2e.Framework) (pb.AllocationServiceClient, error) { + logger := e2e.TestLogger(t) ip, port := GetAllocatorEndpoint(ctx, t, framework) requestURL := fmt.Sprintf(allocatorReqURLFmt, ip, port) tlsCA := RefreshAllocatorTLSCerts(ctx, t, ip, framework) @@ -291,16 +308,22 @@ func GetAllocatorClient(ctx context.Context, t *testing.T, framework *e2e.Framew } framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - dialOpts, err := CreateRemoteClusterDialOption(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) + dialOpts, err := CreateRemoteClusterDialOptions(ctx, allocatorClientSecretNamespace, allocatorClientSecretName, tlsCA, framework) if err != nil { return nil, err } - conn, err := grpc.Dial(requestURL, dialOpts) + conn, err := grpc.Dial(requestURL, dialOpts...) require.NoError(t, err, "Failed grpc.Dial") go func() { - <-ctx.Done() - conn.Close() // nolint: errcheck + for { + state := conn.GetState() + logger.Infof("allocation client state: %v", state) + if notDone := conn.WaitForStateChange(ctx, state); !notDone { + break + } + } + _ = conn.Close() }() grpcClient := pb.NewAllocationServiceClient(conn) @@ -313,13 +336,15 @@ func GetAllocatorClient(ctx context.Context, t *testing.T, framework *e2e.Framew } var response *pb.AllocationResponse - err = wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { - response, err = grpcClient.Allocate(context.Background(), request) + err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) { + response, err = grpcClient.Allocate(ctx, request) if err != nil { - logrus.WithError(err).Info("failing Allocate request") + logger.WithError(err).Info("Failed grpc allocation request while waiting for certs to stabilize") return false, nil } ValidateAllocatorResponse(t, response) + err = DeleteAgonesPod(ctx, response.GameServerName, framework.Namespace, framework) + assert.NoError(t, err, "Failed to delete game server pod %s", response.GameServerName) return true, nil }) if err != nil { diff --git a/test/sdk/restapi/alpha/swagger/api_sdk.go b/test/sdk/restapi/alpha/swagger/api_sdk.go index f30cc7442d..bf1e742cf3 100644 --- a/test/sdk/restapi/alpha/swagger/api_sdk.go +++ b/test/sdk/restapi/alpha/swagger/api_sdk.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/client.go b/test/sdk/restapi/alpha/swagger/client.go index ed23440fe8..1d764db3a2 100644 --- a/test/sdk/restapi/alpha/swagger/client.go +++ b/test/sdk/restapi/alpha/swagger/client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/configuration.go b/test/sdk/restapi/alpha/swagger/configuration.go index fdfeeb41fa..a590e353d0 100644 --- a/test/sdk/restapi/alpha/swagger/configuration.go +++ b/test/sdk/restapi/alpha/swagger/configuration.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_bool.go b/test/sdk/restapi/alpha/swagger/model_alpha_bool.go index dbd9f619ac..4f200bbc29 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_bool.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_bool.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_count.go b/test/sdk/restapi/alpha/swagger/model_alpha_count.go index a025bc1a54..769281373a 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_count.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_count.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_empty.go b/test/sdk/restapi/alpha/swagger/model_alpha_empty.go index 7c652e8588..df14002b5b 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_empty.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_empty.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go b/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go index 6010a3c59a..fec52e0bee 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go b/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go index be8febedfd..f8cc3742b4 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/alpha/swagger/response.go b/test/sdk/restapi/alpha/swagger/response.go index 0da068a486..bd6cf6e2d6 100644 --- a/test/sdk/restapi/alpha/swagger/response.go +++ b/test/sdk/restapi/alpha/swagger/response.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/api_sdk.go b/test/sdk/restapi/beta/swagger/api_sdk.go index 3e42fe82ca..228e24db8d 100644 --- a/test/sdk/restapi/beta/swagger/api_sdk.go +++ b/test/sdk/restapi/beta/swagger/api_sdk.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/client.go b/test/sdk/restapi/beta/swagger/client.go index 77873a7586..99101430e7 100644 --- a/test/sdk/restapi/beta/swagger/client.go +++ b/test/sdk/restapi/beta/swagger/client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/configuration.go b/test/sdk/restapi/beta/swagger/configuration.go index a57d3da59b..361a344956 100644 --- a/test/sdk/restapi/beta/swagger/configuration.go +++ b/test/sdk/restapi/beta/swagger/configuration.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_beta_counter.go b/test/sdk/restapi/beta/swagger/model_beta_counter.go index ed4becfae7..2165d9547d 100644 --- a/test/sdk/restapi/beta/swagger/model_beta_counter.go +++ b/test/sdk/restapi/beta/swagger/model_beta_counter.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go b/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go index 1cbfa115db..5c11c32893 100644 --- a/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go +++ b/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_beta_list.go b/test/sdk/restapi/beta/swagger/model_beta_list.go index 90e7fef01c..a08234a24e 100644 --- a/test/sdk/restapi/beta/swagger/model_beta_list.go +++ b/test/sdk/restapi/beta/swagger/model_beta_list.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go b/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go index 5656290a8c..28f1ab94e0 100644 --- a/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go +++ b/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go b/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go index 079b0751da..05bc904bcb 100644 --- a/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go +++ b/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_the_list_to_update.go b/test/sdk/restapi/beta/swagger/model_the_list_to_update.go index f4ce38ad61..44f19995f4 100644 --- a/test/sdk/restapi/beta/swagger/model_the_list_to_update.go +++ b/test/sdk/restapi/beta/swagger/model_the_list_to_update.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go b/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go index ad1db867e0..85033bd5f1 100644 --- a/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go +++ b/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/beta/swagger/response.go b/test/sdk/restapi/beta/swagger/response.go index 06eef9f7f0..baba2bdc26 100644 --- a/test/sdk/restapi/beta/swagger/response.go +++ b/test/sdk/restapi/beta/swagger/response.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/api_sdk.go b/test/sdk/restapi/swagger/api_sdk.go index ef6d79fe8f..ef4a097908 100644 --- a/test/sdk/restapi/swagger/api_sdk.go +++ b/test/sdk/restapi/swagger/api_sdk.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/client.go b/test/sdk/restapi/swagger/client.go index 70162ea7a4..7e212fb8d0 100644 --- a/test/sdk/restapi/swagger/client.go +++ b/test/sdk/restapi/swagger/client.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/configuration.go b/test/sdk/restapi/swagger/configuration.go index f98ce4673b..333b8ff01c 100644 --- a/test/sdk/restapi/swagger/configuration.go +++ b/test/sdk/restapi/swagger/configuration.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_game_server_object_meta.go b/test/sdk/restapi/swagger/model_game_server_object_meta.go index bd799811f3..f80181a1f9 100644 --- a/test/sdk/restapi/swagger/model_game_server_object_meta.go +++ b/test/sdk/restapi/swagger/model_game_server_object_meta.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_game_server_spec.go b/test/sdk/restapi/swagger/model_game_server_spec.go index 5708786a83..f69731b48e 100644 --- a/test/sdk/restapi/swagger/model_game_server_spec.go +++ b/test/sdk/restapi/swagger/model_game_server_spec.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_googlerpc_status.go b/test/sdk/restapi/swagger/model_googlerpc_status.go index 93e68cb08d..f78719d72e 100644 --- a/test/sdk/restapi/swagger/model_googlerpc_status.go +++ b/test/sdk/restapi/swagger/model_googlerpc_status.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_sdk_duration.go b/test/sdk/restapi/swagger/model_sdk_duration.go index f5a755f640..e39094e810 100644 --- a/test/sdk/restapi/swagger/model_sdk_duration.go +++ b/test/sdk/restapi/swagger/model_sdk_duration.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_sdk_empty.go b/test/sdk/restapi/swagger/model_sdk_empty.go index 5a0f767986..33d0344020 100644 --- a/test/sdk/restapi/swagger/model_sdk_empty.go +++ b/test/sdk/restapi/swagger/model_sdk_empty.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_sdk_game_server.go b/test/sdk/restapi/swagger/model_sdk_game_server.go index 903cdd006f..7e2d653e8f 100644 --- a/test/sdk/restapi/swagger/model_sdk_game_server.go +++ b/test/sdk/restapi/swagger/model_sdk_game_server.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_sdk_game_server_status.go b/test/sdk/restapi/swagger/model_sdk_game_server_status.go index e3388fdf28..aff97910c5 100644 --- a/test/sdk/restapi/swagger/model_sdk_game_server_status.go +++ b/test/sdk/restapi/swagger/model_sdk_game_server_status.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_sdk_key_value.go b/test/sdk/restapi/swagger/model_sdk_key_value.go index 8533c2f0de..11c05f45bd 100644 --- a/test/sdk/restapi/swagger/model_sdk_key_value.go +++ b/test/sdk/restapi/swagger/model_sdk_key_value.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_spec_health.go b/test/sdk/restapi/swagger/model_spec_health.go index c6f1130c99..f9743113a8 100644 --- a/test/sdk/restapi/swagger/model_spec_health.go +++ b/test/sdk/restapi/swagger/model_spec_health.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_status_address.go b/test/sdk/restapi/swagger/model_status_address.go index 7be2af6778..2656ec1972 100644 --- a/test/sdk/restapi/swagger/model_status_address.go +++ b/test/sdk/restapi/swagger/model_status_address.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_status_counter_status.go b/test/sdk/restapi/swagger/model_status_counter_status.go index ecd47ebc84..2ff4c85cfc 100644 --- a/test/sdk/restapi/swagger/model_status_counter_status.go +++ b/test/sdk/restapi/swagger/model_status_counter_status.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_status_list_status.go b/test/sdk/restapi/swagger/model_status_list_status.go index ab1df2f748..f9eda75c16 100644 --- a/test/sdk/restapi/swagger/model_status_list_status.go +++ b/test/sdk/restapi/swagger/model_status_list_status.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_status_player_status.go b/test/sdk/restapi/swagger/model_status_player_status.go index 51d0334005..0767cd598c 100644 --- a/test/sdk/restapi/swagger/model_status_player_status.go +++ b/test/sdk/restapi/swagger/model_status_player_status.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_status_port.go b/test/sdk/restapi/swagger/model_status_port.go index d822adb026..8b7dd9a902 100644 --- a/test/sdk/restapi/swagger/model_status_port.go +++ b/test/sdk/restapi/swagger/model_status_port.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/model_stream_result_of_sdk_game_server.go b/test/sdk/restapi/swagger/model_stream_result_of_sdk_game_server.go index 67f611ba85..f9ab24789d 100644 --- a/test/sdk/restapi/swagger/model_stream_result_of_sdk_game_server.go +++ b/test/sdk/restapi/swagger/model_stream_result_of_sdk_game_server.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/sdk/restapi/swagger/response.go b/test/sdk/restapi/swagger/response.go index fc21c406ac..c410d3e38d 100644 --- a/test/sdk/restapi/swagger/response.go +++ b/test/sdk/restapi/swagger/response.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC All Rights Reserved. +// Copyright 2024 Google LLC All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/grpc/health/client.go b/vendor/google.golang.org/grpc/health/client.go new file mode 100644 index 0000000000..b5bee48380 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/client.go @@ -0,0 +1,117 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package health + +import ( + "context" + "fmt" + "io" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/connectivity" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/status" +) + +var ( + backoffStrategy = backoff.DefaultExponential + backoffFunc = func(ctx context.Context, retries int) bool { + d := backoffStrategy.Backoff(retries) + timer := time.NewTimer(d) + select { + case <-timer.C: + return true + case <-ctx.Done(): + timer.Stop() + return false + } + } +) + +func init() { + internal.HealthCheckFunc = clientHealthCheck +} + +const healthCheckMethod = "/grpc.health.v1.Health/Watch" + +// This function implements the protocol defined at: +// https://github.com/grpc/grpc/blob/master/doc/health-checking.md +func clientHealthCheck(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), service string) error { + tryCnt := 0 + +retryConnection: + for { + // Backs off if the connection has failed in some way without receiving a message in the previous retry. + if tryCnt > 0 && !backoffFunc(ctx, tryCnt-1) { + return nil + } + tryCnt++ + + if ctx.Err() != nil { + return nil + } + setConnectivityState(connectivity.Connecting, nil) + rawS, err := newStream(healthCheckMethod) + if err != nil { + continue retryConnection + } + + s, ok := rawS.(grpc.ClientStream) + // Ideally, this should never happen. But if it happens, the server is marked as healthy for LBing purposes. + if !ok { + setConnectivityState(connectivity.Ready, nil) + return fmt.Errorf("newStream returned %v (type %T); want grpc.ClientStream", rawS, rawS) + } + + if err = s.SendMsg(&healthpb.HealthCheckRequest{Service: service}); err != nil && err != io.EOF { + // Stream should have been closed, so we can safely continue to create a new stream. + continue retryConnection + } + s.CloseSend() + + resp := new(healthpb.HealthCheckResponse) + for { + err = s.RecvMsg(resp) + + // Reports healthy for the LBing purposes if health check is not implemented in the server. + if status.Code(err) == codes.Unimplemented { + setConnectivityState(connectivity.Ready, nil) + return err + } + + // Reports unhealthy if server's Watch method gives an error other than UNIMPLEMENTED. + if err != nil { + setConnectivityState(connectivity.TransientFailure, fmt.Errorf("connection active but received health check RPC error: %v", err)) + continue retryConnection + } + + // As a message has been received, removes the need for backoff for the next retry by resetting the try count. + tryCnt = 0 + if resp.Status == healthpb.HealthCheckResponse_SERVING { + setConnectivityState(connectivity.Ready, nil) + } else { + setConnectivityState(connectivity.TransientFailure, fmt.Errorf("connection active but health check failed. status=%s", resp.Status)) + } + } + } +} diff --git a/vendor/google.golang.org/grpc/health/logging.go b/vendor/google.golang.org/grpc/health/logging.go new file mode 100644 index 0000000000..83c6acf55e --- /dev/null +++ b/vendor/google.golang.org/grpc/health/logging.go @@ -0,0 +1,23 @@ +/* + * + * Copyright 2020 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package health + +import "google.golang.org/grpc/grpclog" + +var logger = grpclog.Component("health_service") diff --git a/vendor/google.golang.org/grpc/health/server.go b/vendor/google.golang.org/grpc/health/server.go new file mode 100644 index 0000000000..cce6312d77 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/server.go @@ -0,0 +1,163 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package health provides a service that exposes server's health and it must be +// imported to enable support for client-side health checks. +package health + +import ( + "context" + "sync" + + "google.golang.org/grpc/codes" + healthgrpc "google.golang.org/grpc/health/grpc_health_v1" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/status" +) + +// Server implements `service Health`. +type Server struct { + healthgrpc.UnimplementedHealthServer + mu sync.RWMutex + // If shutdown is true, it's expected all serving status is NOT_SERVING, and + // will stay in NOT_SERVING. + shutdown bool + // statusMap stores the serving status of the services this Server monitors. + statusMap map[string]healthpb.HealthCheckResponse_ServingStatus + updates map[string]map[healthgrpc.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus +} + +// NewServer returns a new Server. +func NewServer() *Server { + return &Server{ + statusMap: map[string]healthpb.HealthCheckResponse_ServingStatus{"": healthpb.HealthCheckResponse_SERVING}, + updates: make(map[string]map[healthgrpc.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus), + } +} + +// Check implements `service Health`. +func (s *Server) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) { + s.mu.RLock() + defer s.mu.RUnlock() + if servingStatus, ok := s.statusMap[in.Service]; ok { + return &healthpb.HealthCheckResponse{ + Status: servingStatus, + }, nil + } + return nil, status.Error(codes.NotFound, "unknown service") +} + +// Watch implements `service Health`. +func (s *Server) Watch(in *healthpb.HealthCheckRequest, stream healthgrpc.Health_WatchServer) error { + service := in.Service + // update channel is used for getting service status updates. + update := make(chan healthpb.HealthCheckResponse_ServingStatus, 1) + s.mu.Lock() + // Puts the initial status to the channel. + if servingStatus, ok := s.statusMap[service]; ok { + update <- servingStatus + } else { + update <- healthpb.HealthCheckResponse_SERVICE_UNKNOWN + } + + // Registers the update channel to the correct place in the updates map. + if _, ok := s.updates[service]; !ok { + s.updates[service] = make(map[healthgrpc.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus) + } + s.updates[service][stream] = update + defer func() { + s.mu.Lock() + delete(s.updates[service], stream) + s.mu.Unlock() + }() + s.mu.Unlock() + + var lastSentStatus healthpb.HealthCheckResponse_ServingStatus = -1 + for { + select { + // Status updated. Sends the up-to-date status to the client. + case servingStatus := <-update: + if lastSentStatus == servingStatus { + continue + } + lastSentStatus = servingStatus + err := stream.Send(&healthpb.HealthCheckResponse{Status: servingStatus}) + if err != nil { + return status.Error(codes.Canceled, "Stream has ended.") + } + // Context done. Removes the update channel from the updates map. + case <-stream.Context().Done(): + return status.Error(codes.Canceled, "Stream has ended.") + } + } +} + +// SetServingStatus is called when need to reset the serving status of a service +// or insert a new service entry into the statusMap. +func (s *Server) SetServingStatus(service string, servingStatus healthpb.HealthCheckResponse_ServingStatus) { + s.mu.Lock() + defer s.mu.Unlock() + if s.shutdown { + logger.Infof("health: status changing for %s to %v is ignored because health service is shutdown", service, servingStatus) + return + } + + s.setServingStatusLocked(service, servingStatus) +} + +func (s *Server) setServingStatusLocked(service string, servingStatus healthpb.HealthCheckResponse_ServingStatus) { + s.statusMap[service] = servingStatus + for _, update := range s.updates[service] { + // Clears previous updates, that are not sent to the client, from the channel. + // This can happen if the client is not reading and the server gets flow control limited. + select { + case <-update: + default: + } + // Puts the most recent update to the channel. + update <- servingStatus + } +} + +// Shutdown sets all serving status to NOT_SERVING, and configures the server to +// ignore all future status changes. +// +// This changes serving status for all services. To set status for a particular +// services, call SetServingStatus(). +func (s *Server) Shutdown() { + s.mu.Lock() + defer s.mu.Unlock() + s.shutdown = true + for service := range s.statusMap { + s.setServingStatusLocked(service, healthpb.HealthCheckResponse_NOT_SERVING) + } +} + +// Resume sets all serving status to SERVING, and configures the server to +// accept all future status changes. +// +// This changes serving status for all services. To set status for a particular +// services, call SetServingStatus(). +func (s *Server) Resume() { + s.mu.Lock() + defer s.mu.Unlock() + s.shutdown = false + for service := range s.statusMap { + s.setServingStatusLocked(service, healthpb.HealthCheckResponse_SERVING) + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 68d6b14de4..fdd895811d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -513,6 +513,7 @@ google.golang.org/grpc/credentials/oauth google.golang.org/grpc/encoding google.golang.org/grpc/encoding/proto google.golang.org/grpc/grpclog +google.golang.org/grpc/health google.golang.org/grpc/health/grpc_health_v1 google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff