From 64f4c234e976d4ea2c75d172bec74a2e33c85559 Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Tue, 31 Jan 2023 11:46:23 -0500 Subject: [PATCH] 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. --- kraken/prometheus/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kraken/prometheus/client.py b/kraken/prometheus/client.py index f29d5890..13dfa93f 100644 --- a/kraken/prometheus/client.py +++ b/kraken/prometheus/client.py @@ -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