v1

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 10

Documentation

Overview

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

Index

Constants

This section is empty.

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 must to either "Increment" or "Decrement" the Counter's Count. Must also define the Amount.
	// +optional
	Action *string `json:"action,omitempty"`
	// Amount is the amount to increment or decrement the Count. Must be a positive integer.
	// +optional
	Amount *int64 `json:"amount,omitempty"`
	// Capacity is the amount to update the maximum capacity of the Counter to this number. Min 0, Max int64.
	// +optional
	Capacity *int64 `json:"capacity,omitempty"`
}

CounterAction is an optional action that can be performed on a Counter at allocation.

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 is the minimum current value. Defaults to 0.
	// +optional
	MinCount int64 `json:"minCount"`
	// MaxCount is the maximum current value. Defaults to 0, which translates as max(in64).
	// +optional
	MaxCount int64 `json:"maxCount"`
	// MinAvailable specifies the minimum capacity (current capacity - current count) available on a GameServer. Defaults to 0.
	// +optional
	MinAvailable int64 `json:"minAvailable"`
	// MaxAvailable specifies the maximum capacity (current capacity - current count) available on a GameServer. Defaults to 0, which translates to max(int64).
	// +optional
	MaxAvailable int64 `json:"maxAvailable"`
}

CounterSelector is the filter options for a GameServer based on the count and/or available capacity.

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) SortKey added in v1.34.0

func (gsa *GameServerAllocation) SortKey() (uint64, error)

SortKey generates and returns the hash of the GameServerAllocationSpec []Priority and Scheduling. Note: The hash:"ignore" in GameServerAllocationSpec means that these fields will not be considered in hashing. The hash is used for determining when GameServerAllocations have equal or different []Priority and Scheduling.

func (*GameServerAllocation) Validate

func (gsa *GameServerAllocation) Validate() field.ErrorList

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" hash:"ignore"`

	// 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" hash:"ignore"`

	// 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" hash:"ignore"`

	// [Stage: Beta]
	// [FeatureFlag:CountsAndLists]
	// `Priorities` configuration alters the order in which `GameServers` are searched for matches to the configured `selectors`.
	//
	// Priority of sorting is in descending importance. I.e. The position 0 `priority` entry is checked first.
	//
	// For `Packed` strategy sorting, this priority list will be the tie-breaker within the least utilised infrastructure, to ensure optimal
	// infrastructure usage while also allowing some custom prioritisation of `GameServers`.
	//
	// For `Distributed` strategy sorting, the entire selection of `GameServers` will be sorted by this priority list to provide the
	// order that `GameServers` will be allocated by.
	// +optional
	Priorities []agonesv1.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" hash:"ignore"`

	// 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" hash:"ignore"`

	// [Stage: Beta]
	// [FeatureFlag:CountsAndLists]
	// Counter actions to perform during allocation.
	// +optional
	Counters map[string]CounterAction `json:"counters,omitempty" hash:"ignore"`
	// [Stage: Beta]
	// [FeatureFlag:CountsAndLists]
	// List actions to perform during allocation.
	// +optional
	Lists map[string]ListAction `json:"lists,omitempty" hash:"ignore"`
}

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

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"
)

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"`
	Addresses      []corev1.NodeAddress            `json:"addresses,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"`
	Metadata *GameServerMetadata               `json:"metadata,omitempty"`
	Counters map[string]agonesv1.CounterStatus `json:"counters,omitempty"`
	Lists    map[string]agonesv1.ListStatus    `json:"lists,omitempty"`
}

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 GameServerMetadata added in v1.33.0

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

GameServerMetadata is the metadata from the allocated game server at allocation time

func (*GameServerMetadata) DeepCopy added in v1.33.0

func (in *GameServerMetadata) DeepCopy() *GameServerMetadata

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

func (*GameServerMetadata) DeepCopyInto added in v1.33.0

func (in *GameServerMetadata) DeepCopyInto(out *GameServerMetadata)

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"`
	// 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"`
	// [Stage: Beta]
	// [FeatureFlag:CountsAndLists]
	// 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"`
	// [Stage: Beta]
	// [FeatureFlag:CountsAndLists]
	// 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(fldPath *field.Path) field.ErrorList

Validate validates that the selection fields have valid values

type ListAction added in v1.32.0

type ListAction struct {
	// AddValues appends values to a List's Values array. Any duplicate values will be ignored.
	// +optional
	AddValues []string `json:"addValues,omitempty"`
	// Capacity updates the maximum capacity of the Counter to this number. Min 0, Max 1000.
	// +optional
	Capacity *int64 `json:"capacity,omitempty"`
}

ListAction is an optional action that can be performed on a List at allocation.

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 says to only match GameServers who has this value in the list. Defaults to "", which is all.
	// +optional
	ContainsValue string `json:"containsValue"`
	// MinAvailable specifies the minimum capacity (current capacity - current count) available on a GameServer. Defaults to 0.
	// +optional
	MinAvailable int64 `json:"minAvailable"`
	// MaxAvailable specifies the maximum capacity (current capacity - current count) available on a GameServer. Defaults to 0, which is translated as max(int64).
	// +optional
	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.

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(fldPath *field.Path) field.ErrorList

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.

Jump to

Keyboard shortcuts

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