Skip to content

Commit

Permalink
Check cluster access
Browse files Browse the repository at this point in the history
Checks if the user has cluster level access, if not skip collecting cluster metadata and krkn node details.

Signed-off-by: yogananth subramanian <[email protected]>
  • Loading branch information
yogananth-subramanian committed Aug 1, 2024
1 parent e02c6d1 commit 6cc53f4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions run_kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6cc53f4

Please sign in to comment.