You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The deployer script reads grafana.ingress.tls[0].hosts[0], selecting out hosts[0] specifically as a host to return for a cluster. If a redirect is setup, maybe there won't be issues, maybe there will be - I'm wasn't sure so I investigated.
Conclusion
I think we should be fine. urllib.request.urlopen follows redirects, and so does requests.get it seems. As long as GET and POST are similar, we'll be fine.
Action points
Perhaps update docstring of get_grafana_url to mention all existing usage of the returnvalue makes it acceptable to pick one single.
When ./deploy.py from that project is used, it sends GET and POST requests using this function. I think they may very well redirect correctly and we should be fine. But I don't know for sure. Some tools like curl require you to for example explicitly pass a flag to say that redirects should be followed.
It seems the following is used: from urllib.request import urlopen, Request and testing against https://google.com I note that it does follow the 301 redirect for a GET request at least.
Grafana API requests via new_grafana_token and update_central_grafana_datasources
The deployer script reads
grafana.ingress.tls[0].hosts[0]
, selecting outhosts[0]
specifically as a host to return for a cluster. If a redirect is setup, maybe there won't be issues, maybe there will be - I'm wasn't sure so I investigated.Conclusion
I think we should be fine.
urllib.request.urlopen
follows redirects, and so doesrequests.get
it seems. As long asGET
andPOST
are similar, we'll be fine.Action points
get_grafana_url
to mention all existing usage of the returnvalue makes it acceptable to pick one single.Investigation
get_grafana_url
hardcodes tohosts[0]
infrastructure/deployer/grafana/grafana_utils.py
Lines 12 to 30 in d4f0fdc
Reference sof
get_grafana_url
Grafana API requests via
deploy_grafana_dashboards
This function clones the
https://github.com/jupyterhub/grafana-dashboards
repo and passes the grafana URL to the./deploy.py
script in that projectinfrastructure/deployer/deployer.py
Line 96 in d4f0fdc
When
./deploy.py
from that project is used, it sends GET and POST requests using this function. I think they may very well redirect correctly and we should be fine. But I don't know for sure. Some tools likecurl
require you to for example explicitly pass a flag to say that redirects should be followed.It seems the following is used:
from urllib.request import urlopen, Request
and testing againsthttps://google.com
I note that it does follow the301
redirect for a GET request at least.Grafana API requests via
new_grafana_token
andupdate_central_grafana_datasources
infrastructure/deployer/grafana/grafana_tokens.py
Line 160 in d4f0fdc
infrastructure/deployer/grafana/central_grafana.py
Line 101 in d4f0fdc
Seems to use
import requests
and that seem to follow redirects at least for GET requests.Related
The text was updated successfully, but these errors were encountered: