Add prom token creation step

This enables compatability with all OpenShift versions.
Reference PR by Paige in Cerberus: https://github.com/redhat-chaos/cerberus/pull/190.
This commit is contained in:
Naga Ravi Chaitanya Elluri
2023-01-31 12:36:09 -05:00
parent 915cc5db94
commit 64f4c234e9
+2 -1
View File
@@ -11,6 +11,7 @@ def instance(distribution, prometheus_url, prometheus_bearer_token):
if distribution == "openshift" and not prometheus_bearer_token:
prometheus_bearer_token = runcommand.invoke(
"oc -n openshift-monitoring sa get-token prometheus-k8s "
"|| oc create token -n openshift-monitoring prometheus-k8s"
"|| oc create token -n openshift-monitoring prometheus-k8s --duration=12h "
"|| oc sa new-token -n openshift-monitoring prometheus-k8s"
)
return prometheus_url, prometheus_bearer_token