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

This commit is contained in:
Eduard Tomàs 2018-01-22 11:46:18 +01:00
parent 85e83e6389
commit 9371eb1077
12 changed files with 67 additions and 19 deletions

View File

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

View File

@ -189,6 +189,11 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
app.UsePathBase(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(); app.UseStaticFiles();
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");

View File

@ -191,6 +191,10 @@
app.UsePathBase(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"); app.UseCors("CorsPolicy");
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();

View File

@ -138,6 +138,11 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
app.UsePathBase(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(); app.UseStaticFiles();

View File

@ -162,6 +162,10 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
app.UsePathBase(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"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);

View File

@ -194,6 +194,10 @@
app.UsePathBase(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"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);

View File

@ -213,6 +213,10 @@
app.UsePathBase(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"); app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);

View File

@ -113,6 +113,9 @@ namespace Ordering.BackgroundTasks
public void Configure(IApplicationBuilder app, IHostingEnvironment env) 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
} }

View File

@ -103,6 +103,10 @@ namespace Payment.API
app.UsePathBase(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
ConfigureEventBus(app); ConfigureEventBus(app);
} }

View File

@ -160,6 +160,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UsePathBase(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.UseSession(); app.UseSession();
app.UseStaticFiles(); app.UseStaticFiles();

View File

@ -112,6 +112,11 @@ namespace eShopConContainers.WebSPA
app.UsePathBase(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) => app.Use(async (context, next) =>
{ {
await next(); await next();

View File

@ -74,6 +74,11 @@ namespace WebStatus
app.UsePathBase(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(); app.UseStaticFiles();
app.UseMvc(routes => app.UseMvc(routes =>