gameservers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package gameservers handles management of the GameServer Custom Resource Definition

Index

Constants

View Source
const (
	PortType      = "Port"
	PortRangeType = "PortRange"
)
View Source
const (
	// ToBeDeletedTaint is a taint used to make the node unschedulable.
	ToBeDeletedTaint = "ToBeDeletedByClusterAutoscaler"
)

Variables

View Source
var (
	//ErrRangeFull returned when no more free values in the pool.
	ErrRangeFull = errors.New("range full")
)

Functions

func AddNotInServiceConstraint

func AddNotInServiceConstraint(gs *carrierv1alpha1.GameServer)

AddNotInServiceConstraint will add `NotInService` constraint to GameServer Spec.

func ApplyDefaults

func ApplyDefaults(gs *carrierv1alpha1.GameServer)

ApplyDefaults applies default values to the GameServer if they are not already populated

func CanInPlaceUpdating

func CanInPlaceUpdating(gs *carrierv1alpha1.GameServer) bool

CanInPlaceUpdating checks if a GameServer can inplace updating

func FindContainer

func FindContainer(gss *carrierv1alpha1.GameServerSpec, name string) (int, corev1.Container, error)

FindContainer returns the container specified by the name parameter. Returns the index and the value. Returns an error if not found.

func IsBeforeRunning

func IsBeforeRunning(gs *carrierv1alpha1.GameServer) bool

IsBeforeRunning returns if GameServer is not running.

func IsBeingDeleted

func IsBeingDeleted(gs *carrierv1alpha1.GameServer) bool

IsBeingDeleted returns true if the server is in the process of being deleted.

func IsDeletable

func IsDeletable(gs *carrierv1alpha1.GameServer) bool

IsDeletable returns false if the server is currently not deletable

func IsDeletableExist

func IsDeletableExist(gs *carrierv1alpha1.GameServer) bool

IsDeletableExist checks if deletable gates exits

func IsDeletableWithGates

func IsDeletableWithGates(gs *carrierv1alpha1.GameServer) bool

IsDeletableWithGates returns false if the server is currently not deletable and has deletableGates

func IsDynamicPortAllocated

func IsDynamicPortAllocated(gs *carrierv1alpha1.GameServer) bool

IsDynamicPortAllocated checks if ports allocated

func IsInPlaceUpdating

func IsInPlaceUpdating(gs *carrierv1alpha1.GameServer) bool

IsInPlaceUpdating checks if a GameServer is inplace updating

func IsLoadBalancerPortExist

func IsLoadBalancerPortExist(gs *carrierv1alpha1.GameServer) bool

IsLoadBalancerPortExist check if a GameServer requires Load Balancer.

func IsOutOfService

func IsOutOfService(gs *carrierv1alpha1.GameServer) bool

IsOutOfService checks if a GameServer is marked out of service, and a delete candidate

func IsReadinessExist

func IsReadinessExist(gs *carrierv1alpha1.GameServer) bool

IsReadinessExist checks if readiness gates exits

func IsReady

func IsReady(gs *carrierv1alpha1.GameServer) bool

IsReady returns true if the GameServer Status Condition are all OK

func IsStopped

func IsStopped(gs *carrierv1alpha1.GameServer) bool

IsStopped returns true if the server is failed or exited

func NotInServiceConstraint

func NotInServiceConstraint() carrierv1alpha1.Constraint

NotInServiceConstraint describe a constraint that gs should not be in service again.

func SetInPlaceUpdatingStatus

func SetInPlaceUpdatingStatus(gs *carrierv1alpha1.GameServer, status string)

SetInPlaceUpdatingStatus set if it is inplace updating

Types

type Allocator

type Allocator interface {
	Allocate(string, string, int, bool) ([]int, error)
	Release(string, string, []int)
	SetUsed(string, string, []int)
}

Allocator is an Interface that can adjust its min/max range. Allocator should be threadsafe

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is a the main GameServer crd controller

func NewController

func NewController(
	kubeClient kubernetes.Interface,
	kubeInformerFactory informers.SharedInformerFactory,
	carrierClient versioned.Interface,
	carrierInformerFactory externalversions.SharedInformerFactory,
	minPort, maxPort int) *Controller

NewController returns a new GameServer crd controller

func (*Controller) Run

func (c *Controller) Run(workers int, stop <-chan struct{}) error

Run the GameServer controller. Will block until stop is closed. Runs threadiness number workers to process the rate limited queue

type MinMaxAllocator

type MinMaxAllocator struct {
	// contains filtered or unexported fields
}

MinMaxAllocator defines allocator struct.

func NewMinMaxAllocator

func NewMinMaxAllocator(min, max int) *MinMaxAllocator

NewMinMaxAllocator return a new allocator or error based on provided min/max value.

func (*MinMaxAllocator) Allocate

func (a *MinMaxAllocator) Allocate(refId, id string, count int, continuous bool) ([]int, error)

Allocate allocates multi continuous ports from the allocator.

func (*MinMaxAllocator) Release

func (a *MinMaxAllocator) Release(refId, id string, ports []int)

Release free/delete provided value from the allocator.

func (*MinMaxAllocator) SetUsed

func (a *MinMaxAllocator) SetUsed(refId string, id string, ports []int)

SetUsed sets a list of ports as used.

Jump to

Keyboard shortcuts

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