Browse Source

Add a endpoint returning only a 200 to be used as a liveness probe for k8s

pull/491/head
Eduard Tomàs 7 years ago
parent
commit
9371eb1077
12 changed files with 67 additions and 19 deletions
  1. +10
    -10
      k8s/deployments.yaml
  2. +6
    -1
      src/Services/Basket/Basket.API/Startup.cs
  3. +4
    -0
      src/Services/Catalog/Catalog.API/Startup.cs
  4. +6
    -1
      src/Services/Identity/Identity.API/Startup.cs
  5. +4
    -0
      src/Services/Location/Locations.API/Startup.cs
  6. +6
    -2
      src/Services/Marketing/Marketing.API/Startup.cs
  7. +6
    -2
      src/Services/Ordering/Ordering.API/Startup.cs
  8. +4
    -1
      src/Services/Ordering/Ordering.BackgroundTasks/Startup.cs
  9. +4
    -0
      src/Services/Payment/Payment.API/Startup.cs
  10. +5
    -0
      src/Web/WebMVC/Startup.cs
  11. +6
    -1
      src/Web/WebSPA/Startup.cs
  12. +6
    -1
      src/Web/WebStatus/Startup.cs

+ 10
- 10
k8s/deployments.yaml View File

@ -60,7 +60,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -125,7 +125,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -212,7 +212,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -282,7 +282,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -357,7 +357,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -437,7 +437,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -527,7 +527,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -582,7 +582,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -704,7 +704,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
@ -897,7 +897,7 @@ spec:
periodSeconds: 60
livenessProbe:
httpGet:
path: /hc
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120


+ 6
- 1
src/Services/Basket/Basket.API/Startup.cs View File

@ -188,7 +188,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
app.UsePathBase(pathBase);
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseStaticFiles();
app.UseCors("CorsPolicy");


+ 4
- 0
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -191,6 +191,10 @@
app.UsePathBase(pathBase);
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseCors("CorsPolicy");
app.UseMvcWithDefaultRoute();


+ 6
- 1
src/Services/Identity/Identity.API/Startup.cs View File

@ -136,7 +136,12 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseStaticFiles();


+ 4
- 0
src/Services/Location/Locations.API/Startup.cs View File

@ -162,6 +162,10 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
app.UsePathBase(pathBase);
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseCors("CorsPolicy");
ConfigureAuth(app);


+ 6
- 2
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -192,8 +192,12 @@
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseCors("CorsPolicy");
ConfigureAuth(app);


+ 6
- 2
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -211,8 +211,12 @@
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseCors("CorsPolicy");
ConfigureAuth(app);


+ 4
- 1
src/Services/Ordering/Ordering.BackgroundTasks/Startup.cs View File

@ -112,7 +112,10 @@ namespace Ordering.BackgroundTasks
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
}


+ 4
- 0
src/Services/Payment/Payment.API/Startup.cs View File

@ -103,6 +103,10 @@ namespace Payment.API
app.UsePathBase(pathBase);
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
ConfigureEventBus(app);
}


+ 5
- 0
src/Web/WebMVC/Startup.cs View File

@ -160,6 +160,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UsePathBase(pathBase);
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseSession();
app.UseStaticFiles();


+ 6
- 1
src/Web/WebSPA/Startup.cs View File

@ -110,7 +110,12 @@ namespace eShopConContainers.WebSPA
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.Use(async (context, next) =>
{


+ 6
- 1
src/Web/WebStatus/Startup.cs View File

@ -72,7 +72,12 @@ namespace WebStatus
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
app.UseStaticFiles();


Loading…
Cancel
Save