diff --git a/examples/fleet.yaml b/examples/fleet.yaml index 2ea0828203..99a73a5c0c 100644 --- a/examples/fleet.yaml +++ b/examples/fleet.yaml @@ -62,6 +62,9 @@ spec: health: initialDelaySeconds: 30 periodSeconds: 60 + # logging parameters for game server sidecar + logging: + sdkServer: Info # The GameServer's Pod template template: spec: diff --git a/examples/gameserver.yaml b/examples/gameserver.yaml index 9dcc17049e..4676bb6f86 100644 --- a/examples/gameserver.yaml +++ b/examples/gameserver.yaml @@ -35,7 +35,7 @@ spec: ports: # name is a descriptive name for the port - name: default - # portPolicy has two options: + # portPolicy has three options: # - "Dynamic" (default) the system allocates a free hostPort for the gameserver, for game clients to connect to # - "Static", user defines the hostPort that the game client will connect to. Then onus is on the user to ensure that the # - "Passthrough" dynamically sets the `containerPort` to the same value as the dynamically selected hostPort. @@ -60,6 +60,13 @@ spec: # Minimum consecutive failures for the health probe to be considered failed after having succeeded. # Defaults to 3. Minimum value is 1 failureThreshold: 3 + # logging parameters for game server sidecar + logging: + # sdkServer logging parameter has three options: + # - "Info" (default) The SDK server will output all messages except for debug messages + # - "Debug" The SDK server will output all messages including debug messages + # - "Error" The SDK server will only output error messages + sdkServer: Info # Pod template configuration # https://v1-12.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#podtemplate-v1-core template: diff --git a/install/helm/agones/templates/crds/_gameserverspecvalidation.yaml b/install/helm/agones/templates/crds/_gameserverspecvalidation.yaml index 696a61f26b..18b0c7fc52 100644 --- a/install/helm/agones/templates/crds/_gameserverspecvalidation.yaml +++ b/install/helm/agones/templates/crds/_gameserverspecvalidation.yaml @@ -92,6 +92,21 @@ properties: type: integer minimum: 1 maximum: 65535 + logging: + type: object + title: Define logging levels for agones system components + properties: + sdkServer: + type: string + description: | + sdkServer logging parameter has three options: + - "Info" (default) The SDK server will output all messages except for debug messages + - "Debug" The SDK server will output all messages including debug messages + - "Error" The SDK server will only output error messages + enum: + - Error + - Info + - Debug scheduling: type: string enum: diff --git a/install/yaml/install.yaml b/install/yaml/install.yaml index b2aaffae55..601e2accd9 100644 --- a/install/yaml/install.yaml +++ b/install/yaml/install.yaml @@ -339,6 +339,21 @@ spec: type: integer minimum: 1 maximum: 65535 + logging: + type: object + title: Define logging levels for agones system components + properties: + sdkServer: + type: string + description: | + sdkServer logging parameter has three options: + - "Info" (default) The SDK server will output all messages except for debug messages + - "Debug" The SDK server will output all messages including debug messages + - "Error" The SDK server will only output error messages + enum: + - Error + - Info + - Debug scheduling: type: string enum: @@ -594,6 +609,21 @@ spec: type: integer minimum: 1 maximum: 65535 + logging: + type: object + title: Define logging levels for agones system components + properties: + sdkServer: + type: string + description: | + sdkServer logging parameter has three options: + - "Info" (default) The SDK server will output all messages except for debug messages + - "Debug" The SDK server will output all messages including debug messages + - "Error" The SDK server will only output error messages + enum: + - Error + - Info + - Debug scheduling: type: string enum: @@ -860,6 +890,21 @@ spec: type: integer minimum: 1 maximum: 65535 + logging: + type: object + title: Define logging levels for agones system components + properties: + sdkServer: + type: string + description: | + sdkServer logging parameter has three options: + - "Info" (default) The SDK server will output all messages except for debug messages + - "Debug" The SDK server will output all messages including debug messages + - "Error" The SDK server will only output error messages + enum: + - Error + - Info + - Debug scheduling: type: string enum: diff --git a/pkg/apis/agones/v1/gameserver.go b/pkg/apis/agones/v1/gameserver.go index 8e69cd7e25..95bd317aa8 100644 --- a/pkg/apis/agones/v1/gameserver.go +++ b/pkg/apis/agones/v1/gameserver.go @@ -133,12 +133,20 @@ type GameServerSpec struct { Ports []GameServerPort `json:"ports"` // Health configures health checking Health Health `json:"health,omitempty"` - // Scheduling strategy. Defaults to "Packed". + // Scheduling strategy. Defaults to "Packed" Scheduling apis.SchedulingStrategy `json:"scheduling,omitempty"` + // Logging specifies log levels for Agones system containers + Logging Logging `json:"logging,omitempty"` // Template describes the Pod that will be created for the GameServer Template corev1.PodTemplateSpec `json:"template"` } +// Logging specifies log levels for Agones system containers +type Logging struct { + // SdkServer is a log level for SDK server (sidecar) logs. Defaults to "Info" + SdkServer string `json:"sdkServer,omitempty"` +} + // GameServerState is the state for the GameServer type GameServerState string @@ -213,9 +221,17 @@ func (gss *GameServerSpec) ApplyDefaults() { gss.applyPortDefaults() gss.applyHealthDefaults() gss.applySchedulingDefaults() + gss.applyLogLevelDefaults() +} + +// applyLogLevelDefaults applies the log level default - "Info" +func (gss *GameServerSpec) applyLogLevelDefaults() { + if gss.Logging.SdkServer == "" { + gss.Logging.SdkServer = "Info" + } } -// applyContainerDefaults applues the container defaults +// applyContainerDefaults applies the container defaults func (gss *GameServerSpec) applyContainerDefaults() { if len(gss.Template.Spec.Containers) == 1 { gss.Container = gss.Template.Spec.Containers[0].Name diff --git a/pkg/apis/agones/v1/gameserver_test.go b/pkg/apis/agones/v1/gameserver_test.go index 01577efaf9..3f7905b8c0 100644 --- a/pkg/apis/agones/v1/gameserver_test.go +++ b/pkg/apis/agones/v1/gameserver_test.go @@ -61,11 +61,12 @@ func TestGameServerApplyDefaults(t *testing.T) { t.Parallel() type expected struct { - protocol corev1.Protocol - state GameServerState - policy PortPolicy - health Health - scheduling apis.SchedulingStrategy + protocol corev1.Protocol + state GameServerState + policy PortPolicy + health Health + scheduling apis.SchedulingStrategy + sdkServerLogLevel string } data := map[string]struct { gameServer GameServer @@ -93,6 +94,7 @@ func TestGameServerApplyDefaults(t *testing.T) { InitialDelaySeconds: 5, PeriodSeconds: 5, }, + sdkServerLogLevel: "Info", }, }, "defaults on passthrough": { @@ -116,6 +118,7 @@ func TestGameServerApplyDefaults(t *testing.T) { InitialDelaySeconds: 5, PeriodSeconds: 5, }, + sdkServerLogLevel: "Info", }, }, "defaults are already set": { @@ -138,6 +141,7 @@ func TestGameServerApplyDefaults(t *testing.T) { {Name: "testing", Image: "testing/image"}, {Name: "testing2", Image: "testing/image2"}}}, }, + Logging: Logging{SdkServer: "Info"}, }, Status: GameServerStatus{State: "TestState"}}, container: "testing2", @@ -152,6 +156,7 @@ func TestGameServerApplyDefaults(t *testing.T) { InitialDelaySeconds: 11, PeriodSeconds: 12, }, + sdkServerLogLevel: "Info", }, }, "set basic defaults on static gameserver": { @@ -173,6 +178,7 @@ func TestGameServerApplyDefaults(t *testing.T) { InitialDelaySeconds: 5, PeriodSeconds: 5, }, + sdkServerLogLevel: "Info", }, }, "health is disabled": { @@ -192,6 +198,7 @@ func TestGameServerApplyDefaults(t *testing.T) { health: Health{ Disabled: true, }, + sdkServerLogLevel: "Info", }, }, "convert from legacy single port to multiple": { @@ -211,11 +218,37 @@ func TestGameServerApplyDefaults(t *testing.T) { }, container: "testing", expected: expected{ - protocol: corev1.ProtocolTCP, - state: GameServerStateCreating, - policy: Static, + protocol: corev1.ProtocolTCP, + state: GameServerStateCreating, + policy: Static, + scheduling: apis.Packed, + health: Health{Disabled: true}, + sdkServerLogLevel: "Info", + }, + }, + "set Debug logging level": { + gameServer: GameServer{ + Spec: GameServerSpec{ + Ports: []GameServerPort{{ContainerPort: 999}}, + Logging: Logging{SdkServer: "Debug"}, + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{Containers: []corev1.Container{ + {Name: "testing", Image: "testing/image"}, + }}}}, + }, + container: "testing", + expected: expected{ + protocol: "UDP", + state: GameServerStatePortAllocation, + policy: Dynamic, scheduling: apis.Packed, - health: Health{Disabled: true}, + health: Health{ + Disabled: false, + FailureThreshold: 3, + InitialDelaySeconds: 5, + PeriodSeconds: 5, + }, + sdkServerLogLevel: "Debug", }, }, } @@ -233,6 +266,7 @@ func TestGameServerApplyDefaults(t *testing.T) { assert.Equal(t, test.expected.state, test.gameServer.Status.State) assert.Equal(t, test.expected.health, test.gameServer.Spec.Health) assert.Equal(t, test.expected.scheduling, test.gameServer.Spec.Scheduling) + assert.Equal(t, test.expected.sdkServerLogLevel, test.gameServer.Spec.Logging.SdkServer) }) } } @@ -481,6 +515,7 @@ func TestGameServerPatch(t *testing.T) { assert.Contains(t, string(patch), `{"op":"replace","path":"/spec/container","value":"bear"}`) } + func TestGameServerGetDevAddress(t *testing.T) { devGs := &GameServer{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/sdkserver/sdkserver.go b/pkg/sdkserver/sdkserver.go index e4d528a535..b1b00547f3 100644 --- a/pkg/sdkserver/sdkserver.go +++ b/pkg/sdkserver/sdkserver.go @@ -165,7 +165,7 @@ func NewSDKServer(gameServerName, namespace string, kubeClient kubernetes.Interf logfields.GameServerKey, strings.Join([]string{agones.GroupName, s.namespace, s.gameServerName}, ".")) - s.logger.Info("created GameServer sidecar") + s.logger.Info("Created GameServer sidecar") return s, nil } @@ -191,9 +191,22 @@ func (s *SDKServer) Run(stop <-chan struct{}) error { return err } + logLevel := "info" // grab configuration details + if gs.Spec.Logging.SdkServer != "" { + logLevel = strings.ToLower(gs.Spec.Logging.SdkServer) + } + s.logger.WithField("logLevel", logLevel).Info("Setting LogLevel configuration") + level, err := logrus.ParseLevel(logLevel) + if err == nil { + s.logger.Logger.SetLevel(level) + } else { + s.logger.WithError(err).Info("Specified wrong Logging.SdkServer. Setting default loglevel - Info") + s.logger.Logger.SetLevel(logrus.InfoLevel) + } + s.health = gs.Spec.Health - s.logger.WithField("health", s.health).Info("setting health configuration") + s.logger.WithField("health", s.health).Info("Setting health configuration") s.healthTimeout = time.Duration(gs.Spec.Health.PeriodSeconds) * time.Second s.initHealthLastUpdated(time.Duration(gs.Spec.Health.InitialDelaySeconds) * time.Second) @@ -214,7 +227,7 @@ func (s *SDKServer) Run(stop <-chan struct{}) error { go func() { if err := s.server.ListenAndServe(); err != nil { if err == http.ErrServerClosed { - s.logger.WithError(err).Info("health check: http server closed") + s.logger.WithError(err).Info("Health check: http server closed") } else { err = errors.Wrap(err, "Could not listen on :8080") runtime.HandleError(s.logger.WithError(err), err) @@ -319,7 +332,7 @@ func (s *SDKServer) gameServer() (*agonesv1.GameServer, error) { // updateLabels updates the labels on this GameServer to the ones persisted in SDKServer, // i.e. SDKServer.gsLabels, with the prefix of "agones.dev/sdk-" func (s *SDKServer) updateLabels() error { - s.logger.WithField("labels", s.gsLabels).Info("updating label") + s.logger.WithField("labels", s.gsLabels).Info("Updating label") gs, err := s.gameServer() if err != nil { return err @@ -534,7 +547,7 @@ func (s *SDKServer) sendGameServerUpdate(gs *agonesv1.GameServer) { func (s *SDKServer) runHealth() { s.checkHealth() if !s.healthy() { - s.logger.WithField("gameServerName", s.gameServerName).Info("has failed health check") + s.logger.WithField("gameServerName", s.gameServerName).Info("GameServer has failed health check") s.enqueueState(agonesv1.GameServerStateUnhealthy) } } diff --git a/site/content/en/docs/Reference/agones_crd_api_reference.html b/site/content/en/docs/Reference/agones_crd_api_reference.html index 7eaf7a517a..d1417b04a9 100644 --- a/site/content/en/docs/Reference/agones_crd_api_reference.html +++ b/site/content/en/docs/Reference/agones_crd_api_reference.html @@ -3,32 +3,35 @@ description="Detailed list of Agones Custom Resource Definitions available" +++ -{{% feature expiryVersion="0.12.0" %}} +{{% feature expiryVersion="1.1.0" %}}
Packages:
-
Package v1alpha1 is the v1alpha1 version of the API.
+Package v1 is the v1 version of the API.
Resource Types: --
GameServerAllocation is the data structure for allocating against a set of
-GameServers, defined required
and preferred
selectors
Fleet is the data structure for a Fleet resource
-allocation.agones.dev/v1alpha1
+agones.dev/v1
|
@@ -53,7 +56,7 @@ GameServerAllocation |
+Fleet |
||||||||
@@ -73,8 +76,8 @@ GameServerAllocation
spec
-
-GameServerAllocationSpec
+
+FleetSpec
GameServerAllocation
status
-
-GameServerAllocationStatus
+
+FleetStatus
|
-(Appears on: -GameServerAllocation) -
--
GameServerAllocationSpec is the spec for a GameServerAllocation
+GameServer is the data structure for a GameServer resource.
+It is worth noting that while there is a GameServerStatus
Status entry for the GameServer
, it is not
+defined as a subresource - unlike Fleet
and other Agones resources.
+This is so that we can retain the ability to change multiple aspects of a GameServer
in a single atomic operation,
+which is particularly useful for operations such as allocation.
-multiClusterSetting
-
-
-MultiClusterSetting
-
-
+apiVersion
+string |
+
+
+agones.dev/v1
+
|
+
- MultiClusterPolicySelector if specified, multi-cluster policies are applied. -Otherwise, allocation will happen locally. +kind
+string
|
+GameServer |
-required
+metadata
-
-Kubernetes meta/v1.LabelSelector
+
+Kubernetes meta/v1.ObjectMeta
|
- Required The required allocation. Defaults to all GameServers. +Refer to the Kubernetes API documentation for the fields of the +metadata field.
|
-preferred
+spec
-
-[]Kubernetes meta/v1.LabelSelector
+
+GameServerSpec
|
- Preferred ordered list of preferred allocations out of the |
-
-scheduling
+container
-agones.dev/agones/pkg/apis.SchedulingStrategy
+string
|
- Scheduling strategy. Defaults to “Packed”. +Container specifies which Pod container is the game server. Only required if there is more than one +container defined |
-metadata
+ports
-
-MetaPatch
+
+[]GameServerPort
|
- MetaPatch is optional custom metadata that is added to the game server at allocation -You can use this to tell the server necessary session data +Ports are the array of ports that can be exposed via the game server |
string
alias)-(Appears on: -GameServerAllocationStatus) -
--
GameServerAllocationState is the Allocation state
- --(Appears on: -GameServerAllocation) -
--
GameServerAllocationStatus is the status for an GameServerAllocation resource
- -Field | -Description | -
---|---|
-state
+health
-
-GameServerAllocationState
+
+Health
|
- GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated +Health configures health checking |
-gameServerName
+scheduling
-string
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
+ Scheduling strategy. Defaults to “Packed”. |
-ports
+template
-
-[]GameServerStatusPort
+
+Kubernetes core/v1.PodTemplateSpec
|
+ Template describes the Pod that will be created for the GameServer |
-address
-
-string
-
- |
-+ |
nodeName
+status
-string
+
+GameServerStatus
+
-(Appears on: -GameServerAllocationSpec) -
--
MetaPatch is the metadata used to patch the GameServer metadata on allocation
+GameServerSet is the data structure for a set of GameServers. +This matches philosophically with the relationship between +Depoyments and ReplicaSets
-labels
-
-map[string]string
-
+apiVersion
+string |
+
+
+agones.dev/v1
+
|
+
+kind
+string
|
+GameServerSet |
-annotations
+metadata
-map[string]string
+
+Kubernetes meta/v1.ObjectMeta
+
|
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
|
-(Appears on: -GameServerAllocationSpec) -
--
MultiClusterSetting specifies settings for multi-cluster allocation.
- -Field | -Description | -
---|---|
-enabled
-
-bool
-
- |
-- | -
-policySelector
+spec
-
-Kubernetes meta/v1.LabelSelector
+
+GameServerSetSpec
|
- | -
-
Package v1 is the v1 version of the API.
- -Resource Types: - --
FleetAutoscaler is the data structure for a FleetAutoscaler resource
- +Field | -Description | -|||||
---|---|---|---|---|---|---|
-apiVersion
-string |
-
-
-autoscaling.agones.dev/v1
-
- |
-|||||
-kind
-string
- |
-FleetAutoscaler |
-|||||
-metadata
+replicas
-
-Kubernetes meta/v1.ObjectMeta
-
+int32
|
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+Replicas are the number of GameServers that should be in this set |
|||||
-spec
-
-
-FleetAutoscalerSpec
-
-
- |
-
- - -
FleetAutoscaler
status
-
-FleetAutoscalerStatus
+
+GameServerSetStatus
|
(Appears on: -FleetAutoscalerPolicy) +Fleet)
-
BufferPolicy controls the desired behavior of the buffer policy.
+FleetSpec is the spec for a Fleet
-maxReplicas
+replicas
int32
|
- MaxReplicas is the maximum amount of replicas that the fleet may have. -It must be bigger than both MinReplicas and BufferSize +Replicas are the number of GameServers that should be in this set |
-minReplicas
+strategy
-int32
+
+Kubernetes apps/v1.DeploymentStrategy
+
|
- MinReplicas is the minimum amount of replicas that the fleet must have -If zero, it is ignored. -If non zero, it must be smaller than MaxReplicas and bigger than BufferSize +Deployment strategy |
-bufferSize
+scheduling
-k8s.io/apimachinery/pkg/util/intstr.IntOrString
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
- BufferSize defines how many replicas the autoscaler tries to have ready all the time -Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) -Absolute number is calculated from percentage by rounding up. -Example: when this is set to 20%, the autoscaler will make sure that 20% -of the fleet’s game server replicas are ready. When this is set to 20, -the autoscaler will make sure that there are 20 available game servers -Must be bigger than 0 -Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness -and computation stability in different edge case (fleet just created, not enough -capacity in the cluster etc) +Scheduling strategy. Defaults to “Packed”. + |
+
+template
+
+
+GameServerTemplateSpec
+
+
+ |
+
+ Template the GameServer template to apply for this Fleet |
(Appears on: -FleetAutoscaleReview) +Fleet, +FleetAutoscaleRequest)
-
FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
+FleetStatus is the status of a Fleet
-uid
+replicas
-k8s.io/apimachinery/pkg/types.UID
+int32
|
- UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are -otherwise identical (parallel requests, requests when earlier requests did not modify etc) -The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. -It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. +Replicas the total number of current GameServer replicas |
-name
+readyReplicas
-string
+int32
|
- Name is the name of the Fleet being scaled +ReadyReplicas are the number of Ready GameServer replicas |
-namespace
+reservedReplicas
-string
+int32
|
- Namespace is the namespace associated with the request (if any). +ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. +Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up. |
-status
+allocatedReplicas
-
-FleetStatus
-
+int32
|
- The Fleet’s status values +AllocatedReplicas are the number of Allocated GameServer replicas |
(Appears on: -FleetAutoscaleReview) +GameServerSpec)
-
FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
+GameServerPort defines a set of Ports that +are to be exposed via the GameServer
-uid
+name
-k8s.io/apimachinery/pkg/types.UID
+string
|
- UID is an identifier for the individual request/response. -This should be copied over from the corresponding FleetAutoscaleRequest. +Name is the descriptive name of the port |
-scale
+portPolicy
-bool
+
+PortPolicy
+
|
- Set to false if no scaling should occur to the Fleet +PortPolicy defines the policy for how the HostPort is populated.
+Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller
+at installation time.
+When |
-replicas
+containerPort
int32
|
- The targeted replica count +ContainerPort is the port that is being opened on the game server process |
-
FleetAutoscaleReview is passed to the webhook with a populated Request value, -and then returned with a populated Response.
- -Field | -Description | -
---|---|
-request
+hostPort
-
-FleetAutoscaleRequest
-
+int32
|
+ HostPort the port exposed on the host for clients to connect to |
-response
+protocol
-
-FleetAutoscaleResponse
+
+Kubernetes core/v1.Protocol
|
+ Protocol is the network protocol being used. Defaults to UDP. TCP is the only other option |
(Appears on: -FleetAutoscalerSpec) +GameServerSet)
-
FleetAutoscalerPolicy describes how to scale a fleet
+GameServerSetSpec the specification for GameServerSet
-type
+replicas
-
-FleetAutoscalerPolicyType
-
-
- |
-
- Type of autoscaling policy. - |
-
-buffer
-
-
-BufferPolicy
-
-
- |
-
-(Optional)
- Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer. - |
-
-webhook
-
-
-WebhookPolicy
-
+int32
|
-(Optional)
- Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook. +Replicas are the number of GameServers that should be in this set |
string
alias)-(Appears on: -FleetAutoscalerPolicy) -
--
FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet
- --(Appears on: -FleetAutoscaler) -
--
FleetAutoscalerSpec is the spec for a Fleet Scaler
- -Field | -Description | -
---|---|
-fleetName
+scheduling
-string
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
+ Scheduling strategy. Defaults to “Packed”. |
-policy
+template
-
-FleetAutoscalerPolicy
+
+GameServerTemplateSpec
|
- Autoscaling policy +Template the GameServer template to apply for this GameServerSet |
(Appears on: -FleetAutoscaler) +GameServerSet)
-
FleetAutoscalerStatus defines the current status of a FleetAutoscaler
+GameServerSetStatus is the status of a GameServerSet
-currentReplicas
+replicas
int32
|
- CurrentReplicas is the current number of gameserver replicas -of the fleet managed by this autoscaler, as last seen by the autoscaler +Replicas the total number of current GameServer replicas |
-desiredReplicas
+readyReplicas
int32
|
- DesiredReplicas is the desired number of gameserver replicas -of the fleet managed by this autoscaler, as last calculated by the autoscaler +ReadyReplicas are the number of Ready GameServer replicas |
-lastScaleTime
+reservedReplicas
-
-Kubernetes meta/v1.Time
-
+int32
|
-(Optional)
- lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet, +ReservedReplicas are the number of Reserved GameServer replicas |
-ableToScale
+allocatedReplicas
-bool
+int32
|
- AbleToScale indicates that we can access the target fleet +AllocatedReplicas are the number of Allocated GameServer replicas |
-scalingLimited
+shutdownReplicas
-bool
+int32
|
- ScalingLimited indicates that the calculated scale would be above or below the range -defined by MinReplicas and MaxReplicas, and has thus been capped. +ShutdownReplicas are the number of Shutdown GameServers replicas |
(Appears on: -FleetAutoscalerPolicy) +GameServer, +GameServerTemplateSpec)
-
WebhookPolicy controls the desired behavior of the webhook policy. -It contains the description of the webhook autoscaler service -used to form url which is accessible inside the cluster
+GameServerSpec is the spec for a GameServer resource
-url
+container
string
|
-(Optional)
-
The Please note that using The scheme must be “https”; the URL must begin with “https://”. -A path is optional, and if present may be any string permissible in -a URL. You may use the path to pass an arbitrary string to the -webhook, for example, a cluster identifier. -Attempting to use a user or basic auth e.g. “user:password@” is not -allowed. Fragments (“#…”) and query parameters (“?…”) are not -allowed, either. +Container specifies which Pod container is the game server. Only required if there is more than one +container defined |
-service
+ports
-
-Kubernetes admissionregistration/v1beta1.ServiceReference
+
+[]GameServerPort
|
-(Optional)
-
If the webhook is running within the cluster, then you should use Port 443 will be used if it is open, otherwise it is an error. +Ports are the array of ports that can be exposed via the game server |
-caBundle
+health
-[]byte
+
+Health
+
|
-
|
-
-
Package v1alpha1 is the v1alpha1 version of the API.
- -Resource Types: --
Fleet is the data structure for a Fleet resource
- -Field | -Description | -
---|---|
-apiVersion
-string |
-
-
-stable.agones.dev/v1alpha1
-
- |
-
-kind
-string
+Health configures health checking |
-Fleet |
-metadata
+scheduling
-
-Kubernetes meta/v1.ObjectMeta
-
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+Scheduling strategy. Defaults to “Packed”. |
-spec
+template
-
-FleetSpec
+
+Kubernetes core/v1.PodTemplateSpec
|
- - + Template describes the Pod that will be created for the GameServer + |
+
string
alias)+(Appears on: +GameServerStatus) +
++
GameServerState is the state for the GameServer
+ ++(Appears on: +GameServer) +
++
GameServerStatus is the status for a GameServer resource
+Field | +Description | +
---|---|
-replicas
+state
-int32
+
+GameServerState
+
|
- Replicas are the number of GameServers that should be in this set +GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc |
-strategy
+ports
-
-Kubernetes apps/v1.DeploymentStrategy
+
+[]GameServerStatusPort
|
- Deployment strategy |
-scheduling
+address
-agones.dev/agones/pkg/apis.SchedulingStrategy
+string
|
- Scheduling strategy. Defaults to “Packed”. |
-template
+nodeName
-
-GameServerTemplateSpec
-
+string
|
- Template the GameServer template to apply for this Fleet - |
-
status
+reservedUntil
-
-FleetStatus
+
+Kubernetes meta/v1.Time
-
FleetAllocation is the data structure for allocating against a Fleet -Deprecated: Please use GameServerAllocation instead.
+(Appears on: +GameServerAllocationStatus, +GameServerStatus) + ++
GameServerStatusPort shows the port that was allocated to a +GameServer.
-apiVersion
-string |
-
-
-stable.agones.dev/v1alpha1
-
- |
-|||
-kind
-string
- |
-FleetAllocation |
-|||
-metadata
-
-
-Kubernetes meta/v1.ObjectMeta
-
-
- |
-
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
- |
-|||
-spec
-
-
-FleetAllocationSpec
-
-
- |
-
- - -
|
-|||
-status
+port
-
-FleetAllocationStatus
-
+int32
|
@@ -1254,14 +952,15 @@ FleetAllocation |
(Appears on: -FleetAllocationStatus) +FleetSpec, +GameServerSetSpec)
-
GameServer is the data structure for a gameserver resource
+GameServerTemplateSpec is a template for GameServers
-apiVersion
-string |
-
-
-stable.agones.dev/v1alpha1
-
- |
-
-kind
-string
- |
-GameServer |
-
metadata
@@ -1380,26 +1062,94 @@ GameServer |
+(Appears on: +GameServerSpec) +
++
Health configures health checking on the GameServer
+ +Field | +Description | +
---|---|
-status
+disabled
-
-GameServerStatus
-
+bool
+
+ |
+
+ Disabled is whether health checking is disabled or not + |
+
+periodSeconds
+
+int32
+
+ |
+
+ PeriodSeconds is the number of seconds each health ping has to occur in + |
+
+failureThreshold
+
+int32
+
+ |
+
+ FailureThreshold how many failures in a row constitutes unhealthy + |
+
+initialDelaySeconds
+
+int32
|
+ InitialDelaySeconds initial delay before checking health |
string
alias)+(Appears on: +GameServerPort) +
++
PortPolicy is the port policy for the GameServer
+ ++
Package v1 is the v1 version of the API.
+ +Resource Types: + +-
GameServerSet is the data structure a set of GameServers -This matches philosophically with the relationship between -Depoyments and ReplicaSets
+GameServerAllocation is the data structure for allocating against a set of
+GameServers, defined required
and preferred
selectors
-stable.agones.dev/v1alpha1
+allocation.agones.dev/v1
|
@@ -1424,7 +1174,7 @@ GameServerSet |
+GameServerAllocation |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -1442,26 +1192,57 @@ GameServerSet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-spec
+spec
+
+
+GameServerAllocationSpec
+
+
+ |
+
+ + +
FleetAllocationSpec
+ |
-fleetName
+multiClusterSetting
-string
+
+MultiClusterSetting
+
+
+ |
+
+ MultiClusterPolicySelector if specified, multi-cluster policies are applied. +Otherwise, allocation will happen locally. + |
+
+required
+
+
+Kubernetes meta/v1.LabelSelector
+
+
+ |
+
+ Required The required allocation. Defaults to all GameServers. + |
+
+preferred
+
+
+[]Kubernetes meta/v1.LabelSelector
+
+
+ |
+
+ Preferred ordered list of preferred allocations out of the |
+
+scheduling
+
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
+ Scheduling strategy. Defaults to “Packed”. |
+ MetaPatch is optional custom metadata that is added to the game server at allocation +You can use this to tell the server necessary session data |
string
alias)+(Appears on: +GameServerAllocationStatus) +
++
GameServerAllocationState is the Allocation state
+ +(Appears on: -FleetAllocation) +GameServerAllocation)
-
FleetAllocationStatus will contain the
-GameServer
that has been allocated from
-a Fleet
GameServerAllocationStatus is the status for an GameServerAllocation resource
-gameServer
+state
-
-GameServer
+
+GameServerAllocationState
|
+ GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated |
-(Appears on: -Fleet) -
--
FleetSpec is the spec for a Fleet
- -Field | -Description | -
---|---|
-replicas
+gameServerName
-int32
+string
|
- Replicas are the number of GameServers that should be in this set |
-strategy
+ports
-
-Kubernetes apps/v1.DeploymentStrategy
+
+[]GameServerStatusPort
|
- Deployment strategy |
-scheduling
+address
-agones.dev/agones/pkg/apis.SchedulingStrategy
+string
|
- Scheduling strategy. Defaults to “Packed”. |
-template
+nodeName
-
-GameServerTemplateSpec
-
+string
|
- Template the GameServer template to apply for this Fleet |
(Appears on: -Fleet, -FleetAutoscaleRequest) +GameServerAllocationSpec)
-
FleetStatus is the status of a Fleet
+MetaPatch is the metadata used to patch the GameServer metadata on allocation
-replicas
-
-int32
-
- |
-
- Replicas the total number of current GameServer replicas - |
-
-readyReplicas
-
-int32
-
- |
-
- ReadyReplicas are the number of Ready GameServer replicas - |
-
-reservedReplicas
+labels
-int32
+map[string]string
|
- ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. -Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up. |
-allocatedReplicas
+annotations
-int32
+map[string]string
|
- AllocatedReplicas are the number of Allocated GameServer replicas |
(Appears on: -GameServerSpec) +GameServerAllocationSpec)
-
GameServerPort defines a set of Ports that -are to be exposed via the GameServer
+MultiClusterSetting specifies settings for multi-cluster allocation.
-name
+enabled
-string
+bool
|
- Name is the descriptive name of the port |
-portPolicy
+policySelector
-
-PortPolicy
+
+Kubernetes meta/v1.LabelSelector
|
- PortPolicy defines the policy for how the HostPort is populated.
-Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller
-at installation time.
-When |
+
Package v1 is the v1 version of the API.
+ +Resource Types: + ++
FleetAutoscaler is the data structure for a FleetAutoscaler resource
+ +Field | +Description | +
---|---|
-containerPort
-
-int32
-
+apiVersion
+string |
+
+
+autoscaling.agones.dev/v1
+
|
+
- ContainerPort is the port that is being opened on the game server process +kind
+string
|
+FleetAutoscaler |
-hostPort
+metadata
-int32
+
+Kubernetes meta/v1.ObjectMeta
+
|
- HostPort the port exposed on the host for clients to connect to +Refer to the Kubernetes API documentation for the fields of the +metadata field.
|
-protocol
+spec
-
-Kubernetes core/v1.Protocol
+
+FleetAutoscalerSpec
|
- Protocol is the network protocol being used. Defaults to UDP. TCP is the only other option - |
-
-(Appears on: -GameServerSet) -
--
GameServerSetSpec the specification for
- +Field | -Description | -
---|---|
-replicas
+fleetName
-int32
+string
|
- Replicas are the number of GameServers that should be in this set |
-scheduling
+policy
-agones.dev/agones/pkg/apis.SchedulingStrategy
+
+FleetAutoscalerPolicy
+
|
- Scheduling strategy. Defaults to “Packed”. +Autoscaling policy + |
+
template
+status
-
-GameServerTemplateSpec
+
+FleetAutoscalerStatus
Template the GameServer template to apply for this GameServerSet
(Appears on: -GameServerSet) +FleetAutoscalerPolicy)
-
GameServerSetStatus is the status of a GameServerSet
+BufferPolicy controls the desired behavior of the buffer policy.
-replicas
-
-int32
-
- |
-
- Replicas the total number of current GameServer replicas - |
-
-readyReplicas
-
-int32
-
- |
-
- ReadyReplicas are the number of Ready GameServer replicas - |
-
-reservedReplicas
+maxReplicas
int32
|
- ReservedReplicas are the number of Reserved GameServer replicas +MaxReplicas is the maximum amount of replicas that the fleet may have. +It must be bigger than both MinReplicas and BufferSize |
-allocatedReplicas
+minReplicas
int32
|
- AllocatedReplicas are the number of Allocated GameServer replicas +MinReplicas is the minimum amount of replicas that the fleet must have +If zero, it is ignored. +If non zero, it must be smaller than MaxReplicas and bigger than BufferSize |
-shutdownReplicas
+bufferSize
-int32
+k8s.io/apimachinery/pkg/util/intstr.IntOrString
|
- ShutdownReplicas are the number of Shutdown GameServers replicas +BufferSize defines how many replicas the autoscaler tries to have ready all the time +Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) +Absolute number is calculated from percentage by rounding up. +Example: when this is set to 20%, the autoscaler will make sure that 20% +of the fleet’s game server replicas are ready. When this is set to 20, +the autoscaler will make sure that there are 20 available game servers +Must be bigger than 0 +Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness +and computation stability in different edge case (fleet just created, not enough +capacity in the cluster etc) |
(Appears on: -GameServer, -GameServerTemplateSpec) +FleetAutoscaleReview)
-
GameServerSpec is the spec for a GameServer resource
+FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
-container
-
-string
-
- |
-
- Container specifies which Pod container is the game server. Only required if there is more than one -container defined - |
-
-ports
+uid
-
-[]GameServerPort
-
+k8s.io/apimachinery/pkg/types.UID
|
- Ports are the array of ports that can be exposed via the game server +UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are +otherwise identical (parallel requests, requests when earlier requests did not modify etc) +The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. +It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. |
-health
+name
-
-Health
-
+string
|
- Health configures health checking +Name is the name of the Fleet being scaled |
-scheduling
+namespace
-agones.dev/agones/pkg/apis.SchedulingStrategy
+string
|
- Scheduling strategy. Defaults to “Packed”. +Namespace is the namespace associated with the request (if any). |
-template
+status
-
-Kubernetes core/v1.PodTemplateSpec
+
+FleetStatus
|
- Template describes the Pod that will be created for the GameServer +The Fleet’s status values |
string
alias)-(Appears on: -GameServerStatus) -
--
GameServerState is the state for the GameServer
- -(Appears on: -GameServer) +FleetAutoscaleReview)
-
GameServerStatus is the status for a GameServer resource
+FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
-state
-
-
-GameServerState
-
-
- |
-
- GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc - |
-
-ports
+uid
-
-[]GameServerStatusPort
-
+k8s.io/apimachinery/pkg/types.UID
|
+ UID is an identifier for the individual request/response. +This should be copied over from the corresponding FleetAutoscaleRequest. |
-address
+scale
-string
+bool
|
+ Set to false if no scaling should occur to the Fleet |
-nodeName
+replicas
-string
+int32
|
+ The targeted replica count |
-(Appears on: -GameServerAllocationStatus, -GameServerStatus) -
--
GameServerStatusPort shows the port that was allocated to a -GameServer.
+FleetAutoscaleReview is passed to the webhook with a populated Request value, +and then returned with a populated Response.
-name
+request
-string
+
+FleetAutoscaleRequest
+
|
@@ -2109,9 +1855,11 @@ GameServerStatusPort |
-port
+response
-int32
+
+FleetAutoscaleResponse
+
|
@@ -2119,126 +1867,126 @@ GameServerStatusPort |
(Appears on: -FleetSpec, -GameServerSetSpec) +FleetAutoscalerSpec)
-
GameServerTemplateSpec is a template for GameServers
+FleetAutoscalerPolicy describes how to scale a fleet
-Field | -Description | -|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-metadata
-
-
-Kubernetes meta/v1.ObjectMeta
-
-
- |
-
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
- |
+
Field | +Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-spec
+type
-
-GameServerSpec
+
+FleetAutoscalerPolicyType
|
- - -
FleetAutoscalerPolicyType
+(
+ |
Field | +Description | +
---|---|
-scheduling
+fleetName
-agones.dev/agones/pkg/apis.SchedulingStrategy
+string
|
- Scheduling strategy. Defaults to “Packed”. |
-template
+policy
-
-Kubernetes core/v1.PodTemplateSpec
+
+FleetAutoscalerPolicy
|
- Template describes the Pod that will be created for the GameServer - |
-
Autoscaling policy
(Appears on: -GameServerSpec) +FleetAutoscaler)
-
Health configures health checking on the GameServer
+FleetAutoscalerStatus defines the current status of a FleetAutoscaler
-disabled
+currentReplicas
-bool
+int32
|
- Disabled is whether health checking is disabled or not +CurrentReplicas is the current number of gameserver replicas +of the fleet managed by this autoscaler, as last seen by the autoscaler |
-periodSeconds
+desiredReplicas
int32
|
- PeriodSeconds is the number of seconds each health ping has to occur in +DesiredReplicas is the desired number of gameserver replicas +of the fleet managed by this autoscaler, as last calculated by the autoscaler |
-failureThreshold
+lastScaleTime
-int32
+
+Kubernetes meta/v1.Time
+
|
- FailureThreshold how many failures in a row constitutes unhealthy +(Optional) +lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet, |
-initialDelaySeconds
+ableToScale
-int32
+bool
|
- InitialDelaySeconds initial delay before checking health +AbleToScale indicates that we can access the target fleet + |
+
+scalingLimited
+
+bool
+
+ |
+
+ ScalingLimited indicates that the calculated scale would be above or below the range +defined by MinReplicas and MaxReplicas, and has thus been capped. |
(Appears on: -FleetAllocationSpec) +FleetAutoscalerPolicy)
-
MetaPatch is the metadata used to patch the GameServer metadata on allocation
+WebhookPolicy controls the desired behavior of the webhook policy. +It contains the description of the webhook autoscaler service +used to form url which is accessible inside the cluster
-labels
+url
-map[string]string
+string
+
+ |
+
+(Optional)
+
The Please note that using The scheme must be “https”; the URL must begin with “https://”. +A path is optional, and if present may be any string permissible in +a URL. You may use the path to pass an arbitrary string to the +webhook, for example, a cluster identifier. +Attempting to use a user or basic auth e.g. “user:password@” is not +allowed. Fragments (“#…”) and query parameters (“?…”) are not +allowed, either. + |
+
+service
+
+
+Kubernetes admissionregistration/v1beta1.ServiceReference
+
|
+(Optional)
+
If the webhook is running within the cluster, then you should use Port 443 will be used if it is open, otherwise it is an error. |
-annotations
+caBundle
-map[string]string
+[]byte
|
+
|
string
alias)-(Appears on: -GameServerPort) -
--
PortPolicy is the port policy for the GameServer
-
Generated with gen-crd-api-reference-docs
.
Packages:
Scheduling strategy. Defaults to “Packed”.
+Scheduling strategy. Defaults to “Packed”
+logging
+
+
+Logging
+
+
+Logging specifies log levels for Agones system containers
Scheduling strategy. Defaults to “Packed”.
+Scheduling strategy. Defaults to “Packed”
+logging
+
+
+Logging
+
+
+Logging specifies log levels for Agones system containers
Scheduling strategy. Defaults to “Packed”.
+Scheduling strategy. Defaults to “Packed”
+logging
+
+
+Logging
+
+
+Logging specifies log levels for Agones system containers
+(Appears on: +GameServerSpec) +
++
Logging specifies log levels for Agones system containers
+ +Field | +Description | +
---|---|
+sdkServer
+
+string
+
+ |
+
+ SdkServer is a log level for SDK server (sidecar) logs. Defaults to “Info” + |
+
string
alias)
diff --git a/site/content/en/docs/Reference/fleet.md b/site/content/en/docs/Reference/fleet.md
index 76e7efae76..3d486a0a9f 100644
--- a/site/content/en/docs/Reference/fleet.md
+++ b/site/content/en/docs/Reference/fleet.md
@@ -57,6 +57,11 @@ spec:
health:
initialDelaySeconds: 30
periodSeconds: 60
+{{% feature publishVersion="1.1.0" %}}
+ # logging parameters for game server sidecar
+ logging:
+ sdkServer: Info
+{{% /feature %}}
# The GameServer's Pod template
template:
spec:
diff --git a/site/content/en/docs/Reference/gameserver.md b/site/content/en/docs/Reference/gameserver.md
index 8efe30da30..da64e9a099 100644
--- a/site/content/en/docs/Reference/gameserver.md
+++ b/site/content/en/docs/Reference/gameserver.md
@@ -24,7 +24,7 @@ spec:
ports:
# name is a descriptive name for the port
- name: default
- # portPolicy has two options:
+ # portPolicy has three options:
# - "Dynamic" (default) the system allocates a free hostPort for the gameserver, for game clients to connect to
# - "Static", user defines the hostPort that the game client will connect to. Then onus is on the user to ensure that the
# - "Passthrough" dynamically sets the `containerPort` to the same value as the dynamically selected hostPort.
@@ -49,6 +49,15 @@ spec:
# Minimum consecutive failures for the health probe to be considered failed after having succeeded.
# Defaults to 3. Minimum value is 1
failureThreshold: 3
+{{% feature publishVersion="1.1.0" %}}
+ # logging parameters for game server sidecar
+ logging:
+ # sdkServer logging parameter has three options:
+ # - "Info" (default) The SDK server will output all messages except for debug messages
+ # - "Debug" The SDK server will output all messages including debug messages
+ # - "Error" The SDK server will only output error messages
+ sdkServer: Info
+{{% /feature %}}
# Pod template configuration
# https://v1-12.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#podtemplate-v1-core
template:
@@ -83,6 +92,13 @@ The `spec` field is the actual GameServer specification and it is composed as fo
- `containerPort` the port that is being opened on the game server process, this is a required field for `Dynamic` and `Static` port policies, and should not be included in Passthrough
configuration.
- `protocol` the protocol being used. Defaults to UDP. TCP is the only other option.
- `health` to track the overall healthy state of the GameServer, more information available in the [health check documentation]({{< relref "../Guides/health-checking.md" >}}).
+{{% feature publishVersion="1.1.0" %}}
+-`logging` define log level for sidecars
+ - `sdkServer` field defines log level for SDK server. Defaults to "Info". It has three options:
+ - "Info" (default) The SDK server will output all messages except for debug messages
+ - "Debug" The SDK server will output all messages including debug messages
+ - "Error" The SDK server will only output error messages
+{{% /feature %}}
- `template` the [pod spec template](https://v1-12.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#podtemplatespec-v1-core) to run your GameServer containers, [see](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#pod-templates) for more information.
## GameServer State Diagram