Skip to content

Commit 9371eb1

Browse files
committed
Add a endpoint returning only a 200 to be used as a liveness probe for k8s
1 parent 85e83e6 commit 9371eb1

12 files changed

Lines changed: 67 additions & 19 deletions

File tree

k8s/deployments.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
periodSeconds: 60
6161
livenessProbe:
6262
httpGet:
63-
path: /hc
63+
path: /liveness
6464
port: 80
6565
scheme: HTTP
6666
initialDelaySeconds: 120
@@ -125,7 +125,7 @@ spec:
125125
periodSeconds: 60
126126
livenessProbe:
127127
httpGet:
128-
path: /hc
128+
path: /liveness
129129
port: 80
130130
scheme: HTTP
131131
initialDelaySeconds: 120
@@ -212,7 +212,7 @@ spec:
212212
periodSeconds: 60
213213
livenessProbe:
214214
httpGet:
215-
path: /hc
215+
path: /liveness
216216
port: 80
217217
scheme: HTTP
218218
initialDelaySeconds: 120
@@ -282,7 +282,7 @@ spec:
282282
periodSeconds: 60
283283
livenessProbe:
284284
httpGet:
285-
path: /hc
285+
path: /liveness
286286
port: 80
287287
scheme: HTTP
288288
initialDelaySeconds: 120
@@ -357,7 +357,7 @@ spec:
357357
periodSeconds: 60
358358
livenessProbe:
359359
httpGet:
360-
path: /hc
360+
path: /liveness
361361
port: 80
362362
scheme: HTTP
363363
initialDelaySeconds: 120
@@ -437,7 +437,7 @@ spec:
437437
periodSeconds: 60
438438
livenessProbe:
439439
httpGet:
440-
path: /hc
440+
path: /liveness
441441
port: 80
442442
scheme: HTTP
443443
initialDelaySeconds: 120
@@ -527,7 +527,7 @@ spec:
527527
periodSeconds: 60
528528
livenessProbe:
529529
httpGet:
530-
path: /hc
530+
path: /liveness
531531
port: 80
532532
scheme: HTTP
533533
initialDelaySeconds: 120
@@ -582,7 +582,7 @@ spec:
582582
periodSeconds: 60
583583
livenessProbe:
584584
httpGet:
585-
path: /hc
585+
path: /liveness
586586
port: 80
587587
scheme: HTTP
588588
initialDelaySeconds: 120
@@ -704,7 +704,7 @@ spec:
704704
periodSeconds: 60
705705
livenessProbe:
706706
httpGet:
707-
path: /hc
707+
path: /liveness
708708
port: 80
709709
scheme: HTTP
710710
initialDelaySeconds: 120
@@ -897,7 +897,7 @@ spec:
897897
periodSeconds: 60
898898
livenessProbe:
899899
httpGet:
900-
path: /hc
900+
path: /liveness
901901
port: 80
902902
scheme: HTTP
903903
initialDelaySeconds: 120

src/Services/Basket/Basket.API/Startup.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
188188
{
189189
app.UsePathBase(pathBase);
190190
}
191-
191+
192+
193+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
194+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
195+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
196+
192197
app.UseStaticFiles();
193198
app.UseCors("CorsPolicy");
194199

src/Services/Catalog/Catalog.API/Startup.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
191191
app.UsePathBase(pathBase);
192192
}
193193

194+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
195+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
196+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
197+
194198
app.UseCors("CorsPolicy");
195199

196200
app.UseMvcWithDefaultRoute();

src/Services/Identity/Identity.API/Startup.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
136136
{
137137
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
138138
app.UsePathBase(pathBase);
139-
}
139+
}
140+
141+
142+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
143+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
144+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
140145

141146
app.UseStaticFiles();
142147

src/Services/Location/Locations.API/Startup.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
162162
app.UsePathBase(pathBase);
163163
}
164164

165+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
166+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
167+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
168+
165169
app.UseCors("CorsPolicy");
166170

167171
ConfigureAuth(app);

src/Services/Marketing/Marketing.API/Startup.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFa
192192
if (!string.IsNullOrEmpty(pathBase))
193193
{
194194
app.UsePathBase(pathBase);
195-
}
196-
195+
}
196+
197+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
198+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
199+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
200+
197201
app.UseCors("CorsPolicy");
198202

199203
ConfigureAuth(app);

src/Services/Ordering/Ordering.API/Startup.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
211211
{
212212
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
213213
app.UsePathBase(pathBase);
214-
}
215-
214+
}
215+
216+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
217+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
218+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
219+
216220
app.UseCors("CorsPolicy");
217221

218222
ConfigureAuth(app);

src/Services/Ordering/Ordering.BackgroundTasks/Startup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
112112
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
113113
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
114114
{
115-
115+
116+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
117+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
118+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
116119
}
117120

118121

src/Services/Payment/Payment.API/Startup.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
103103
app.UsePathBase(pathBase);
104104
}
105105

106+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
107+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
108+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
109+
106110
ConfigureEventBus(app);
107111
}
108112

src/Web/WebMVC/Startup.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
160160
app.UsePathBase(pathBase);
161161
}
162162

163+
164+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
165+
app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200));
166+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
167+
163168
app.UseSession();
164169
app.UseStaticFiles();
165170

0 commit comments

Comments
 (0)