Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to extend ready check #15

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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