Skip to content

Commit

Permalink
Revert "use '-' for empty list for both variables"
Browse files Browse the repository at this point in the history
This reverts commit 9d47322.
  • Loading branch information
andrewazores committed Feb 6, 2024
1 parent deea525 commit 0b93d62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@

class KubeApiPlatformStrategy implements PlatformDetectionStrategy<KubeApiPlatformClient> {

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<? extends AuthManager> authMgr;
Expand Down Expand Up @@ -70,13 +71,13 @@ public KubeApiPlatformClient getPlatformClient() {
List<String> 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<Integer> 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);
Expand Down

0 comments on commit 0b93d62

Please sign in to comment.