🚀 Ready

This commit is contained in:
andreas.dinauer 2025-11-16 18:24:19 +01:00
parent a740467f76
commit 5b71f9b7ab
5 changed files with 33 additions and 24 deletions

View File

@ -5,7 +5,7 @@ meta {
} }
post { post {
url: http://localhost:8080/api/metrics/POD-2/WORKLOAD url: http://localhost:4000/api/metrics/POD-2/WORKLOAD
body: json body: json
auth: basic auth: basic
} }
@ -15,17 +15,17 @@ headers {
} }
auth:basic { auth:basic {
username: michaeltheduck username: test
password: blabla password: test
} }
body:json { body:json {
{ {
"owner": "kubooboo", "owner": "kubooboo",
"values": { "values": {
"RELATIVE_CPU": "20", "x": "20",
"RELATIVE_MEMORY": "23", "y": "23",
"RELATIVE_DISK_USAGE": "56" "z": "56"
} }
} }
} }

View File

@ -76,6 +76,14 @@
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt</artifactId> <artifactId>quarkus-smallrye-jwt</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -2,11 +2,7 @@ package dev.dinauer.metrics.service.client.auth;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.jwt.JsonWebToken; import org.eclipse.microprofile.jwt.JsonWebToken;
import org.jboss.resteasy.reactive.common.NotImplementedYet; import org.jboss.resteasy.reactive.common.NotImplementedYet;
@ -22,15 +18,8 @@ public class BearerAuthClientProvider
@Inject @Inject
JWTParser parser; JWTParser parser;
@ConfigProperty(name = "big.bucket.auth.client-only")
Boolean clientOnly;
public Client get(String credentials) public Client get(String credentials)
{ {
if (clientOnly)
{
throw new WebApplicationException(Response.status(403).type(MediaType.TEXT_PLAIN).entity("endusers_disabled").build());
}
try try
{ {
JsonWebToken token = parser.parse(credentials); JsonWebToken token = parser.parse(credentials);

View File

@ -7,22 +7,20 @@ quarkus.http.root-path=/api/metrics
big.bucket.units=RAW,HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY,TOTAL big.bucket.units=RAW,HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY,TOTAL
dev.dinauer.metrics-service.client.kubooboo.ro=3749832748923748923
dev.dinauer.metrics-service.jwt.client.field=upn
quarkus.smallrye-jwt.enabled=false quarkus.smallrye-jwt.enabled=false
%dev.big.bucket.auth.client-only=false
# Postgres # Postgres
quarkus.datasource.db-kind = postgresql quarkus.datasource.db-kind = postgresql
%dev.quarkus.datasource.username = postgres %dev.quarkus.datasource.username = postgres
%dev.quarkus.datasource.password = postgres %dev.quarkus.datasource.password = postgres
%dev.quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:8888/postgres %dev.quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:8888/postgres
%dev,test.quarkus.hibernate-orm.schema-management.strategy=drop-and-create
# Prod # Prod
%prod.quarkus.datasource.username=${DB_USER} %prod.quarkus.datasource.username=${DB_USER}
%prod.quarkus.datasource.password=${DB_PASSWORD} %prod.quarkus.datasource.password=${DB_PASSWORD}
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}?currentSchema=${DB_SCHEMA} %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}?currentSchema=${DB_SCHEMA}
%prod.quarkus.hibernate-orm.schema-management.strategy=drop-and-create
quarkus.banner.path=banner.txt quarkus.banner.path=banner.txt
# Flyway
%test,dev.quarkus.flyway.clean-at-start=true
quarkus.flyway.migrate-at-start=true

View File

@ -0,0 +1,14 @@
CREATE TABLE public.bucket (
created_at timestamptz(6) NULL,
unix_timestamp int8 NOT NULL,
updated_at timestamptz(6) NULL,
bucket_name varchar(255) NOT NULL,
bucket_unit varchar(255) NOT NULL,
id varchar(255) NOT NULL,
metrics text NOT NULL,
"owner" varchar(255) NULL,
resource varchar(255) NOT NULL,
"timestamp" varchar(255) NOT NULL,
CONSTRAINT bucket_bucket_unit_check CHECK (((bucket_unit)::text = ANY ((ARRAY['RAW'::character varying, 'HOURLY'::character varying, 'DAILY'::character varying, 'WEEKLY'::character varying, 'MONTHLY'::character varying, 'YEARLY'::character varying, 'TOTAL'::character varying])::text[]))),
CONSTRAINT bucket_pkey PRIMARY KEY (id)
);