v1

package
v1.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 14 Imported by: 8

Documentation

Overview

Package v1 is the v1 version of the API. +groupName=allocation.agones.dev

Index

Constants

View Source
const (
	// GameServerAllocationAllocated is allocation successful
	GameServerAllocationAllocated GameServerAllocationState = "Allocated"
	// GameServerAllocationUnAllocated when the allocation is unsuccessful
	GameServerAllocationUnAllocated GameServerAllocationState = "UnAllocated"
	// GameServerAllocationContention when the allocation is unsuccessful
	// because of contention
	GameServerAllocationContention GameServerAllocationState = "Contention"
	// GameServerAllocationPriorityCounter is a PriorityType for sorting Game Servers by Counter
	GameServerAllocationPriorityCounter string = "Counter"
	// GameServerAllocationPriorityList is a PriorityType for sorting Game Servers by List
	GameServerAllocationPriorityList string = "List"
	// GameServerAllocationAscending is a Priority Order where the smaller count is preferred in sorting.
	GameServerAllocationAscending string = "Ascending"
	// GameServerAllocationDescending is a Priority Order where the larger count is preferred in sorting.
	GameServerAllocationDescending string = "Descending"
)

Variables

View Source
var (
	// SchemeBuilder registers our types
	SchemeBuilder = k8sruntime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme local alias for SchemeBuilder.AddToScheme
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: allocation.GroupName, Version: "v1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type CounterAction added in v1.32.0

type CounterAction struct {
	Action   *string `json:"action,omitempty"`
	Amount   *int64  `json:"amount,omitempty"`
	Capacity *int64  `json:"capacity,omitempty"`
}

CounterAction is an optional action that can be performed on a Counter at allocation. Action: "Increment" or "Decrement" the Counter's Count (optional). Must also define the Amount. Amount: The amount to increment or decrement the Count (optional). Must be a positive integer. Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max int64.

func (*CounterAction) CounterActions added in v1.32.0

func (ca *CounterAction) CounterActions(counter string, gs *agonesv1.GameServer) error

CounterActions attempts to peform any actions from the CounterAction on the GameServer Counter. Returns the errors of any actions that could not be performed.

func (*CounterAction) DeepCopy added in v1.32.0

func (in *CounterAction) DeepCopy() *CounterAction

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CounterAction.

func (*CounterAction) DeepCopyInto added in v1.32.0

func (in *CounterAction) DeepCopyInto(out *CounterAction)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CounterSelector added in v1.31.0

type CounterSelector struct {
	MinCount     int64 `json:"minCount"`
	MaxCount     int64 `json:"maxCount"`
	MinAvailable int64 `json:"minAvailable"`
	MaxAvailable int64 `json:"maxAvailable"`
}

CounterSelector is the filter options for a GameServer based on the count and/or available capacity. 0 for MaxCount or MaxAvailable means unlimited maximum. Default for all fields: 0

func (*CounterSelector) DeepCopy added in v1.31.0

func (in *CounterSelector) DeepCopy() *CounterSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CounterSelector.

func (*CounterSelector) DeepCopyInto added in v1.31.0

func (in *CounterSelector) DeepCopyInto(out *CounterSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GameServerAllocation

type GameServerAllocation struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              GameServerAllocationSpec   `json:"spec"`
	Status            GameServerAllocationStatus `json:"status,omitempty"`
}

GameServerAllocation is the data structure for allocating against a set of GameServers, defined `selectors` selectors

func (*GameServerAllocation) ApplyDefaults

func (gsa *GameServerAllocation) ApplyDefaults()

ApplyDefaults applies the default values to this GameServerAllocation

func (*GameServerAllocation) Converter added in v1.17.0

func (gsa *GameServerAllocation) Converter()

Converter converts game server allocation required and preferred fields to selectors field.

func (*GameServerAllocation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocation.

func (*GameServerAllocation) DeepCopyInto

func (in *GameServerAllocation) DeepCopyInto(out *GameServerAllocation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GameServerAllocation) DeepCopyObject

func (in *GameServerAllocation) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*GameServerAllocation) Validate

func (gsa *GameServerAllocation) Validate() ([]metav1.StatusCause, bool)

Validate validation for the GameServerAllocation Validate should be called before attempting to Match any of the GameServer selectors.

type GameServerAllocationList

type GameServerAllocationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []GameServerAllocation `json:"items"`
}

GameServerAllocationList is a list of GameServer Allocation resources

