diff --git a/kraken/prometheus/client.py b/kraken/prometheus/client.py index 8d06ed8c..f29d5890 100644 --- a/kraken/prometheus/client.py +++ b/kraken/prometheus/client.py @@ -9,5 +9,8 @@ def instance(distribution, prometheus_url, prometheus_bearer_token): ) prometheus_url = "https://" + url if distribution == "openshift" and not prometheus_bearer_token: - prometheus_bearer_token = runcommand.invoke("oc -n openshift-monitoring " "sa get-token prometheus-k8s") + prometheus_bearer_token = runcommand.invoke( + "oc -n openshift-monitoring sa get-token prometheus-k8s " + "|| oc create token -n openshift-monitoring prometheus-k8s" + ) return prometheus_url, prometheus_bearer_token