diff --git a/run_kraken.py b/run_kraken.py index 86d990d3..8be9676f 100644 --- a/run_kraken.py +++ b/run_kraken.py @@ -136,8 +136,11 @@ def main(cfg): except: kubecli.initialize_clients(None) + cluster_access = kubecli.check_rbac_access('pods','get') + # find node kraken might be running on - kubecli.find_kraken_node() + if cluster_access: + kubecli.find_kraken_node() # Set up kraken url to track signal if not 0 <= int(port) <= 65535: @@ -388,10 +391,11 @@ def main(cfg): # if platform is openshift will be collected # Cloud platform and network plugins metadata # through OCP specific APIs - if distribution == "openshift": - telemetry_ocp.collect_cluster_metadata(chaos_telemetry) - else: - telemetry_k8s.collect_cluster_metadata(chaos_telemetry) + if cluster_access: + if distribution == "openshift": + telemetry_ocp.collect_cluster_metadata(chaos_telemetry) + else: + telemetry_k8s.collect_cluster_metadata(chaos_telemetry) decoded_chaos_run_telemetry = ChaosRunTelemetry(json.loads(chaos_telemetry.to_json())) chaos_output.telemetry = decoded_chaos_run_telemetry