func (*GameServerAllocationList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationList.

func (*GameServerAllocationList) DeepCopyInto

func (in *GameServerAllocationList) DeepCopyInto(out *GameServerAllocationList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GameServerAllocationList) DeepCopyObject

func (in *GameServerAllocationList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GameServerAllocationSpec

type GameServerAllocationSpec struct {
	// MultiClusterPolicySelector if specified, multi-cluster policies are applied.
	// Otherwise, allocation will happen locally.
	MultiClusterSetting MultiClusterSetting `json:"multiClusterSetting,omitempty"`

	// Deprecated: use field Selectors instead. If Selectors is set, this field is ignored.
	// Required is the GameServer selector from which to choose GameServers from.
	// Defaults to all GameServers.
	Required GameServerSelector `json:"required,omitempty"`

	// Deprecated: use field Selectors instead. If Selectors is set, this field is ignored.
	// Preferred is an ordered list of preferred GameServer selectors
	// that are optional to be fulfilled, but will be searched before the `required` selector.
	// If the first selector is not matched, the selection attempts the second selector, and so on.
	// If any of the preferred selectors are matched, the required selector is not considered.
	// This is useful for things like smoke testing of new game servers.
	Preferred []GameServerSelector `json:"preferred,omitempty"`

	// (Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most
	// important for sorting. The allocator will use the first priority for sorting GameServers in the
	// Selector set, and will only use any following priority for tie-breaking during sort.
	// Impacts which GameServer is checked first.
	// +optional
	Priorities []Priority `json:"priorities,omitempty"`

	// Ordered list of GameServer label selectors.
	// If the first selector is not matched, the selection attempts the second selector, and so on.
	// This is useful for things like smoke testing of new game servers.
	// Note: This field can only be set if neither Required or Preferred is set.
	Selectors []GameServerSelector `json:"selectors,omitempty"`

	// Scheduling strategy. Defaults to "Packed".
	Scheduling apis.SchedulingStrategy `json:"scheduling"`

	// 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
	MetaPatch MetaPatch `json:"metadata,omitempty"`

	// (Alpha, CountsAndLists feature flag) Counters and Lists provide a set of actions to perform
	// on Counters and Lists during allocation.
	// +optional
	Counters map[string]CounterAction `json:"counters,omitempty"`
	Lists    map[string]ListAction    `json:"lists,omitempty"`
}

GameServerAllocationSpec is the spec for a GameServerAllocation

func (*GameServerAllocationSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationSpec.

func (*GameServerAllocationSpec) DeepCopyInto

func (in *GameServerAllocationSpec) DeepCopyInto(out *GameServerAllocationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GameServerAllocationState

type GameServerAllocationState string

GameServerAllocationState is the Allocation state

type GameServerAllocationStatus

type GameServerAllocationStatus struct {
	// GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated
	State          GameServerAllocationState       `json:"state"`
	GameServerName string                          `json:"gameServerName"`
	Ports          []agonesv1.GameServerStatusPort `json:"ports,omitempty"`
	Address        string                          `json:"address,omitempty"`
	NodeName       string                          `json:"nodeName,omitempty"`
	// If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator.
	// Otherwise, Source is "local"
	Source string `json:"source"`
}

GameServerAllocationStatus is the status for an GameServerAllocation resource

func (*GameServerAllocationStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerAllocationStatus.

func (*GameServerAllocationStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GameServerSelector added in v1.17.0

type GameServerSelector struct {
	// See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
	metav1.LabelSelector `json:",inline"`
	// [Stage:Beta]
	// [FeatureFlag:StateAllocationFilter]
	// +optional
	// GameServerState specifies which State is the filter to be used when attempting to retrieve a GameServer
	// via Allocation. Defaults to "Ready". The only other option is "Allocated", which can be used in conjunction with
	// label/annotation/player selectors to retrieve an already Allocated GameServer.
	GameServerState *agonesv1.GameServerState `json:"gameServerState,omitempty"`
	// [Stage:Alpha]
	// [FeatureFlag:PlayerAllocationFilter]
	// +optional
	// Players provides a filter on minimum and maximum values for player capacity when retrieving a GameServer
	// through Allocation. Defaults to no limits.
	Players *PlayerSelector `json:"players,omitempty"`
	// (Alpha, CountsAndLists feature flag) Counters provides filters on minimum and maximum values
	// for a Counter's count and available capacity when retrieving a GameServer through Allocation.
	// Defaults to no limits.
	// +optional
	Counters map[string]CounterSelector `json:"counters,omitempty"`
	// (Alpha, CountsAndLists feature flag) Lists provides filters on minimum and maximum values
	// for List capacity, and for the existence of a value in a List, when retrieving a GameServer
	// through Allocation. Defaults to no limits.
	// +optional
	Lists map[string]ListSelector `json:"lists,omitempty"`
}

GameServerSelector contains all the filter options for selecting a GameServer for allocation.

func (*GameServerSelector) ApplyDefaults added in v1.17.0

func (s *GameServerSelector) ApplyDefaults()

ApplyDefaults applies default values

func (*GameServerSelector) DeepCopy added in v1.17.0

func (in *GameServerSelector) DeepCopy() *GameServerSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GameServerSelector.

func (*GameServerSelector) DeepCopyInto added in v1.17.0

func (in *GameServerSelector) DeepCopyInto(out *GameServerSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GameServerSelector) Matches added in v1.17.0

func (s *GameServerSelector) Matches(gs *agonesv1.GameServer) bool

Matches checks to see if a GameServer matches a given GameServerSelector's criteria. Will panic if the `GameServerSelector` has not passed `Validate()`.

func (*GameServerSelector) Validate added in v1.17.0

func (s *GameServerSelector) Validate(field string) ([]metav1.StatusCause, bool)

Validate validates that the selection fields have valid values

type ListAction added in v1.32.0

type ListAction struct {
	AddValues []string `json:"addValues,omitempty"`
	Capacity  *int64   `json:"capacity,omitempty"`
}

ListAction is an optional action that can be performed on a List at allocation. AddValues: Append values to a List's Values array (optional). Any duplicate values will be ignored. Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max 1000.

func (*ListAction) DeepCopy added in v1.32.0

func (in *ListAction) DeepCopy() *ListAction

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListAction.

func (*ListAction) DeepCopyInto added in v1.32.0

func (in *ListAction) DeepCopyInto(out *ListAction)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ListAction) ListActions added in v1.32.0

func (la *ListAction) ListActions(list string, gs *agonesv1.GameServer) error

ListActions attempts to peform any actions from the ListAction on the GameServer List. Returns a string list of any actions that could not be performed.

type ListSelector added in v1.31.0

type ListSelector struct {
	ContainsValue string `json:"containsValue"`
	MinAvailable  int64  `json:"minAvailable"`
	MaxAvailable  int64  `json:"maxAvailable"`
}

ListSelector is the filter options for a GameServer based on List available capacity and/or the existence of a value in a List. 0 for MaxAvailable means unlimited maximum. Default for integer fields: 0 "" for ContainsValue means ignore field. Default for string field: ""

func (*ListSelector) DeepCopy added in v1.31.0

func (in *ListSelector) DeepCopy() *ListSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListSelector.

func (*ListSelector) DeepCopyInto added in v1.31.0

func (in *ListSelector) DeepCopyInto(out *ListSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetaPatch

type MetaPatch struct {
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

MetaPatch is the metadata used to patch the GameServer metadata on allocation

func (*MetaPatch) DeepCopy

func (in *MetaPatch) DeepCopy() *MetaPatch

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetaPatch.

func (*MetaPatch) DeepCopyInto

func (in *MetaPatch) DeepCopyInto(out *MetaPatch)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MetaPatch) Validate added in v1.21.0

func (mp *MetaPatch) Validate() ([]metav1.StatusCause, bool)

Validate returns if the labels and/or annotations that are to be applied to a `GameServer` post allocation are valid.

type MultiClusterSetting

type MultiClusterSetting struct {
	Enabled        bool                 `json:"enabled,omitempty"`
	PolicySelector metav1.LabelSelector `json:"policySelector,omitempty"`
}

MultiClusterSetting specifies settings for multi-cluster allocation.

func (*MultiClusterSetting) DeepCopy

func (in *MultiClusterSetting) DeepCopy() *MultiClusterSetting

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiClusterSetting.

func (*MultiClusterSetting) DeepCopyInto

func (in *MultiClusterSetting) DeepCopyInto(out *MultiClusterSetting)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PlayerSelector added in v1.17.0

type PlayerSelector struct {
	MinAvailable int64 `json:"minAvailable,omitempty"`
	MaxAvailable int64 `json:"maxAvailable,omitempty"`
}

PlayerSelector is the filter options for a GameServer based on player counts

func (*PlayerSelector) DeepCopy added in v1.17.0

func (in *PlayerSelector) DeepCopy() *PlayerSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlayerSelector.

func (*PlayerSelector) DeepCopyInto added in v1.17.0

func (in *PlayerSelector) DeepCopyInto(out *PlayerSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Priority added in v1.32.0

type Priority struct {
	PriorityType string `json:"priorityType"`
	Key          string `json:"key"`
	Order        string `json:"order"`
}

Priority is a sorting option for GameServers with Counters or Lists based on the count or number of items in a List. PriorityType: Sort by a "Counter" or a "List". Key: The name of the Counter or List. If not found on the GameServer, has no impact. Order: Sort by "Ascending" or "Descending". Default is "Descending" so bigger count is preferred. "Ascending" would be smaller count is preferred.

func (*Priority) DeepCopy added in v1.32.0

func (in *Priority) DeepCopy() *Priority

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Priority.

func (*Priority) DeepCopyInto added in v1.32.0

func (in *Priority) DeepCopyInto(out *Priority)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL