Skip to content

Commit

Permalink
Add possibility to extend ready check (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Leshchev <[email protected]>
  • Loading branch information
aleshchev and Artem Leshchev authored Jun 3, 2024
1 parent 806477a commit 22b8635
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/Bss.Platform.Kubernetes/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ public static IApplicationBuilder UsePlatformKubernetesHealthChecks(this IApplic
app
.UseHealthChecks("/health/live", new HealthCheckOptions { Predicate = _ => false })
.UseHealthChecks("/health/ready", new HealthCheckOptions { Predicate = x => x.Name == SqlHealthCheck });

public static IHealthChecksBuilder AddPlatformKubernetesHealthChecks(
this IServiceCollection services,
string connectionString,
string sqlCheckName) =>
services
.AddHealthChecks()
.AddSqlServer(connectionString, name: sqlCheckName);

public static IApplicationBuilder UsePlatformKubernetesHealthChecks(this IApplicationBuilder app, params string[] readyCheckNames) =>
app
.UseHealthChecks("/health/live", new HealthCheckOptions { Predicate = _ => false })
.UseHealthChecks("/health/ready", new HealthCheckOptions { Predicate = x => readyCheckNames.Contains(x.Name) });
}
2 changes: 1 addition & 1 deletion src/Bss.Platform.Logging/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Bss.Platform.Logging;

public static class DependencyInjection
{
public static void AddPlatformLogging(this IHostBuilder builder) =>
public static IHostBuilder AddPlatformLogging(this IHostBuilder builder) =>
builder
.UseSerilog(
(context, services, configuration) =>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageVersion Include="Microsoft.ApplicationInsights.Kubernetes" Version="6.1.2" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
Expand Down
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2024")]

[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyInformationalVersion("1.5.1.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit 22b8635

Please sign in to comment.