🩺 Add Healthcheck

This commit is contained in:
Andreas Dinauer 2026-01-06 11:28:00 +01:00
parent 63b8d65166
commit 64e0e59a9d
7 changed files with 84 additions and 17 deletions

View File

@ -15,16 +15,3 @@ services:
POSTGRES_PASSWORD: postgres
ports:
- "6667:5432"
big-bucket:
image: big-bucket-test
ports:
- "8090:8080"
environment:
BIG_BUCKET_CLIENT_KUBOOBOO_RW: password
BIG_BUCKET_UNITS: RAW,HOURLY,DAILY
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: db-big-bucket
DB_PORT: 5432
DB_DATABASE: postgres
DB_SCHEMA: public

10
pom.xml
View File

@ -47,6 +47,11 @@
<artifactId>kubernetes-client</artifactId>
<version>7.3.1</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-httpclient-vertx</artifactId>
<version>7.3.1</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security</artifactId>
@ -61,9 +66,8 @@
<artifactId>quarkus-smallrye-jwt-build</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-httpclient-vertx</artifactId>
<version>7.3.1</version>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>

View File

@ -0,0 +1,5 @@
package dev.dinauer.inspect.cr.argocd;
public class ArgoCdApplicationResource
{
}

View File

@ -0,0 +1,42 @@
package dev.dinauer.inspect.cr.cnpg.cluster;
import dev.dinauer.inspect.cr.cnpg.cluster.model.Cluster;
import dev.dinauer.utils.ClientProvider;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import java.util.LinkedList;
import java.util.List;
@Path("/resources/clusters.postgresql.cnpg.io")
public class PostgresClusterResource
{
@Inject
ClientProvider clientProvider;
@GET
@Path("/{namespace}")
public List<Cluster> get(@PathParam("namespace") String namespace)
{
if ("_all".equals(namespace))
{
return clientProvider.getClient().resources(Cluster.class).inAnyNamespace().list().getItems();
}
return findByNamespace(namespace);
}
private List<Cluster> findByNamespace(String namespace)
{
List<Cluster> result = new LinkedList<>();
for (Cluster cluster : clientProvider.getClient().resources(Cluster.class).inAnyNamespace().list().getItems())
{
if (cluster.getMetadata().getNamespace().equals(namespace))
{
result.add(cluster);
}
}
return result;
}
}

View File

@ -0,0 +1,13 @@
package dev.dinauer.inspect.cr.cnpg.cluster.model;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Kind;
import io.fabric8.kubernetes.model.annotation.Version;
@Group("postgresql.cnpg.io")
@Kind("Cluster")
@Version("v1")
public class Cluster extends CustomResource<Spec, Status>
{
}

View File

@ -0,0 +1,8 @@
package dev.dinauer.inspect.cr.cnpg.cluster.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public record Spec(Integer instances)
{
}

View File

@ -0,0 +1,8 @@
package dev.dinauer.inspect.cr.cnpg.cluster.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public record Status(String phase)
{
}