From 266ec51e54493c7b42a8619c5ebf89fdbfa2ae2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tom=C3=A0s?= Date: Thu, 18 Jan 2018 14:45:46 +0100 Subject: [PATCH] updates to ocelot --- k8s/gen-k8s-env-aks.ps1 | 5 ++--- k8s/ingress.yaml | 8 ++++++-- src/Apigw/OcelotApiGw/Startup.cs | 6 ++++-- src/Apigw/OcelotApiGw/appsettings.json | 10 ++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/Apigw/OcelotApiGw/appsettings.json diff --git a/k8s/gen-k8s-env-aks.ps1 b/k8s/gen-k8s-env-aks.ps1 index 6b8449565..1be5cd2c3 100644 --- a/k8s/gen-k8s-env-aks.ps1 +++ b/k8s/gen-k8s-env-aks.ps1 @@ -3,9 +3,8 @@ [parameter(Mandatory=$true)][string]$location, [parameter(Mandatory=$false)][string]$registryName, [parameter(Mandatory=$true)][string]$serviceName, - [parameter(Mandatory=$true)][string]$dnsName, [parameter(Mandatory=$true)][string]$createAcr=$true, - [parameter(Mandatory=$false)][int]$nodeCount=2, + [parameter(Mandatory=$false)][int]$nodeCount=3, [parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2" ) @@ -21,7 +20,7 @@ if ($createAcr -eq $true) { # Create kubernetes orchestrator Write-Host "Creating kubernetes orchestrator..." -ForegroundColor Yellow -az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsName --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize +az aks create --resource-group=$resourceGroupName --name=$serviceName --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize # Retrieve kubernetes cluster configuration and save it under ~/.kube/config az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml index 813a88a36..59012bf26 100644 --- a/k8s/ingress.yaml +++ b/k8s/ingress.yaml @@ -37,7 +37,7 @@ spec: servicePort: 80 - path: /marketing-api backend: - serviceName: marketing + serviceName: ocelot servicePort: 80 - path: /payment-api backend: @@ -51,5 +51,9 @@ spec: backend: serviceName: webspa servicePort: 80 - + - path: /ocelot + backend: + serviceName: ocelot + servicePort: 80 + diff --git a/src/Apigw/OcelotApiGw/Startup.cs b/src/Apigw/OcelotApiGw/Startup.cs index 8e99afaf2..487793eda 100644 --- a/src/Apigw/OcelotApiGw/Startup.cs +++ b/src/Apigw/OcelotApiGw/Startup.cs @@ -29,14 +29,16 @@ namespace OcelotApiGw services.AddOcelot(_cfg); } - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } - app.UseOcelot(); + loggerFactory.AddConsole(_cfg.GetSection("Logging")); + + app.UseOcelot().Wait(); } } } diff --git a/src/Apigw/OcelotApiGw/appsettings.json b/src/Apigw/OcelotApiGw/appsettings.json new file mode 100644 index 000000000..426750e6a --- /dev/null +++ b/src/Apigw/OcelotApiGw/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": true, + "LogLevel": { + "Default": "Trace", + "System": "Information", + "Microsoft": "Information" + } + } +} \ No newline at end of file