Skip to content

Commit

Permalink
Merge branch 'main' into ac-to-ae
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerlynn authored Apr 25, 2024
2 parents 68a1ade + 2e34147 commit 2a78148
Show file tree
Hide file tree
Showing 27 changed files with 723 additions and 648 deletions.
67 changes: 67 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,72 @@
# Changelog

## [v1.40.0](https://github.com/googleforgames/agones/tree/v1.40.0) (2024-04-23)

[Full Changelog](https://github.com/googleforgames/agones/compare/v1.39.0...v1.40.0)

**Breaking changes:**
- Counters and Lists: Remove Bool Returns by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3738

**Implemented enhancements:**
- Leader Election in Custom Controller by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3696
- Migrating from generate-groups.sh to kube_codegen.sh by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3722
- Move GKEAutopilotExtendedDurationPods to Alpha in 1.28+ by @zmerlynn in https://github.com/googleforgames/agones/pull/3729
- Move DisableResyncOnSDKServer to Beta by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3732
- Counters & Lists landing page and doc improvements by @markmandel in https://github.com/googleforgames/agones/pull/3649
- Graduate FleetAllocationOverflow to Stable by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3733
- Adds Counters and Lists to CSharp SDK by @igooch in https://github.com/googleforgames/agones/pull/3581
- Feat/counter and list defaulting order to ascending by @lacroixthomas in https://github.com/googleforgames/agones/pull/3734
- Add handling for StatusAddresses in GameServerStatus for the Unity SDK by @charlesvien in https://github.com/googleforgames/agones/pull/3739
- Feat(gameservers): Shared pod IPs with GameServer Addresses by @lacroixthomas in https://github.com/googleforgames/agones/pull/3764
- Be prescriptive about rotating regions when updating Kubernetes versions by @zmerlynn in https://github.com/googleforgames/agones/pull/3716
- Fix ensure-e2e-infra-state-bucket by @zmerlynn in https://github.com/googleforgames/agones/pull/3719
- Create Performance Cluster 1.28 by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3720
- Optimise GameServer Sub-Controller Queues by @markmandel in https://github.com/googleforgames/agones/pull/3781

**Fixed bugs:**
- Counters & Lists: Consolidate `priorities` sorting by @markmandel in https://github.com/googleforgames/agones/pull/3690
- Fix(Counter & Lists): Add validation for `priorities` by @lacroixthomas in https://github.com/googleforgames/agones/pull/3714
- fix: #3607 Metrics data loss in K8S controller by @alvin-7 in https://github.com/googleforgames/agones/pull/3692
- Deflake GameServerAllocationDuringMultipleAllocationClients by allowing errors by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3750

**Security fixes:**
- Bump protobufjs from 7.2.4 to 7.2.6 in /sdks/nodejs by @dependabot in https://github.com/googleforgames/agones/pull/3755
- Bump golang.org/x/net from 0.19.0 to 0.23.0 by @zmerlynn in https://github.com/googleforgames/agones/pull/3793

**Other:**
- Flaky: TestGameServerCreationAfterDeletingOneExtensionsPod by @markmandel in https://github.com/googleforgames/agones/pull/3699
- Prep for release v1.40.0 by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3700
- Bumps cpp-simple Image and Refactoring Example Makefiles by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3695
- Upgrade Protobuf to 1.33.0 by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3711
- Modify Script for Makefile Version Updates in Examples Directory by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3712
- Adds simple genai server example documentation to the Agones site by @igooch in https://github.com/googleforgames/agones/pull/3713
- Update Supported Kubernetes to 1.27, 1.28, 1.29 by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3654
- fix: typo in docs by @qhyun2 in https://github.com/googleforgames/agones/pull/3723
- Tweak: Setting up the Game Server by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3717
- Docs: gke.md - spelling by @daniellee in https://github.com/googleforgames/agones/pull/3740
- Aesthetic rearrangement of cloudbuild.yaml by @zmerlynn in https://github.com/googleforgames/agones/pull/3741
- Docs: Make hitting <enter> on connection explicit by @markmandel in https://github.com/googleforgames/agones/pull/3743
- CI: Don't check Unreal Link by @markmandel in https://github.com/googleforgames/agones/pull/3745
- New recommendation for multi-cluster allocation by @markmandel in https://github.com/googleforgames/agones/pull/3744
- Custom Controller Example Page on Agones Website by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3725
- Add Nitrado logo by @towolf in https://github.com/googleforgames/agones/pull/3753
- Remove unnecessary args from e2e-test-cloudbuild by @zmerlynn in https://github.com/googleforgames/agones/pull/3754
- Update Allocation from Fleet Documentation by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3761
- Transform Lint Warnings into Errors by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3756
- Update Canary Testing Documentation by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3760
- Supertuxkart Example on Agones Site by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3728
- Xonotic Example on Agones Site by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3742
- nit documentation fix in kind cluster section when building Agones by @vicentefb in https://github.com/googleforgames/agones/pull/3770
- Merged steps inside documentation about webhook certificate creation by @vicentefb in https://github.com/googleforgames/agones/pull/3768
- Example Images: Increment Tags by @Kalaiselvi84 in https://github.com/googleforgames/agones/pull/3796
- Update simple game server example documentation by @vicentefb in https://github.com/googleforgames/agones/pull/3776

**New Contributors:**
- @lacroixthomas made their first contribution in https://github.com/googleforgames/agones/pull/3714
- @daniellee made their first contribution in https://github.com/googleforgames/agones/pull/3740
- @charlesvien made their first contribution in https://github.com/googleforgames/agones/pull/3739
- @vicentefb made their first contribution in https://github.com/googleforgames/agones/pull/3770

## [v1.39.0](https://github.com/googleforgames/agones/tree/v1.39.0) (2024-03-12)

[Full Changelog](https://github.com/googleforgames/agones/compare/v1.38.0...v1.39.0)
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#

# base version target. This is usually the next release.
base_version = 1.40.0
base_version = 1.41.0

#
# All of the following can be overwritten with environment variables
Expand Down
77 changes: 61 additions & 16 deletions cmd/allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ import (
"sync"
"time"

"agones.dev/agones/pkg"
"agones.dev/agones/pkg/allocation/converters"
pb "agones.dev/agones/pkg/allocation/go"
allocationv1 "agones.dev/agones/pkg/apis/allocation/v1"
"agones.dev/agones/pkg/client/clientset/versioned"
"agones.dev/agones/pkg/client/informers/externalversions"
"agones.dev/agones/pkg/gameserverallocations"
"agones.dev/agones/pkg/gameservers"
"agones.dev/agones/pkg/util/fswatch"
"agones.dev/agones/pkg/util/runtime"
"agones.dev/agones/pkg/util/signals"
"github.com/heptiolabs/healthcheck"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand All @@ -53,6 +42,18 @@ import (
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"

"agones.dev/agones/pkg"
"agones.dev/agones/pkg/allocation/converters"
pb "agones.dev/agones/pkg/allocation/go"
allocationv1 "agones.dev/agones/pkg/apis/allocation/v1"
"agones.dev/agones/pkg/client/clientset/versioned"
"agones.dev/agones/pkg/client/informers/externalversions"
"agones.dev/agones/pkg/gameserverallocations"
"agones.dev/agones/pkg/gameservers"
"agones.dev/agones/pkg/util/fswatch"
"agones.dev/agones/pkg/util/runtime"
"agones.dev/agones/pkg/util/signals"
)

var (
Expand Down Expand Up @@ -81,6 +82,7 @@ const (
logLevelFlag = "log-level"
allocationBatchWaitTime = "allocation-batch-wait-time"
readinessShutdownDuration = "readiness-shutdown-duration"
httpUnallocatedStatusCode = "http-unallocated-status-code"
)

func parseEnvFlags() config {
Expand All @@ -98,6 +100,7 @@ func parseEnvFlags() config {
viper.SetDefault(totalRemoteAllocationTimeoutFlag, 30*time.Second)
viper.SetDefault(logLevelFlag, "Info")
viper.SetDefault(allocationBatchWaitTime, 500*time.Millisecond)
viper.SetDefault(httpUnallocatedStatusCode, http.StatusTooManyRequests)

pflag.Int32(httpPortFlag, viper.GetInt32(httpPortFlag), "Port to listen on for REST requests")
pflag.Int32(grpcPortFlag, viper.GetInt32(grpcPortFlag), "Port to listen on for gRPC requests")
Expand All @@ -114,6 +117,7 @@ func parseEnvFlags() config {
pflag.String(logLevelFlag, viper.GetString(logLevelFlag), "Agones Log level")
pflag.Duration(allocationBatchWaitTime, viper.GetDuration(allocationBatchWaitTime), "Flag to configure the waiting period between allocations batches")
pflag.Duration(readinessShutdownDuration, viper.GetDuration(readinessShutdownDuration), "Time in seconds for SIGTERM/SIGINT handler to sleep for.")
pflag.Int32(httpUnallocatedStatusCode, viper.GetInt32(httpUnallocatedStatusCode), "HTTP status code to return when no GameServer is available")
runtime.FeaturesBindFlags()
pflag.Parse()

Expand All @@ -133,6 +137,7 @@ func parseEnvFlags() config {
runtime.Must(viper.BindEnv(logLevelFlag))
runtime.Must(viper.BindEnv(allocationBatchWaitTime))
runtime.Must(viper.BindEnv(readinessShutdownDuration))
runtime.Must(viper.BindEnv(httpUnallocatedStatusCode))
runtime.Must(viper.BindPFlags(pflag.CommandLine))
runtime.Must(runtime.FeaturesBindEnv())

Expand All @@ -154,6 +159,7 @@ func parseEnvFlags() config {
totalRemoteAllocationTimeout: viper.GetDuration(totalRemoteAllocationTimeoutFlag),
allocationBatchWaitTime: viper.GetDuration(allocationBatchWaitTime),
ReadinessShutdownDuration: viper.GetDuration(readinessShutdownDuration),
httpUnallocatedStatusCode: int(viper.GetInt32(httpUnallocatedStatusCode)),
}
}

Expand All @@ -173,6 +179,7 @@ type config struct {
remoteAllocationTimeout time.Duration
allocationBatchWaitTime time.Duration
ReadinessShutdownDuration time.Duration
httpUnallocatedStatusCode int
}

// grpcHandlerFunc returns an http.Handler that delegates to grpcServer on incoming gRPC
Expand Down Expand Up @@ -244,7 +251,9 @@ func main() {
os.Exit(0)
})

h := newServiceHandler(ctx, kubeClient, agonesClient, health, conf.MTLSDisabled, conf.TLSDisabled, conf.remoteAllocationTimeout, conf.totalRemoteAllocationTimeout, conf.allocationBatchWaitTime)
grpcUnallocatedStatusCode := grpcCodeFromHTTPStatus(conf.httpUnallocatedStatusCode)

h := newServiceHandler(ctx, 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() {
Expand Down Expand Up @@ -378,7 +387,7 @@ func runGRPC(h *serviceHandler, grpcPort int) {
}()
}

func newServiceHandler(ctx context.Context, kubeClient kubernetes.Interface, agonesClient versioned.Interface, health healthcheck.Handler, mTLSDisabled bool, tlsDisabled bool, remoteAllocationTimeout time.Duration, totalRemoteAllocationTimeout time.Duration, allocationBatchWaitTime time.Duration) *serviceHandler {
func newServiceHandler(ctx context.Context, kubeClient kubernetes.Interface, agonesClient versioned.Interface, health healthcheck.Handler, mTLSDisabled bool, tlsDisabled bool, remoteAllocationTimeout time.Duration, totalRemoteAllocationTimeout time.Duration, allocationBatchWaitTime time.Duration, grpcUnallocatedStatusCode codes.Code) *serviceHandler {
defaultResync := 30 * time.Second
agonesInformerFactory := externalversions.NewSharedInformerFactory(agonesClient, defaultResync)
kubeInformerFactory := informers.NewSharedInformerFactory(kubeClient, defaultResync)
Expand All @@ -398,8 +407,9 @@ func newServiceHandler(ctx context.Context, kubeClient kubernetes.Interface, ago
allocationCallback: func(gsa *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
return allocator.Allocate(ctx, gsa)
},
mTLSDisabled: mTLSDisabled,
tlsDisabled: tlsDisabled,
mTLSDisabled: mTLSDisabled,
tlsDisabled: tlsDisabled,
grpcUnallocatedStatusCode: grpcUnallocatedStatusCode,
}

kubeInformerFactory.Start(ctx.Done())
Expand Down Expand Up @@ -599,6 +609,8 @@ type serviceHandler struct {

mTLSDisabled bool
tlsDisabled bool

grpcUnallocatedStatusCode codes.Code
}

// Allocate implements the Allocate gRPC method definition
Expand All @@ -621,8 +633,41 @@ func (h *serviceHandler) Allocate(ctx context.Context, in *pb.AllocationRequest)
logger.Errorf("internal server error - Bad GSA format %v", resultObj)
return nil, status.Errorf(codes.Internal, "internal server error- Bad GSA format %v", resultObj)
}
response, err := converters.ConvertGSAToAllocationResponse(allocatedGsa)
response, err := converters.ConvertGSAToAllocationResponse(allocatedGsa, h.grpcUnallocatedStatusCode)
logger.WithField("response", response).WithError(err).Infof("allocation response is being sent")

return response, err
}

// grpcCodeFromHTTPStatus converts an HTTP status code to the corresponding gRPC status code.
func grpcCodeFromHTTPStatus(httpUnallocatedStatusCode int) codes.Code {
switch httpUnallocatedStatusCode {
case http.StatusOK:
return codes.OK
case 499:
return codes.Canceled
case http.StatusInternalServerError:
return codes.Internal
case http.StatusBadRequest:
return codes.InvalidArgument
case http.StatusGatewayTimeout:
return codes.DeadlineExceeded
case http.StatusNotFound:
return codes.NotFound
case http.StatusConflict:
return codes.AlreadyExists
case http.StatusForbidden:
return codes.PermissionDenied
case http.StatusUnauthorized:
return codes.Unauthenticated
case http.StatusTooManyRequests:
return codes.ResourceExhausted
case http.StatusNotImplemented:
return codes.Unimplemented
case http.StatusServiceUnavailable:
return codes.Unavailable
default:
logger.WithField("httpStatusCode", httpUnallocatedStatusCode).Warnf("received unknown http status code, defaulting to codes.ResourceExhausted / 429")
return codes.ResourceExhausted
}
}
4 changes: 2 additions & 2 deletions install/helm/agones/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Declare variables to be passed into your templates.

apiVersion: v1
appVersion: "1.40.0-dev"
version: 1.40.0-dev
appVersion: "1.41.0-dev"
version: 1.41.0-dev
name: agones
description: a library for hosting, running and scaling dedicated game servers on Kubernetes.
keywords:
Expand Down
2 changes: 2 additions & 0 deletions install/helm/agones/templates/service/allocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ spec:
- name: GRPC_PORT
value: {{ .Values.agones.allocator.service.grpc.targetPort | quote }}
{{- end }}
- name: HTTP_UNALLOCATED_STATUS_CODE
value: {{ .Values.agones.allocator.service.http.unallocatedStatusCode | quote }}
- name: API_SERVER_QPS
value: {{ .Values.agones.allocator.apiServerQPS | quote }}
- name: API_SERVER_QPS_BURST
Expand Down
3 changes: 2 additions & 1 deletion install/helm/agones/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ agones:
portName: https
targetPort: 8443
nodePort: 0 # nodePort will be used if the serviceType is set to NodePort
unallocatedStatusCode: 429
grpc:
enabled: true
appProtocol: ""
Expand Down Expand Up @@ -254,7 +255,7 @@ agones:
topologySpreadConstraints: {}
image:
registry: us-docker.pkg.dev/agones-images/release
tag: 1.40.0-dev
tag: 1.41.0-dev
controller:
name: agones-controller
pullPolicy: IfNotPresent
Expand Down
Loading

0 comments on commit 2a78148

Please sign in to comment.