diff --git a/README.md b/README.md index af9fde7bf0..dfcf8565c6 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,8 @@ using the environment variables `CRYOSTAT_DISCOVERY_K8S_PORT_NAMES` and `CRYOSTAT_DISCOVERY_K8S_PORT_NUMBERS` respectively. Both of these accept comma-separated lists as values. Any observed `Endpoints` object with a name in the given list or a number in the given list will be taken as a connectable -target application. To set either of the lists empty use the value `-`. +target application. To set the names list to the empty list use `-`. To set the +numbers list to the empty list use `0`. The second discovery mechanism is JDP (Java Discovery Protocol). This relies on target JVMs being configured with the JVM flags to enable JDP and requires the diff --git a/src/main/java/io/cryostat/platform/internal/KubeApiPlatformStrategy.java b/src/main/java/io/cryostat/platform/internal/KubeApiPlatformStrategy.java index 0cb09c182a..2f51971e51 100644 --- a/src/main/java/io/cryostat/platform/internal/KubeApiPlatformStrategy.java +++ b/src/main/java/io/cryostat/platform/internal/KubeApiPlatformStrategy.java @@ -38,7 +38,8 @@ class KubeApiPlatformStrategy implements PlatformDetectionStrategy { - public static final String PORT_NAME_NUMBER_NONE = "-"; + public static final String NO_PORT_NAME = "-"; + public static final Integer NO_PORT_NUMBER = 0; protected final Logger logger; protected final Lazy authMgr; @@ -70,13 +71,13 @@ public KubeApiPlatformClient getPlatformClient() { List portNames = Arrays.asList(env.getEnv(Variables.K8S_PORT_NAMES, "jfr-jmx").split(",")).stream() .map(String::strip) - .filter(n -> !PORT_NAME_NUMBER_NONE.equals(n)) + .filter(n -> !NO_PORT_NAME.equals(n)) .toList(); List portNumbers = Arrays.asList(env.getEnv(Variables.K8S_PORT_NUMBERS, "9091").split(",")).stream() .map(String::strip) - .filter(n -> !PORT_NAME_NUMBER_NONE.equals(n)) .map(Integer::parseInt) + .filter(n -> !NO_PORT_NUMBER.equals(n)) .toList(); return new KubeApiPlatformClient( getNamespaces(), portNames, portNumbers, createClient(), logger);