-
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): BUILTIN_DISCOVERY_DISABLED can be specified even when PLATFORM is set #1865
fix(discovery): BUILTIN_DISCOVERY_DISABLED can be specified even when PLATFORM is set #1865
Conversation
Hi @andrewazores! Add at least one of the required labels to this PR Required labels are : chore,ci,cleanup,docs,feat,fix,perf,refactor,style,test |
74bf2ed
to
698d100
Compare
/build_test |
Workflow started at 1/24/2024, 12:27:28 PM. View Actions Run. |
/build_test |
Workflow started at 1/24/2024, 12:36:11 PM. View Actions Run. |
To run smoketest:
|
|
/build_test |
Workflow started at 1/24/2024, 1:27:31 PM. View Actions Run. |
To run smoketest:
|
|
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
b6d5af8
to
f22bfb7
Compare
/build_test |
Workflow started at 2/6/2024, 11:51:23 AM. View Actions Run. |
To run smoketest:
|
|
Welcome to Cryostat! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
To recreate commits with GPG signature
git fetch upstream && git rebase --force --gpg-sign upstream/main
Fixes: #1864
Description of the change:
Removes
BUILTIN_DISCOVERY_DISABLED
environment variable from the platform detection selection logic. This is an unfortunate and very old design decision I made that the platform integration is coupled to both the default auth manager as well as platform-specific target discovery mechanism. This made sense when originally implemented because it never made sense for platform-specific discovery mechanisms to overlap, but with the advent of custom targets and later the pluggable discovery API, and then with support for both Podman and Docker API, this is clearly no longer a good assumption and no longer a good abstraction.This results in a bug where the variable used to control turning off all of these built-in discovery mechanisms is evaluated in the same place as where we determine which platform detection strategies to enable, which therefore also implicates the AuthManagers. We want to be able to do automatic platform auth (OpenShift is the only one that exists now) integration while also allowing users to turn off built-in discovery in case it causes problems or they intend not to use it.
The fix applied in this patch is to allow platform detection as a whole to either work by the usual automatic detection mechanisms, or to allow the user to use the
CRYOSTAT_PLATFORM
environment variable to specify the list of platforms to enable explicitly. TheBUILTIN_DISCOVERY_DISABLED
variable is not checked until later, after the platform strategies are selected. Once all the strategies are selected the DiscoveryStorage, which integrates all of the mechanisms into one data repository, turns each one on only if its newisEnabled()
method returns true. For Custom Targets and Discovery Storage itself (the pluggable API) this is always true, but for the other built-in discovery mechanisms (Kubernetes API, Podman, Docker) the check depends onBUILTIN_DISCOVERY_DISABLED
not being set totrue
.How to manually test:
./mvnw clean package ; podman image prune -f ; podman tag quay.io/cryostat/cryostat:latest quay.io/$MY_QUAY_USERNAME/cryostat:pr-1865-1
podman push quay.io/$MY_QUAY_USERNAME/cryostat:pr-1865-1
cd cryostat-operator
oc new-project pr1865
DEPLOY_NAMESPACE=$(oc project -q) CORE_IMG=quay.io/$MY_QUAY_USERNAME/cryostat:pr-1865-1 make deploy
make create_cryostat_cr ; make sample_app
oc patch -n $(oc project -q) cryostat/cryostat-sample -p '{"spec":{"targetDiscoveryOptions":{"builtInDiscoveryDisabled":true}}}'
to flip the switch and turn off builtin discovery