Documentation
¶
Index ¶
- Variables
- func CreateAgones() (aiface.IAgones, error)
- func CreateMock() (aiface.IAgones, error)
- func NewAllocateClient(sSetting AgonesSettingsParams) (allocation.AllocationServiceClient, error)
- func NewAllocateClientMock(url []string) (allocation.AllocationServiceClient, error)
- type AgonesSettingsParams
- type AgonesSettingsResult
- type AllocateParams
- type AllocateResult
- type SDKParams
- type SDKResult
Constants ¶
This section is empty.
Variables ¶
var AgonesSDKModule = fx.Provide( func( l *zap.Logger, aSetting AgonesSettingsParams, ) (out SDKResult, err error) { if deploy := utility.ParseDeployments(aSetting.AgonesDeployment); deploy.IsProd() { a, err := CreateAgones() if err != nil { return out, err } out.SDK = a } else { a, err := CreateMock() if err != nil { return out, err } out.SDK = a } return }, )
AgonesSDKModule is a fx module that provides an Agones sdk(deployment==prod)/mock Agones sdk(deployment!=prod)
var AllocateClientModule = fx.Provide( func( sSetting AgonesSettingsParams, ) (out AllocateResult, err error) { if utility.ParseDeployments(sSetting.AgonesDeployment).IsProd() { if cli, e := NewAllocateClient(sSetting); e != nil { err = e } else { out.AllocateClient = cli } } else { if cli, e := NewAllocateClientMock(sSetting.MockAllocateUrl); err != nil { err = e } else { out.AllocateClient = cli } } return }, )
AllocateClientModule is a fx module that provides an AllocateClient
var SettingsModule = fx.Provide( func() (out AgonesSettingsResult, err error) { return CreateAgonesSettingsModule() }, )
SettingsModule is a fx module that provides an AgonesSettingsModule
Functions ¶
func CreateAgones ¶
CreateAgones deploy local agones sdk server
func CreateMock ¶
CreateMock create an empty agones sdk,it will not do anything This is used for local/debugging
func NewAllocateClient ¶
func NewAllocateClient(sSetting AgonesSettingsParams) (allocation.AllocationServiceClient, error)
NewAllocateClient creates a new AllocateClient, requires a host and security settings. Agones need security settings(mTls) to connect to the allocator server. https://agones.dev/site/docs/advanced/allocator-service/#client-certificate
func NewAllocateClientMock ¶
func NewAllocateClientMock(url []string) (allocation.AllocationServiceClient, error)
NewAllocateClientMock creates a new AllocateClientMock, requires a mock hosts to random.
Types ¶
type AgonesSettingsParams ¶
type AgonesSettingsParams struct {
fx.In
// agones deployment (local/dev/prod)
AgonesDeployment string `name:"AgonesDeployment"`
// mock allocate url(only for non-prod deployment)
MockAllocateUrl []string `name:"MockAllocateUrl"`
// allocate service url(only for prod deployment)
AllocateServiceUrl string `name:"AllocateServiceUrl"`
ClientCert string `name:"AllocateClientCert"`
ClientKey string `name:"AllocateClientKey"`
ServerCaCert string `name:"AllocateServerCaCert"`
}
type AgonesSettingsResult ¶
type AgonesSettingsResult struct {
fx.Out
// agones deployment (local/dev/prod)
AgonesDeployment string `name:"AgonesDeployment" envconfig:"AGONES_DEPLOYMENT" default:"local"`
// mock allocate url(only for non-prod deployment)
MockAllocateUrl []string `name:"MockAllocateUrl" envconfig:"MOCK_ALLOCATE_URL" default:"localhost:8888"`
// allocate service url(only for prod deployment)
AllocateServiceUrl string `name:"AllocateServiceUrl" envconfig:"ALLOCATE_SERVICE_URL" default:""`
ClientCert string `name:"AllocateClientCert" envconfig:"ALLOCATE_CLIENT_CERT" default:"./configs/agones/tls.crt"`
ClientKey string `name:"AllocateClientKey" envconfig:"ALLOCATE_CLIENT_KEY" default:"./configs/agones/tls.key"`
ServerCaCert string `name:"AllocateServerCaCert" envconfig:"ALLOCATE_SERVER_CA_CERT" default:"./configs/agones/ca.crt"`
}
func CreateAgonesSettingsModule ¶
func CreateAgonesSettingsModule() (AgonesSettingsResult, error)
CreateAgonesSettingsModule creates an AgonesSettingsModule
type AllocateParams ¶
type AllocateParams struct {
fx.In
AllocateClient allocation.AllocationServiceClient `name:"AllocateClient"`
}
type AllocateResult ¶
type AllocateResult struct {
fx.Out
AllocateClient allocation.AllocationServiceClient `name:"AllocateClient"`
}