static async Task Main(string[] args) { if (args.Length < 6) { throw new Exception("Arguments are missing. Expecting: <private key> <public key> <server CA> <external IP> <namepace> <enable multi-cluster>"); } string clientKey = File.ReadAllText(args[0]); string clientCert = File.ReadAllText(args[1]); string serverCa = File.ReadAllText(args[2]); string externalIp = args[3]; string namespaceArg = args[4]; bool multicluster = bool.Parse(args[5]); var creds = new SslCredentials(serverCa, new KeyCertificatePair(clientCert, clientKey)); var channel = new Channel(externalIp + ":443", creds); var client = new AllocationService.AllocationServiceClient(channel); try { var response = await client.AllocateAsync(new AllocationRequest { Namespace = namespaceArg, MultiClusterSetting = new V1Alpha1.MultiClusterSetting { Enabled = multicluster, } }); Console.WriteLine(response); } catch (RpcException e) { Console.WriteLine($"gRPC error: {e}"); } }
private static async Task <AllocationResponse> AllocateGameServerAsync(AgonesAllocatorInfo agonesAllocatorInfo) { var creds = new SslCredentials(agonesAllocatorInfo.RawTlsCert(), new KeyCertificatePair(agonesAllocatorInfo.RawClientCert(), agonesAllocatorInfo.RawClientKey())); var channel = new Channel($"{agonesAllocatorInfo.Ip}:443", creds); var client = new AllocationService.AllocationServiceClient(channel); var allocationResponse = await client.AllocateAsync(new AllocationRequest { Namespace = "default", MultiClusterSetting = new Allocation.MultiClusterSetting { Enabled = false } }); return(allocationResponse); }