Documentation ¶
Overview ¶
Package gameservers handles management of the GameServer Custom Resource Definition
Index ¶
- type Controller
- type HealthController
- type LocalSDKServer
- func (l *LocalSDKServer) Close()
- func (l *LocalSDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error)
- func (l *LocalSDKServer) Health(stream sdk.SDK_HealthServer) error
- func (l *LocalSDKServer) Ready(context.Context, *sdk.Empty) (*sdk.Empty, error)
- func (l *LocalSDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)
- func (l *LocalSDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)
- func (l *LocalSDKServer) Shutdown(context.Context, *sdk.Empty) (*sdk.Empty, error)
- func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error
- type Operation
- type PortAllocator
- type SDKServer
- func (s *SDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error)
- func (s *SDKServer) Health(stream sdk.SDK_HealthServer) error
- func (s *SDKServer) Ready(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error)
- func (s *SDKServer) Run(stop <-chan struct{}) error
- func (s *SDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)
- func (s *SDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error)
- func (s *SDKServer) Shutdown(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error)
- func (s *SDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a the main GameServer crd controller
func NewController ¶
func NewController( wh *webhooks.WebHook, health healthcheck.Handler, allocationMutex *sync.Mutex, minPort, maxPort int32, sidecarImage string, alwaysPullSidecarImage bool, sidecarCPURequest resource.Quantity, sidecarCPULimit resource.Quantity, kubeClient kubernetes.Interface, kubeInformerFactory informers.SharedInformerFactory, extClient extclientset.Interface, agonesClient versioned.Interface, agonesInformerFactory externalversions.SharedInformerFactory) *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 HealthController ¶
type HealthController struct {
// contains filtered or unexported fields
}
HealthController watches Pods, and applies an Unhealthy state if certain pods crash, or can't be assigned a port, and other similar type conditions.
func NewHealthController ¶
func NewHealthController(kubeClient kubernetes.Interface, agonesClient versioned.Interface, kubeInformerFactory informers.SharedInformerFactory, agonesInformerFactory externalversions.SharedInformerFactory) *HealthController
NewHealthController returns a HealthController
func (*HealthController) Run ¶
func (hc *HealthController) Run(stop <-chan struct{})
Run processes the rate limited queue. Will block until stop is closed
type LocalSDKServer ¶
type LocalSDKServer struct {
// contains filtered or unexported fields
}
LocalSDKServer type is the SDKServer implementation for when the sidecar is being run for local development, and doesn't connect to the Kubernetes cluster
func NewLocalSDKServer ¶ added in v0.4.0
func NewLocalSDKServer(filePath string) (*LocalSDKServer, error)
NewLocalSDKServer returns the default LocalSDKServer
func (*LocalSDKServer) Close ¶ added in v0.6.0
func (l *LocalSDKServer) Close()
Close tears down all the things
func (*LocalSDKServer) GetGameServer ¶ added in v0.3.0
func (l *LocalSDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error)
GetGameServer returns a dummy game server.
func (*LocalSDKServer) Health ¶
func (l *LocalSDKServer) Health(stream sdk.SDK_HealthServer) error
Health logs each health ping that comes down the stream
func (*LocalSDKServer) SetAnnotation ¶ added in v0.4.0
SetAnnotation applies a Annotation to the backing GameServer metadata
func (*LocalSDKServer) SetLabel ¶ added in v0.4.0
SetLabel applies a Label to the backing GameServer metadata
func (*LocalSDKServer) WatchGameServer ¶ added in v0.4.0
func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error
WatchGameServer will return a dummy GameServer (with no changes), 3 times, every 5 seconds
type PortAllocator ¶
type PortAllocator struct {
// contains filtered or unexported fields
}
PortAllocator manages the dynamic port allocation strategy. Only use exposed methods to ensure appropriate locking is taken. The PortAllocator does not currently support mixing static portAllocations (or any pods with defined HostPort) within the dynamic port range other than the ones it coordinates.
func NewPortAllocator ¶
func NewPortAllocator(minPort, maxPort int32, kubeInformerFactory informers.SharedInformerFactory, agonesInformerFactory externalversions.SharedInformerFactory) *PortAllocator
NewPortAllocator returns a new dynamic port allocator. minPort and maxPort are the top and bottom portAllocations that can be allocated in the range for the game servers
func (*PortAllocator) Allocate ¶
func (pa *PortAllocator) Allocate(gs *v1alpha1.GameServer) *v1alpha1.GameServer
Allocate assigns a port to the GameServer and returns it. Return ErrPortNotFound if no port is allocatable
func (*PortAllocator) DeAllocate ¶
func (pa *PortAllocator) DeAllocate(gs *v1alpha1.GameServer)
DeAllocate marks the given port as no longer allocated
func (*PortAllocator) Run ¶
func (pa *PortAllocator) Run(stop <-chan struct{}) error
Run sets up the current state of port allocations and starts tracking Pod and Node changes
type SDKServer ¶
type SDKServer struct {
// contains filtered or unexported fields
}
SDKServer is a gRPC server, that is meant to be a sidecar for a GameServer that will update the game server status on SDK requests
func NewSDKServer ¶
func NewSDKServer(gameServerName, namespace string, kubeClient kubernetes.Interface, agonesClient versioned.Interface) (*SDKServer, error)
NewSDKServer creates a SDKServer that sets up an InClusterConfig for Kubernetes
func (*SDKServer) GetGameServer ¶ added in v0.3.0
GetGameServer returns the current GameServer configuration and state from the backing GameServer CRD
func (*SDKServer) Health ¶
func (s *SDKServer) Health(stream sdk.SDK_HealthServer) error
Health receives each health ping, and tracks the last time the health check was received, to track if a GameServer is healthy
func (*SDKServer) Ready ¶
Ready enters the RequestReady state change for this GameServer into the workqueue so it can be updated
func (*SDKServer) SetAnnotation ¶ added in v0.4.0
SetAnnotation adds the Key/Value to be used to set the annotations with the metadataPrefix to the `GameServer` metdata
func (*SDKServer) SetLabel ¶ added in v0.4.0
SetLabel adds the Key/Value to be used to set the label with the metadataPrefix to the `GameServer` metdata
func (*SDKServer) Shutdown ¶
Shutdown enters the Shutdown state change for this GameServer into the workqueue so it can be updated
func (*SDKServer) WatchGameServer ¶ added in v0.4.0
WatchGameServer sends events through the stream when changes occur to the backing GameServer configuration / status