Skip to content

Commit

Permalink
feat: allow disabling KubernetesHealthIndicator using endpoints.healt…
Browse files Browse the repository at this point in the history
…h.kubernetes.enabled: false (#755)
  • Loading branch information
felhag committed Sep 12, 2024
1 parent b031575 commit df7d87e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.kubernetes.client.openapi.models.V1PodStatus;
import io.micronaut.context.annotation.Requires;
import io.micronaut.context.env.Environment;
import io.micronaut.core.util.StringUtils;
import io.micronaut.health.HealthStatus;
import io.micronaut.kubernetes.KubernetesConfiguration;
import io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient;
Expand Down Expand Up @@ -50,6 +51,7 @@
@Requires(beans = HealthEndpoint.class)
@Requires(env = Environment.KUBERNETES)
@Requires(property = HOSTNAME_ENV_VARIABLE_IN_PROPERTY_FORMAT)
@Requires(property = HealthEndpoint.PREFIX + ".kubernetes.enabled", notEquals = StringUtils.FALSE)
public class KubernetesHealthIndicator extends AbstractHealthIndicator<Map<String, Object>> {

public static final String NAME = "kubernetes";
Expand Down
10 changes: 10 additions & 0 deletions src/main/docs/guide/health-checks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ Also note that in order to see the full details of the health checks you may nee
https://docs.micronaut.io/latest/guide/index.html#healthEndpoint[the documentation of the Health Endpoint] for more
information about how to configure it.
====

By default the KubernetesHealthIndicator is enabled. To disable it use the following configuration:

[source,yaml]
----
endpoints:
health:
kubernetes:
enabled: false
----

0 comments on commit df7d87e

Please sign in to comment.