diff --git a/smoketest.sh b/smoketest.sh index 472d2e8b94..385465e0c7 100755 --- a/smoketest.sh +++ b/smoketest.sh @@ -125,7 +125,7 @@ runDemoApps() { --label io.cryostat.discovery="true" \ --label io.cryostat.jmxHost="localhost" \ --label io.cryostat.jmxPort="9093" \ - --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.2 + --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.4 podman run \ --name vertx-fib-demo-2 \ @@ -146,7 +146,7 @@ runDemoApps() { --label io.cryostat.jmxHost="localhost" \ --label io.cryostat.jmxPort="9094" \ --label io.cryostat.jmxUrl="service:jmx:rmi:///jndi/rmi://localhost:9094/jmxrmi" \ - --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.2 + --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.4 podman run \ --name vertx-fib-demo-3 \ @@ -166,7 +166,7 @@ runDemoApps() { --pod cryostat-pod \ --label io.cryostat.discovery="true" \ --label io.cryostat.jmxUrl="service:jmx:rmi:///jndi/rmi://localhost:9095/jmxrmi" \ - --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.2 + --rm -d quay.io/andrewazores/vertx-fib-demo:0.12.4 # this config is broken on purpose (missing required env vars) to test the agent's behaviour # when not properly set up diff --git a/src/main/java/io/cryostat/net/web/http/api/v2/DiscoveryRegistrationHandler.java b/src/main/java/io/cryostat/net/web/http/api/v2/DiscoveryRegistrationHandler.java index e932e69bf4..be261b3676 100644 --- a/src/main/java/io/cryostat/net/web/http/api/v2/DiscoveryRegistrationHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/v2/DiscoveryRegistrationHandler.java @@ -97,7 +97,7 @@ class DiscoveryRegistrationHandler extends AbstractV2RequestHandler webServer, @Named(PlatformModule.SELECTED_PLATFORMS) - Set> selectedStrategies, + Set> selectedStrategies, DiscoveryJwtHelper jwt, @Named(MainModule.UUID_FROM_STRING) Function uuidFromString, Gson gson, @@ -205,6 +205,10 @@ public IntermediateResponse> handle(RequestParameters params address, AbstractDiscoveryJwtConsumingHandler.getResourceUri(hostUrl, pluginId)); Map mergedEnv = new HashMap<>(); + // FIXME currently only the OpenShiftPlatformStrategy provides any entries for the env map, + // but in the future if any more strategies also provide entries then the order here may be + // undefined and the map entries may collide and be overwritten. There should be some + // prefixing scheme to prevent collisions. selectedStrategies.forEach(s -> mergedEnv.putAll(s.environment())); return new IntermediateResponse>() .statusCode(201) diff --git a/src/main/java/io/cryostat/platform/internal/OpenShiftPlatformStrategy.java b/src/main/java/io/cryostat/platform/internal/OpenShiftPlatformStrategy.java index 403d6e4f24..c23580b0dd 100644 --- a/src/main/java/io/cryostat/platform/internal/OpenShiftPlatformStrategy.java +++ b/src/main/java/io/cryostat/platform/internal/OpenShiftPlatformStrategy.java @@ -37,17 +37,17 @@ */ package io.cryostat.platform.internal; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + import io.cryostat.core.log.Logger; import io.cryostat.core.net.JFRConnectionToolkit; import io.cryostat.core.sys.Environment; import io.cryostat.core.sys.FileSystem; import io.cryostat.net.AuthManager; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; - import dagger.Lazy; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.openshift.client.OpenShiftClient; diff --git a/src/main/java/io/cryostat/platform/internal/PodmanPlatformStrategy.java b/src/main/java/io/cryostat/platform/internal/PodmanPlatformStrategy.java index dd529ba2d1..5232665288 100644 --- a/src/main/java/io/cryostat/platform/internal/PodmanPlatformStrategy.java +++ b/src/main/java/io/cryostat/platform/internal/PodmanPlatformStrategy.java @@ -38,6 +38,8 @@ package io.cryostat.platform.internal; import java.net.URI; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; @@ -161,6 +163,12 @@ public AuthManager getAuthManager() { return authMgr.get(); } + // FIXME remove this, just for testing purposes + @Override + public Map environment() { + return Map.of("TEST", UUID.randomUUID().toString()); + } + private static String getSocketPath() { long uid = new UnixSystem().getUid(); String socketPath = String.format("/run/user/%d/podman/podman.sock", uid);