-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(discovery): fix broken DISABLE_BUILTIN_DISCOVERY env var #1506
fix(discovery): fix broken DISABLE_BUILTIN_DISCOVERY env var #1506
Conversation
now that multiple platforms can be used in parallel, they do not need to have a priority for checking availability
{
"data": {
"result": {
"children": [
{
"children": [
{
"id": -432439206,
"labels": {},
"name": "http://localhost:8910/",
"nodeType": "JVM",
"target": {
"alias": "vertx-fib-demo-1",
"annotations": {
"cryostat": {
"HOST": "cryostat",
"JAVA_MAIN": "es.andrewazor.demo.Main -javaagent:/opt/jib-agents/cryostat-agent-0.2.2.jar",
"PID": "1",
"PORT": "8910",
"REALM": "vertx-fib-demo-1",
"START_TIME": "1685480129"
},
"platform": {}
},
"connectUrl": "http://localhost:8910/",
"jvmId": "OzsZcRCrIZo00q0VvVX_j_7XwBHQfzqw5MNmMiXSolc=",
"labels": {}
}
}
],
"id": 622503342,
"labels": {
"REALM": "db441505-c3be-44b0-8be5-63c416ae9323"
},
"name": "vertx-fib-demo-1",
"nodeType": "Realm"
},
{
"children": [
{
"id": -2088431488,
"labels": {},
"name": "http://localhost:8911/",
"nodeType": "JVM",
"target": {
"alias": "vertx-fib-demo-2",
"annotations": {
"cryostat": {
"HOST": "cryostat",
"JAVA_MAIN": "es.andrewazor.demo.Main -javaagent:/opt/jib-agents/cryostat-agent-0.2.2.jar",
"PID": "1",
"PORT": "8911",
"REALM": "vertx-fib-demo-2",
"START_TIME": "1685480129"
},
"platform": {}
},
"connectUrl": "http://localhost:8911/",
"jvmId": "M_nb6vAVZWFzpLF140qloFnzhYuOsWc-fS2nMWG0NQ4=",
"labels": {}
}
}
],
"id": 1613802238,
"labels": {
"REALM": "a17a77ad-9ae3-4f14-97ba-b7c32e851e8a"
},
"name": "vertx-fib-demo-2",
"nodeType": "Realm"
},
{
"children": [
{
"id": 813146660,
"labels": {},
"name": "http://localhost:8912/",
"nodeType": "JVM",
"target": {
"alias": "vertx-fib-demo-3",
"annotations": {
"cryostat": {
"HOST": "cryostat",
"JAVA_MAIN": "es.andrewazor.demo.Main -javaagent:/opt/jib-agents/cryostat-agent-0.2.2.jar",
"PID": "1",
"PORT": "8912",
"REALM": "vertx-fib-demo-3",
"START_TIME": "1685480129"
},
"platform": {}
},
"connectUrl": "http://localhost:8912/",
"jvmId": "idNwhKBD4Ow2iNZi3RHeqU_CMFTJrJhJmGQ3drFavTc=",
"labels": {}
}
}
],
"id": 1754892022,
"labels": {
"REALM": "d14a044f-f794-4f2d-84a5-b31a333261e8"
},
"name": "vertx-fib-demo-3",
"nodeType": "Realm"
},
{
"children": [
{
"id": -163233355,
"labels": {},
"name": "service:jmx:rmi:///jndi/rmi://cryostat:9097/jmxrmi",
"nodeType": "JVM",
"target": {
"alias": "quarkus-test-agent",
"annotations": {
"cryostat": {
"HOST": "cryostat",
"JAVA_MAIN": "/deployments/quarkus-run.jar",
"PID": "1",
"PORT": "-1",
"REALM": "quarkus-test-agent",
"START_TIME": "1685480129"
},
"platform": {}
},
"connectUrl": "service:jmx:rmi:///jndi/rmi://cryostat:9097/jmxrmi",
"jvmId": "kDJLGwATFCHKY_sTWZM_9vZ_mmBnNNGMvS_0_54FJB0=",
"labels": {}
}
}
],
"id": 1827072391,
"labels": {
"REALM": "1b8c77ad-6e8f-44ab-8bba-bf4eac1f8372"
},
"name": "quarkus-test-agent",
"nodeType": "Realm"
},
{
"children": [
{
"id": -1576634802,
"labels": {},
"name": "http://localhost:9988/",
"nodeType": "JVM",
"target": {
"alias": "quarkus-test-agent",
"annotations": {
"cryostat": {
"HOST": "cryostat",
"JAVA_MAIN": "/deployments/quarkus-run.jar",
"PID": "1",
"PORT": "9988",
"REALM": "quarkus-test-agent",
"START_TIME": "1685480130"
},
"platform": {}
},
"connectUrl": "http://localhost:9988/",
"jvmId": "do5_f7fTao7uU4V80FYlFt62RuMhiDaSIHmAZ_771Jw=",
"labels": {}
}
}
],
"id": 1487758365,
"labels": {
"REALM": "54a8f2b1-3dbf-448c-bb37-e02cd45fcc58"
},
"name": "quarkus-test-agent",
"nodeType": "Realm"
},
{
"children": [],
"id": -511444528,
"labels": {
"REALM": "add51184-c47d-4d72-8131-41bab315802c"
},
"name": "Custom Targets",
"nodeType": "Realm"
}
],
"id": 1171029256,
"labels": {},
"name": "Universe",
"nodeType": "Universe"
}
},
"meta": {
"status": "OK",
"type": "application/json"
}
} The latest commit does some cleanup which should also fix a conflict between Custom Targets and JDP that existed before. Though, I don't think that should have caused the builtins to still appear for you. |
Hmm weird. I built the image with |
Maybe try |
Ohh totally forgot about that again. Worked fine with h2mem. We don't yet have any handler to prune discovery database right? |
I'll give it some thought. I think what I should do is set it up so that any disabled builtins have their subtrees automatically pruned from the discovery tree, ie drop the whole Realm. There is no ongoing whole-tree pruning that happens, that is expected to be done by each plugin at the Realm level, or by the plugins themselves registering and deregistering (or failing to respond to heartbeat pings). |
Sounds good! Makes sense to me! I guess other things just gonna be intergration test is failing as it expects more targets than actual. |
It looks like I already thought of that mechanism: unselectedStrategies.stream()
.map(PlatformDetectionStrategy::getPlatformClient)
.forEach(
platform ->
storage.getBuiltInPluginByRealm(
platform.getDiscoveryTree().getName())
.map(PluginInfo::getId)
.ifPresent(storage::deregister)); That's in the startup for the |
Test image available:
|
The last refactoring probably fixed this, and also fixed the broken integration test. The earlier refactoring I did in this PR broke some of how the DI setup was put together, so things were not all |
Test image available:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Fixed the issue!
* fix(discovery): fix broken DISABLE_BUILT_DISCOVERY env var * remove no longer necessary 'priority' for platforms (cherry picked from commit dda9672)
Welcome to Cryostat! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
git commit --amend --signoff
Fixes: #1505
Description of the change:
This does some refactoring to ensure that the Custom Targets functionality is always available, even when the environment variable
CRYOSTAT_DISABLE_BUILTIN_DISCOVERY
is set, and so that setting that environment variable does not result in a startup-blocking exception.Motivation for the change:
It may be useful in some situations to disable the built-in discovery mechanisms entirely. A Cryostat instance locked down in this way can be sure to never discover any target applications other than ones registered manually using Custom Targets, or ones configured using the Cryostat Agent.
How to manually test:
CRYOSTAT_IMAGE=quay.io... CRYOSTAT_DISABLE_BUILTIN_DISCOVERY=true sh smoketest.sh
https :8181/api/v2.1/discovery
to ensure that only the Custom Targets Realm is reported