robusta-cli 0.13.1__tar.gz → 1.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. {robusta_cli-0.13.1 → robusta_cli-1.0a1}/LICENSE +1 -1
  2. robusta_cli-1.0a1/PKG-INFO +30 -0
  3. robusta_cli-1.0a1/README.md +1 -0
  4. robusta_cli-1.0a1/pyproject.toml +31 -0
  5. {robusta_cli-0.13.1/src/robusta → robusta_cli-1.0a1/robusta_cli}/_version.py +1 -1
  6. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/auth.py +4 -4
  7. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/backend_profile.py +1 -1
  8. robusta_cli-1.0a1/robusta_cli/demo_alert.py +155 -0
  9. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/eula.py +1 -1
  10. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/integrations_cmd.py +2 -2
  11. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/main.py +28 -148
  12. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/playbooks_cmd.py +1 -1
  13. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/self_host.py +2 -2
  14. robusta_cli-1.0a1/robusta_cli/simple_sink_config.py +34 -0
  15. robusta_cli-0.13.1/PKG-INFO +0 -60
  16. robusta_cli-0.13.1/pyproject.toml +0 -141
  17. robusta_cli-0.13.1/src/robusta/api/__init__.py +0 -330
  18. robusta_cli-0.13.1/src/robusta/cli/__init__.py +0 -0
  19. robusta_cli-0.13.1/src/robusta/core/__init__.py +0 -0
  20. robusta_cli-0.13.1/src/robusta/core/discovery/__init__.py +0 -0
  21. robusta_cli-0.13.1/src/robusta/core/discovery/discovery.py +0 -818
  22. robusta_cli-0.13.1/src/robusta/core/discovery/resource_names.py +0 -88
  23. robusta_cli-0.13.1/src/robusta/core/discovery/top_service_resolver.py +0 -76
  24. robusta_cli-0.13.1/src/robusta/core/discovery/utils.py +0 -45
  25. robusta_cli-0.13.1/src/robusta/core/exceptions.py +0 -16
  26. robusta_cli-0.13.1/src/robusta/core/model/__init__.py +0 -0
  27. robusta_cli-0.13.1/src/robusta/core/model/base_params.py +0 -346
  28. robusta_cli-0.13.1/src/robusta/core/model/cluster_status.py +0 -34
  29. robusta_cli-0.13.1/src/robusta/core/model/env_vars.py +0 -124
  30. robusta_cli-0.13.1/src/robusta/core/model/events.py +0 -168
  31. robusta_cli-0.13.1/src/robusta/core/model/helm_release.py +0 -67
  32. robusta_cli-0.13.1/src/robusta/core/model/jobs.py +0 -182
  33. robusta_cli-0.13.1/src/robusta/core/model/k8s_operation_type.py +0 -7
  34. robusta_cli-0.13.1/src/robusta/core/model/namespaces.py +0 -20
  35. robusta_cli-0.13.1/src/robusta/core/model/nodes.py +0 -51
  36. robusta_cli-0.13.1/src/robusta/core/model/pods.py +0 -264
  37. robusta_cli-0.13.1/src/robusta/core/model/runner_config.py +0 -102
  38. robusta_cli-0.13.1/src/robusta/core/model/services.py +0 -127
  39. robusta_cli-0.13.1/src/robusta/core/persistency/__init__.py +0 -0
  40. robusta_cli-0.13.1/src/robusta/core/persistency/in_memory.py +0 -20
  41. robusta_cli-0.13.1/src/robusta/core/persistency/scheduled_jobs_states_dal.py +0 -66
  42. robusta_cli-0.13.1/src/robusta/core/playbooks/__init__.py +0 -0
  43. robusta_cli-0.13.1/src/robusta/core/playbooks/actions_registry.py +0 -109
  44. robusta_cli-0.13.1/src/robusta/core/playbooks/base_trigger.py +0 -36
  45. robusta_cli-0.13.1/src/robusta/core/playbooks/common.py +0 -121
  46. robusta_cli-0.13.1/src/robusta/core/playbooks/container_playbook_utils.py +0 -69
  47. robusta_cli-0.13.1/src/robusta/core/playbooks/crash_reporter.py +0 -65
  48. robusta_cli-0.13.1/src/robusta/core/playbooks/generation.py +0 -131
  49. robusta_cli-0.13.1/src/robusta/core/playbooks/internal/discovery_events.py +0 -87
  50. robusta_cli-0.13.1/src/robusta/core/playbooks/job_utils.py +0 -47
  51. robusta_cli-0.13.1/src/robusta/core/playbooks/node_playbook_utils.py +0 -28
  52. robusta_cli-0.13.1/src/robusta/core/playbooks/oom_killer_utils.py +0 -95
  53. robusta_cli-0.13.1/src/robusta/core/playbooks/playbook_utils.py +0 -67
  54. robusta_cli-0.13.1/src/robusta/core/playbooks/playbooks_event_handler.py +0 -76
  55. robusta_cli-0.13.1/src/robusta/core/playbooks/playbooks_event_handler_impl.py +0 -365
  56. robusta_cli-0.13.1/src/robusta/core/playbooks/pod_utils/crashloop_utils.py +0 -62
  57. robusta_cli-0.13.1/src/robusta/core/playbooks/pod_utils/imagepull_utils.py +0 -229
  58. robusta_cli-0.13.1/src/robusta/core/playbooks/pod_utils/pending_pod_utils.py +0 -162
  59. robusta_cli-0.13.1/src/robusta/core/playbooks/prometheus_enrichment_utils.py +0 -542
  60. robusta_cli-0.13.1/src/robusta/core/playbooks/trigger.py +0 -27
  61. robusta_cli-0.13.1/src/robusta/core/pubsub/__init__.py +0 -0
  62. robusta_cli-0.13.1/src/robusta/core/pubsub/event_emitter.py +0 -7
  63. robusta_cli-0.13.1/src/robusta/core/pubsub/event_subscriber.py +0 -17
  64. robusta_cli-0.13.1/src/robusta/core/pubsub/events_pubsub.py +0 -20
  65. robusta_cli-0.13.1/src/robusta/core/reporting/__init__.py +0 -67
  66. robusta_cli-0.13.1/src/robusta/core/reporting/action_requests.py +0 -57
  67. robusta_cli-0.13.1/src/robusta/core/reporting/base.py +0 -383
  68. robusta_cli-0.13.1/src/robusta/core/reporting/blocks.py +0 -820
  69. robusta_cli-0.13.1/src/robusta/core/reporting/callbacks.py +0 -49
  70. robusta_cli-0.13.1/src/robusta/core/reporting/consts.py +0 -96
  71. robusta_cli-0.13.1/src/robusta/core/reporting/custom_rendering.py +0 -76
  72. robusta_cli-0.13.1/src/robusta/core/reporting/finding_subjects.py +0 -52
  73. robusta_cli-0.13.1/src/robusta/core/reporting/utils.py +0 -46
  74. robusta_cli-0.13.1/src/robusta/core/schedule/__init__.py +0 -0
  75. robusta_cli-0.13.1/src/robusta/core/schedule/model.py +0 -47
  76. robusta_cli-0.13.1/src/robusta/core/schedule/scheduler.py +0 -153
  77. robusta_cli-0.13.1/src/robusta/core/sinks/__init__.py +0 -3
  78. robusta_cli-0.13.1/src/robusta/core/sinks/common/__init__.py +0 -1
  79. robusta_cli-0.13.1/src/robusta/core/sinks/common/channel_transformer.py +0 -106
  80. robusta_cli-0.13.1/src/robusta/core/sinks/common/html_tools.py +0 -108
  81. robusta_cli-0.13.1/src/robusta/core/sinks/datadog/__init__.py +0 -2
  82. robusta_cli-0.13.1/src/robusta/core/sinks/datadog/datadog_sink.py +0 -127
  83. robusta_cli-0.13.1/src/robusta/core/sinks/datadog/datadog_sink_params.py +0 -17
  84. robusta_cli-0.13.1/src/robusta/core/sinks/discord/__init__.py +0 -2
  85. robusta_cli-0.13.1/src/robusta/core/sinks/discord/discord_sink.py +0 -15
  86. robusta_cli-0.13.1/src/robusta/core/sinks/discord/discord_sink_params.py +0 -17
  87. robusta_cli-0.13.1/src/robusta/core/sinks/file/__init__.py +0 -0
  88. robusta_cli-0.13.1/src/robusta/core/sinks/file/file_sink.py +0 -33
  89. robusta_cli-0.13.1/src/robusta/core/sinks/file/file_sink_params.py +0 -19
  90. robusta_cli-0.13.1/src/robusta/core/sinks/file/object_traverser.py +0 -90
  91. robusta_cli-0.13.1/src/robusta/core/sinks/google_chat/__init__.py +0 -0
  92. robusta_cli-0.13.1/src/robusta/core/sinks/google_chat/google_chat.py +0 -19
  93. robusta_cli-0.13.1/src/robusta/core/sinks/google_chat/google_chat_params.py +0 -19
  94. robusta_cli-0.13.1/src/robusta/core/sinks/jira/__init__.py +0 -2
  95. robusta_cli-0.13.1/src/robusta/core/sinks/jira/jira_sink.py +0 -15
  96. robusta_cli-0.13.1/src/robusta/core/sinks/jira/jira_sink_params.py +0 -31
  97. robusta_cli-0.13.1/src/robusta/core/sinks/kafka/__init__.py +0 -2
  98. robusta_cli-0.13.1/src/robusta/core/sinks/kafka/kafka_sink.py +0 -80
  99. robusta_cli-0.13.1/src/robusta/core/sinks/kafka/kafka_sink_params.py +0 -19
  100. robusta_cli-0.13.1/src/robusta/core/sinks/mail/__init__.py +0 -0
  101. robusta_cli-0.13.1/src/robusta/core/sinks/mail/mail_sink.py +0 -18
  102. robusta_cli-0.13.1/src/robusta/core/sinks/mail/mail_sink_params.py +0 -27
  103. robusta_cli-0.13.1/src/robusta/core/sinks/mattermost/__init__.py +0 -2
  104. robusta_cli-0.13.1/src/robusta/core/sinks/mattermost/mattermost_sink.py +0 -26
  105. robusta_cli-0.13.1/src/robusta/core/sinks/mattermost/mattermost_sink_params.py +0 -35
  106. robusta_cli-0.13.1/src/robusta/core/sinks/msteams/__init__.py +0 -2
  107. robusta_cli-0.13.1/src/robusta/core/sinks/msteams/msteams_sink.py +0 -15
  108. robusta_cli-0.13.1/src/robusta/core/sinks/msteams/msteams_sink_params.py +0 -17
  109. robusta_cli-0.13.1/src/robusta/core/sinks/opsgenie/__init__.py +0 -2
  110. robusta_cli-0.13.1/src/robusta/core/sinks/opsgenie/opsgenie_sink.py +0 -103
  111. robusta_cli-0.13.1/src/robusta/core/sinks/opsgenie/opsgenie_sink_params.py +0 -22
  112. robusta_cli-0.13.1/src/robusta/core/sinks/pagerduty/__init__.py +0 -2
  113. robusta_cli-0.13.1/src/robusta/core/sinks/pagerduty/pagerduty_sink.py +0 -254
  114. robusta_cli-0.13.1/src/robusta/core/sinks/pagerduty/pagerduty_sink_params.py +0 -17
  115. robusta_cli-0.13.1/src/robusta/core/sinks/pushover/__init__.py +0 -2
  116. robusta_cli-0.13.1/src/robusta/core/sinks/pushover/pushover_client.py +0 -60
  117. robusta_cli-0.13.1/src/robusta/core/sinks/pushover/pushover_sink.py +0 -123
  118. robusta_cli-0.13.1/src/robusta/core/sinks/pushover/pushover_sink_params.py +0 -22
  119. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/__init__.py +0 -2
  120. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/dal/__init__.py +0 -0
  121. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/dal/model_conversion.py +0 -203
  122. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/dal/supabase_dal.py +0 -712
  123. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/discovery_metrics.py +0 -30
  124. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/prometheus_health_checker.py +0 -108
  125. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/robusta_sink.py +0 -675
  126. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/robusta_sink_params.py +0 -29
  127. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/__init__.py +0 -0
  128. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/account_resource_fetcher.py +0 -22
  129. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/base_resource_manager.py +0 -13
  130. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/prometheus_alert_resource_manager.py +0 -202
  131. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/rrm.py +0 -85
  132. robusta_cli-0.13.1/src/robusta/core/sinks/robusta/rrm/types.py +0 -62
  133. robusta_cli-0.13.1/src/robusta/core/sinks/rocketchat/__init__.py +0 -0
  134. robusta_cli-0.13.1/src/robusta/core/sinks/rocketchat/rocketchat_sink.py +0 -19
  135. robusta_cli-0.13.1/src/robusta/core/sinks/rocketchat/rocketchat_sink_params.py +0 -27
  136. robusta_cli-0.13.1/src/robusta/core/sinks/servicenow/__init__.py +0 -0
  137. robusta_cli-0.13.1/src/robusta/core/sinks/servicenow/servicenow_sink.py +0 -15
  138. robusta_cli-0.13.1/src/robusta/core/sinks/servicenow/servicenow_sink_params.py +0 -24
  139. robusta_cli-0.13.1/src/robusta/core/sinks/sink_base.py +0 -185
  140. robusta_cli-0.13.1/src/robusta/core/sinks/sink_base_params.py +0 -158
  141. robusta_cli-0.13.1/src/robusta/core/sinks/sink_config.py +0 -15
  142. robusta_cli-0.13.1/src/robusta/core/sinks/sink_factory.py +0 -64
  143. robusta_cli-0.13.1/src/robusta/core/sinks/slack/__init__.py +0 -2
  144. robusta_cli-0.13.1/src/robusta/core/sinks/slack/slack_sink.py +0 -80
  145. robusta_cli-0.13.1/src/robusta/core/sinks/slack/slack_sink_params.py +0 -32
  146. robusta_cli-0.13.1/src/robusta/core/sinks/telegram/__init__.py +0 -2
  147. robusta_cli-0.13.1/src/robusta/core/sinks/telegram/telegram_client.py +0 -47
  148. robusta_cli-0.13.1/src/robusta/core/sinks/telegram/telegram_sink.py +0 -93
  149. robusta_cli-0.13.1/src/robusta/core/sinks/telegram/telegram_sink_params.py +0 -22
  150. robusta_cli-0.13.1/src/robusta/core/sinks/timing.py +0 -67
  151. robusta_cli-0.13.1/src/robusta/core/sinks/transformer.py +0 -262
  152. robusta_cli-0.13.1/src/robusta/core/sinks/victorops/__init__.py +0 -2
  153. robusta_cli-0.13.1/src/robusta/core/sinks/victorops/victorops_sink.py +0 -82
  154. robusta_cli-0.13.1/src/robusta/core/sinks/victorops/victorops_sink_params.py +0 -17
  155. robusta_cli-0.13.1/src/robusta/core/sinks/webex/__init__.py +0 -2
  156. robusta_cli-0.13.1/src/robusta/core/sinks/webex/webex_sink.py +0 -20
  157. robusta_cli-0.13.1/src/robusta/core/sinks/webex/webex_sink_params.py +0 -18
  158. robusta_cli-0.13.1/src/robusta/core/sinks/webhook/__init__.py +0 -2
  159. robusta_cli-0.13.1/src/robusta/core/sinks/webhook/webhook_sink.py +0 -140
  160. robusta_cli-0.13.1/src/robusta/core/sinks/webhook/webhook_sink_params.py +0 -23
  161. robusta_cli-0.13.1/src/robusta/core/sinks/yamessenger/__init__.py +0 -2
  162. robusta_cli-0.13.1/src/robusta/core/sinks/yamessenger/yamessenger_client.py +0 -84
  163. robusta_cli-0.13.1/src/robusta/core/sinks/yamessenger/yamessenger_sink.py +0 -96
  164. robusta_cli-0.13.1/src/robusta/core/sinks/yamessenger/yamessenger_sink_params.py +0 -30
  165. robusta_cli-0.13.1/src/robusta/core/sinks/zulip/__init__.py +0 -2
  166. robusta_cli-0.13.1/src/robusta/core/sinks/zulip/zulip_sink.py +0 -32
  167. robusta_cli-0.13.1/src/robusta/core/sinks/zulip/zulip_sink_params.py +0 -28
  168. robusta_cli-0.13.1/src/robusta/core/triggers/container_oom_killed_trigger.py +0 -32
  169. robusta_cli-0.13.1/src/robusta/core/triggers/custom_triggers.py +0 -31
  170. robusta_cli-0.13.1/src/robusta/core/triggers/error_event_trigger.py +0 -150
  171. robusta_cli-0.13.1/src/robusta/core/triggers/helm_releases_triggers.py +0 -176
  172. robusta_cli-0.13.1/src/robusta/core/triggers/job_failed_trigger.py +0 -53
  173. robusta_cli-0.13.1/src/robusta/core/triggers/multi_resources_trigger.py +0 -59
  174. robusta_cli-0.13.1/src/robusta/core/triggers/oom_killed_trigger_base.py +0 -110
  175. robusta_cli-0.13.1/src/robusta/core/triggers/pod_crash_loop_trigger.py +0 -75
  176. robusta_cli-0.13.1/src/robusta/core/triggers/pod_evicted_trigger.py +0 -55
  177. robusta_cli-0.13.1/src/robusta/core/triggers/pod_image_pull_backoff.py +0 -83
  178. robusta_cli-0.13.1/src/robusta/core/triggers/pod_oom_killed_trigger.py +0 -32
  179. robusta_cli-0.13.1/src/robusta/integrations/__init__.py +0 -0
  180. robusta_cli-0.13.1/src/robusta/integrations/argocd/argocd_client.py +0 -25
  181. robusta_cli-0.13.1/src/robusta/integrations/common/__init__.py +0 -0
  182. robusta_cli-0.13.1/src/robusta/integrations/common/requests.py +0 -72
  183. robusta_cli-0.13.1/src/robusta/integrations/discord/__init__.py +0 -0
  184. robusta_cli-0.13.1/src/robusta/integrations/discord/sender.py +0 -300
  185. robusta_cli-0.13.1/src/robusta/integrations/git/__init__.py +0 -0
  186. robusta_cli-0.13.1/src/robusta/integrations/git/git_repo.py +0 -296
  187. robusta_cli-0.13.1/src/robusta/integrations/git/well_known_hosts.py +0 -16
  188. robusta_cli-0.13.1/src/robusta/integrations/google_chat/__init__.py +0 -0
  189. robusta_cli-0.13.1/src/robusta/integrations/google_chat/sender.py +0 -143
  190. robusta_cli-0.13.1/src/robusta/integrations/grafana.py +0 -118
  191. robusta_cli-0.13.1/src/robusta/integrations/helper.py +0 -16
  192. robusta_cli-0.13.1/src/robusta/integrations/jira/__init__.py +0 -0
  193. robusta_cli-0.13.1/src/robusta/integrations/jira/client.py +0 -294
  194. robusta_cli-0.13.1/src/robusta/integrations/jira/sender.py +0 -252
  195. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/__init__.py +0 -0
  196. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/api_client_utils.py +0 -288
  197. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/__init__.py +0 -0
  198. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/events.py +0 -1219
  199. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/models.py +0 -12
  200. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/triggers.py +0 -2035
  201. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/v1/__init__.py +0 -0
  202. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/autogenerated/v1/models.py +0 -27
  203. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/base_event.py +0 -33
  204. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/base_triggers.py +0 -282
  205. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/custom_models.py +0 -775
  206. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/model_not_found_exception.py +0 -4
  207. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/process_utils.py +0 -125
  208. robusta_cli-0.13.1/src/robusta/integrations/kubernetes/templates.py +0 -31
  209. robusta_cli-0.13.1/src/robusta/integrations/mail/__init__.py +0 -0
  210. robusta_cli-0.13.1/src/robusta/integrations/mail/sender.py +0 -109
  211. robusta_cli-0.13.1/src/robusta/integrations/mattermost/__init__.py +0 -0
  212. robusta_cli-0.13.1/src/robusta/integrations/mattermost/client.py +0 -167
  213. robusta_cli-0.13.1/src/robusta/integrations/mattermost/sender.py +0 -169
  214. robusta_cli-0.13.1/src/robusta/integrations/msteams/__init__.py +0 -1
  215. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_adaptive_card_files.py +0 -27
  216. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_adaptive_card_files_image.py +0 -69
  217. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_adaptive_card_files_text.py +0 -170
  218. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/__init__.py +0 -0
  219. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_action.py +0 -28
  220. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_base.py +0 -6
  221. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_card.py +0 -20
  222. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_column.py +0 -38
  223. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_container.py +0 -24
  224. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_images.py +0 -22
  225. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_table.py +0 -24
  226. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_elements/msteams_text_block.py +0 -74
  227. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_mark_down_fix_url.py +0 -22
  228. robusta_cli-0.13.1/src/robusta/integrations/msteams/msteams_msg.py +0 -184
  229. robusta_cli-0.13.1/src/robusta/integrations/msteams/sender.py +0 -66
  230. robusta_cli-0.13.1/src/robusta/integrations/openshift/__init__.py +0 -1
  231. robusta_cli-0.13.1/src/robusta/integrations/openshift/token.py +0 -17
  232. robusta_cli-0.13.1/src/robusta/integrations/prometheus/__init__.py +0 -0
  233. robusta_cli-0.13.1/src/robusta/integrations/prometheus/models.py +0 -235
  234. robusta_cli-0.13.1/src/robusta/integrations/prometheus/trigger.py +0 -207
  235. robusta_cli-0.13.1/src/robusta/integrations/prometheus/utils.py +0 -178
  236. robusta_cli-0.13.1/src/robusta/integrations/receiver.py +0 -346
  237. robusta_cli-0.13.1/src/robusta/integrations/resource_analysis/__init__.py +0 -0
  238. robusta_cli-0.13.1/src/robusta/integrations/resource_analysis/cpu_analyzer.py +0 -28
  239. robusta_cli-0.13.1/src/robusta/integrations/resource_analysis/memory_analyzer.py +0 -138
  240. robusta_cli-0.13.1/src/robusta/integrations/resource_analysis/node_cpu_analyzer.py +0 -96
  241. robusta_cli-0.13.1/src/robusta/integrations/resource_analysis/prometheus_analyzer.py +0 -49
  242. robusta_cli-0.13.1/src/robusta/integrations/rocketchat/__init__.py +0 -0
  243. robusta_cli-0.13.1/src/robusta/integrations/rocketchat/sender.py +0 -371
  244. robusta_cli-0.13.1/src/robusta/integrations/scheduled/__init__.py +0 -0
  245. robusta_cli-0.13.1/src/robusta/integrations/scheduled/event.py +0 -19
  246. robusta_cli-0.13.1/src/robusta/integrations/scheduled/models.py +0 -7
  247. robusta_cli-0.13.1/src/robusta/integrations/scheduled/playbook_scheduler.py +0 -19
  248. robusta_cli-0.13.1/src/robusta/integrations/scheduled/playbook_scheduler_manager.py +0 -10
  249. robusta_cli-0.13.1/src/robusta/integrations/scheduled/playbook_scheduler_manager_impl.py +0 -127
  250. robusta_cli-0.13.1/src/robusta/integrations/scheduled/trigger.py +0 -55
  251. robusta_cli-0.13.1/src/robusta/integrations/servicenow/__init__.py +0 -0
  252. robusta_cli-0.13.1/src/robusta/integrations/servicenow/sender.py +0 -138
  253. robusta_cli-0.13.1/src/robusta/integrations/slack/__init__.py +0 -1
  254. robusta_cli-0.13.1/src/robusta/integrations/slack/sender.py +0 -519
  255. robusta_cli-0.13.1/src/robusta/integrations/webex/__init__.py +0 -0
  256. robusta_cli-0.13.1/src/robusta/integrations/webex/sender.py +0 -193
  257. robusta_cli-0.13.1/src/robusta/integrations/zulip/__init__.py +0 -1
  258. robusta_cli-0.13.1/src/robusta/integrations/zulip/sender.py +0 -171
  259. robusta_cli-0.13.1/src/robusta/model/alert_relabel_config.py +0 -14
  260. robusta_cli-0.13.1/src/robusta/model/config.py +0 -223
  261. robusta_cli-0.13.1/src/robusta/model/playbook_action.py +0 -23
  262. robusta_cli-0.13.1/src/robusta/model/playbook_definition.py +0 -44
  263. robusta_cli-0.13.1/src/robusta/patch/patch.py +0 -167
  264. robusta_cli-0.13.1/src/robusta/runner/__init__.py +0 -0
  265. robusta_cli-0.13.1/src/robusta/runner/config_loader.py +0 -286
  266. robusta_cli-0.13.1/src/robusta/runner/log_init.py +0 -21
  267. robusta_cli-0.13.1/src/robusta/runner/main.py +0 -53
  268. robusta_cli-0.13.1/src/robusta/runner/not_found_exception.py +0 -5
  269. robusta_cli-0.13.1/src/robusta/runner/object_updater.py +0 -14
  270. robusta_cli-0.13.1/src/robusta/runner/process_setup.py +0 -21
  271. robusta_cli-0.13.1/src/robusta/runner/ssl_utils.py +0 -40
  272. robusta_cli-0.13.1/src/robusta/runner/telemetry.py +0 -21
  273. robusta_cli-0.13.1/src/robusta/runner/telemetry_service.py +0 -64
  274. robusta_cli-0.13.1/src/robusta/runner/web.py +0 -166
  275. robusta_cli-0.13.1/src/robusta/runner/web_api.py +0 -84
  276. robusta_cli-0.13.1/src/robusta/utils/__init__.py +0 -0
  277. robusta_cli-0.13.1/src/robusta/utils/auth_provider.py +0 -54
  278. robusta_cli-0.13.1/src/robusta/utils/base64_utils.py +0 -9
  279. robusta_cli-0.13.1/src/robusta/utils/cluster_provider_discovery.py +0 -111
  280. robusta_cli-0.13.1/src/robusta/utils/common.py +0 -43
  281. robusta_cli-0.13.1/src/robusta/utils/decorators.py +0 -22
  282. robusta_cli-0.13.1/src/robusta/utils/docs.py +0 -52
  283. robusta_cli-0.13.1/src/robusta/utils/documented_pydantic.py +0 -61
  284. robusta_cli-0.13.1/src/robusta/utils/error_codes.py +0 -41
  285. robusta_cli-0.13.1/src/robusta/utils/file_system_watcher.py +0 -49
  286. robusta_cli-0.13.1/src/robusta/utils/function_hashes.py +0 -24
  287. robusta_cli-0.13.1/src/robusta/utils/json_schema.py +0 -162
  288. robusta_cli-0.13.1/src/robusta/utils/parsing.py +0 -23
  289. robusta_cli-0.13.1/src/robusta/utils/rate_limiter.py +0 -29
  290. robusta_cli-0.13.1/src/robusta/utils/scope.py +0 -95
  291. robusta_cli-0.13.1/src/robusta/utils/server_start.py +0 -15
  292. robusta_cli-0.13.1/src/robusta/utils/service_discovery.py +0 -25
  293. robusta_cli-0.13.1/src/robusta/utils/silence_utils.py +0 -170
  294. robusta_cli-0.13.1/src/robusta/utils/stack_tracer.py +0 -25
  295. robusta_cli-0.13.1/src/robusta/utils/task_queue.py +0 -73
  296. {robusta_cli-0.13.1/src/robusta → robusta_cli-1.0a1/robusta_cli}/__init__.py +0 -0
  297. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/slack_feedback_message.py +0 -0
  298. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/slack_verification.py +0 -0
  299. {robusta_cli-0.13.1/src/robusta/cli → robusta_cli-1.0a1/robusta_cli}/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-2023 Robusta Dev Ltd
3
+ Copyright (c) 2024 Robusta
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.1
2
+ Name: robusta-cli
3
+ Version: 1.0a1
4
+ Summary:
5
+ Author: Natan Yellin
6
+ Author-email: aantn@users.noreply.github.com
7
+ Requires-Python: >=3.8,<3.13
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: certifi (>=2024.2.2,<2025.0.0)
15
+ Requires-Dist: click-spinner (>=0.1.10,<0.2.0)
16
+ Requires-Dist: cryptography (>=42.0.7,<43.0.0)
17
+ Requires-Dist: dpath (>=2.0.5,<3.0.0)
18
+ Requires-Dist: hikaru-model-28 (>=1.1.0,<2.0.0)
19
+ Requires-Dist: kubernetes (>=29,<30)
20
+ Requires-Dist: pydantic (>=1.0,<2.0)
21
+ Requires-Dist: pyjwt (>=2.4.0,<3.0.0)
22
+ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
23
+ Requires-Dist: requests (>=2.32.2,<3.0.0)
24
+ Requires-Dist: slack-sdk (>=3,<4)
25
+ Requires-Dist: toml (>=0.10.2,<0.11.0)
26
+ Requires-Dist: typer (>=0.12.3,<0.13.0)
27
+ Requires-Dist: types-toml (>=0.10.2,<0.11.0)
28
+ Description-Content-Type: text/markdown
29
+
30
+ # robusta-cli
@@ -0,0 +1 @@
1
+ # robusta-cli
@@ -0,0 +1,31 @@
1
+ [tool.poetry]
2
+ name = "robusta-cli"
3
+ version = "1.0-alpha.1"
4
+ description = ""
5
+ authors = ["Natan Yellin <aantn@users.noreply.github.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.scripts]
9
+ robusta = "robusta_cli.main:app"
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.8, <3.13"
13
+ typer = "^0.12.3"
14
+ pyyaml = "^6.0.1"
15
+ click-spinner = "^0.1.10"
16
+ cryptography = "^42.0.7"
17
+ dpath = "^2.0.5"
18
+ pydantic = "^1.0"
19
+ slack-sdk = "^3"
20
+ pyjwt = "^2.4.0"
21
+ requests = "^2.32.2"
22
+ certifi = "^2024.2.2"
23
+ types-toml = "^0.10.2"
24
+ toml = "^0.10.2"
25
+ hikaru-model-28 = "^1.1.0"
26
+ kubernetes = "^29"
27
+
28
+
29
+ [build-system]
30
+ requires = ["poetry-core"]
31
+ build-backend = "poetry.core.masonry.api"
@@ -1,2 +1,2 @@
1
1
  # this is updated by .github/workflows/release.yaml
2
- __version__ = "0.13.1"
2
+ __version__ = "1.0-alpha.1"
@@ -14,9 +14,9 @@ from cryptography.hazmat.primitives.serialization import Encoding, NoEncryption,
14
14
  from dpath.util import get
15
15
  from pydantic import BaseModel
16
16
 
17
- from robusta.cli.backend_profile import backend_profile
18
- from robusta.cli.playbooks_cmd import NAMESPACE_EXPLANATION, get_playbooks_config
19
- from robusta.cli.utils import exec_in_robusta_runner_output, namespace_to_kubectl
17
+ from robusta_cli.backend_profile import backend_profile
18
+ from robusta_cli.playbooks_cmd import NAMESPACE_EXPLANATION, get_playbooks_config
19
+ from robusta_cli.utils import exec_in_robusta_runner_output, namespace_to_kubectl
20
20
 
21
21
  AUTH_SECRET_NAME = "robusta-auth-config-secret"
22
22
  app = typer.Typer(add_completion=False)
@@ -86,7 +86,7 @@ def _get_signing_key_from_env_variable(namespace: Optional[str], env_var_name: s
86
86
  return str(exec_in_robusta_runner_output(f'echo "${env_var_name}"', namespace), "utf-8").strip()
87
87
 
88
88
 
89
- @app.command(name="web-connect")
89
+ @app.command(name="web-connect") # TODO consider removing this
90
90
  @app.command()
91
91
  def gen_token(
92
92
  account_id: str = typer.Option(
@@ -4,7 +4,7 @@ import sys
4
4
  import typer
5
5
  from pydantic.main import BaseModel
6
6
 
7
- from robusta.cli.utils import host_for_params
7
+ from robusta_cli.utils import host_for_params
8
8
 
9
9
  ROBUSTA_BACKEND_PROFILE = os.environ.get("ROBUSTA_BACKEND_PROFILE", "")
10
10
 
@@ -0,0 +1,155 @@
1
+ import json
2
+ import random
3
+ from typing import List, Optional
4
+
5
+ from hikaru.model.rel_1_28 import Container, Job, JobSpec, ObjectMeta, PodSpec, PodTemplateSpec, SecurityContext
6
+ from kubernetes import client, config
7
+
8
+ from kubernetes.client import V1ServiceList
9
+ from kubernetes.client.models.v1_service import V1Service
10
+
11
+ import logging
12
+
13
+
14
+ class AlertManagerDiscovery:
15
+
16
+ @staticmethod
17
+ def find_service_url(label_selector):
18
+ """
19
+ Get the url of an in-cluster service with a specific label
20
+ """
21
+ # we do it this way because there is a weird issue with hikaru's ServiceList.listServiceForAllNamespaces()
22
+ v1 = client.CoreV1Api()
23
+ svc_list: V1ServiceList = v1.list_service_for_all_namespaces(label_selector=label_selector)
24
+ if not svc_list.items:
25
+ return None
26
+ svc: V1Service = svc_list.items[0]
27
+ name = svc.metadata.name
28
+ namespace = svc.metadata.namespace
29
+ port = svc.spec.ports[0].port
30
+ cluster_domain = 'cluster.local'
31
+ url = f"http://{name}.{namespace}.svc.{cluster_domain}:{port}"
32
+ logging.info(f"discovered service with label-selector: `{label_selector}` at url: `{url}`")
33
+ return url
34
+
35
+ @staticmethod
36
+ def find_url(selectors: List[str], error_msg: str) -> Optional[str]:
37
+ """
38
+ Try to autodiscover the url of an in-cluster service
39
+ """
40
+ for label_selector in selectors:
41
+ service_url = AlertManagerDiscovery.find_service_url(label_selector)
42
+ if service_url:
43
+ return service_url
44
+
45
+ logging.debug(error_msg)
46
+ return None
47
+
48
+ @staticmethod
49
+ def find_alert_manager_url() -> Optional[str]:
50
+ return AlertManagerDiscovery.find_url(
51
+ selectors=[
52
+ "app=kube-prometheus-stack-alertmanager",
53
+ "app=prometheus,component=alertmanager",
54
+ "app=prometheus-operator-alertmanager",
55
+ "app=alertmanager",
56
+ "app=rancher-monitoring-alertmanager",
57
+ "app=prometheus-alertmanager",
58
+ "operated-alertmanager=true",
59
+ "app.kubernetes.io/name=alertmanager",
60
+ "app.kubernetes.io/name=vmalertmanager",
61
+ ],
62
+ error_msg="Alert manager url could not be found. Add 'alertmanager_url' under global_config",
63
+ )
64
+
65
+
66
+ class AlertManagerException(Exception):
67
+ def __init__(self, message: str):
68
+ super().__init__(message)
69
+ self.message = message
70
+
71
+
72
+ def create_demo_alert(
73
+ alertmanager_url: str,
74
+ namespaces: List[str],
75
+ alert: str,
76
+ labels: str,
77
+ kube_config: str,
78
+ image: str
79
+ ):
80
+ config.load_kube_config(kube_config)
81
+ if not alertmanager_url:
82
+ # search cluster alertmanager by known alertmanager labels
83
+ alertmanager_url = AlertManagerDiscovery.find_alert_manager_url()
84
+ if not alertmanager_url:
85
+ raise AlertManagerException("Alertmanager service could not be auto-discovered. Please use the --alertmanager-url parameter")
86
+
87
+ pod = None
88
+ for namespace in namespaces:
89
+ pods = client.CoreV1Api().list_namespaced_pod(namespace)
90
+ if pods.items:
91
+ pod = pods.items[0]
92
+ break
93
+
94
+ if not pod:
95
+ raise AlertManagerException(f"Could not find any pod on namespace {namespaces}. Please use the --namespaces parameter to specify a namespace with pods")
96
+
97
+ alert_labels = {
98
+ "alertname": alert,
99
+ "severity": "critical",
100
+ "pod": pod.metadata.name,
101
+ "namespace": pod.metadata.namespace,
102
+ }
103
+ if labels:
104
+ for label in labels.split(","):
105
+ label_key = label.split("=")[0].strip()
106
+ label_value = label.split("=")[1].strip()
107
+ alert_labels[label_key] = label_value
108
+
109
+ demo_alerts = [
110
+ {
111
+ "status": "firing",
112
+ "labels": alert_labels,
113
+ "annotations": {
114
+ "summary": "This is a demo alert manager alert created by Robusta",
115
+ "description": "Nothing wrong here. This alert will be resolved soon",
116
+ },
117
+ }
118
+ ]
119
+
120
+ command = [
121
+ "curl",
122
+ "-X",
123
+ "POST",
124
+ f"{alertmanager_url}/api/v1/alerts",
125
+ "-H",
126
+ "Content-Type: application/json",
127
+ "-d",
128
+ f"{json.dumps(demo_alerts)}",
129
+ ]
130
+
131
+ job: Job = Job(
132
+ metadata=ObjectMeta(
133
+ name=f"alert-job-{random.randint(0, 10000)}",
134
+ namespace=pod.metadata.namespace,
135
+ ),
136
+ spec=JobSpec(
137
+ template=PodTemplateSpec(
138
+ spec=PodSpec(
139
+ containers=[
140
+ Container(
141
+ name="alert-curl",
142
+ image=image,
143
+ command=command,
144
+ securityContext=SecurityContext(runAsUser=2000),
145
+ )
146
+ ],
147
+ restartPolicy="Never",
148
+ ),
149
+ ),
150
+ completions=1,
151
+ ttlSecondsAfterFinished=0, # delete immediately when finished
152
+ ),
153
+ )
154
+ job.create()
155
+ return pod.metadata.name, pod.metadata.namespace
@@ -1,7 +1,7 @@
1
1
  import requests
2
2
  import typer
3
3
 
4
- from robusta.cli.backend_profile import backend_profile
4
+ from robusta_cli.backend_profile import backend_profile
5
5
 
6
6
 
7
7
  def handle_eula(account_id, robusta_api_key, cloud_routing_enabled):
@@ -9,8 +9,8 @@ from typing import Tuple
9
9
  import requests
10
10
  import typer
11
11
 
12
- from robusta.cli.backend_profile import backend_profile
13
- from robusta.cli.utils import log_title
12
+ from robusta_cli.backend_profile import backend_profile
13
+ from robusta_cli.utils import log_title
14
14
 
15
15
  app = typer.Typer(add_completion=False)
16
16
 
@@ -1,7 +1,6 @@
1
1
  import base64
2
2
  import json
3
3
  import os
4
- import random
5
4
  import subprocess
6
5
  import time
7
6
  import traceback
@@ -11,28 +10,27 @@ from typing import Dict, List, Optional, Union
11
10
  import certifi
12
11
  import typer
13
12
  import yaml
14
- from hikaru.model.rel_1_26 import Container, Job, JobSpec, ObjectMeta, PodSpec, PodTemplateSpec, SecurityContext
15
- from kubernetes import client, config
13
+
16
14
  from pydantic import BaseModel, Extra
17
15
 
18
- from robusta._version import __version__
19
- from robusta.cli.auth import app as auth_commands
20
- from robusta.cli.backend_profile import backend_profile
21
- from robusta.cli.eula import handle_eula
22
- from robusta.cli.integrations_cmd import app as integrations_commands
23
- from robusta.cli.integrations_cmd import get_slack_key, get_ui_key
24
- from robusta.cli.playbooks_cmd import app as playbooks_commands
25
- from robusta.cli.self_host import app as self_host_commands
26
- from robusta.cli.slack_feedback_message import SlackFeedbackMessagesSender
27
- from robusta.cli.slack_verification import verify_slack_channel
28
- from robusta.cli.utils import get_runner_pod, log_title, namespace_to_kubectl
29
- from robusta.core.sinks.msteams.msteams_sink_params import MsTeamsSinkConfigWrapper, MsTeamsSinkParams
30
- from robusta.core.sinks.robusta.robusta_sink_params import RobustaSinkConfigWrapper, RobustaSinkParams
31
- from robusta.core.sinks.slack.slack_sink_params import SlackSinkConfigWrapper, SlackSinkParams
32
- from robusta.integrations.prometheus.utils import AlertManagerDiscovery
16
+ from robusta_cli._version import __version__
17
+
18
+ from robusta_cli.auth import app as auth_commands
19
+ from robusta_cli.backend_profile import backend_profile
20
+ from robusta_cli.eula import handle_eula
21
+ from robusta_cli.integrations_cmd import app as integrations_commands
22
+ from robusta_cli.integrations_cmd import get_slack_key, get_ui_key
23
+ from robusta_cli.playbooks_cmd import app as playbooks_commands
24
+ from robusta_cli.self_host import app as self_host_commands
25
+ from robusta_cli.slack_feedback_message import SlackFeedbackMessagesSender
26
+ from robusta_cli.slack_verification import verify_slack_channel
27
+ from robusta_cli.utils import get_runner_pod, log_title, namespace_to_kubectl
28
+ from robusta_cli.simple_sink_config import MsTeamsSinkConfigWrapper, MsTeamsSinkParams
29
+ from robusta_cli.simple_sink_config import RobustaSinkConfigWrapper, RobustaSinkParams
30
+ from robusta_cli.simple_sink_config import SlackSinkConfigWrapper, SlackSinkParams
31
+ from robusta_cli.demo_alert import create_demo_alert, AlertManagerException
33
32
 
34
33
  ADDITIONAL_CERTIFICATE: str = os.environ.get("CERTIFICATE", "")
35
- # TODO - separate shared classes to a separated shared repo, to remove dependencies between the cli and runner
36
34
 
37
35
 
38
36
  def cert_already_exists(new_cert: bytes) -> bool:
@@ -63,12 +61,6 @@ app.add_typer(auth_commands, name="auth", help="Authentication commands menu")
63
61
  app.add_typer(self_host_commands, name="self-host", help="Self-host commands menu")
64
62
 
65
63
 
66
- def get_runner_url(runner_version=None):
67
- if runner_version is None:
68
- runner_version = __version__
69
- return f"https://gist.githubusercontent.com/robusta-lab/6b809d508dfc3d8d92afc92c7bbbe88e/raw/robusta-{runner_version}.yaml"
70
-
71
-
72
64
  class GlobalConfig(BaseModel):
73
65
  signing_key: str = ""
74
66
  account_id: str = ""
@@ -77,8 +69,8 @@ class GlobalConfig(BaseModel):
77
69
  class HelmValues(BaseModel, extra=Extra.allow):
78
70
  globalConfig: GlobalConfig
79
71
  sinksConfig: List[Union[SlackSinkConfigWrapper, RobustaSinkConfigWrapper, MsTeamsSinkConfigWrapper]]
80
- clusterName: Optional[str]
81
- isSmallCluster: Optional[bool]
72
+ clusterName: Optional[str] = None
73
+ isSmallCluster: Optional[bool] = None
82
74
  enablePrometheusStack: bool = False
83
75
  disableCloudRouting: bool = False
84
76
  enablePlatformPlaybooks: bool = False
@@ -309,43 +301,11 @@ def gen_config(
309
301
  typer.secho(slack_feedback_heads_up_message)
310
302
 
311
303
 
312
- @app.command()
313
- def update_config(
314
- existing_values: str = typer.Option(
315
- ...,
316
- help="Existing values.yaml file name. You can run `helm get values` to get it from the cluster.",
317
- ),
318
- ):
319
- """
320
- Update an existing values.yaml file.
321
- Add RSA key-pair if it doesn't exist
322
- Add a signing key if it doesn't exist, or replace with a valid one if the key has an invalid format
323
- """
324
- with open(existing_values, "r") as existing_values_file:
325
- values: HelmValues = HelmValues(**yaml.safe_load(existing_values_file))
326
-
327
- if not values.globalConfig.signing_key:
328
- typer.secho("Generating signing key", fg="green")
329
- values.globalConfig.signing_key = str(uuid.uuid4())
330
-
331
- try:
332
- uuid.UUID(values.globalConfig.signing_key)
333
- except ValueError:
334
- typer.secho("Invalid signing key. Generating a new one", fg="green")
335
- values.globalConfig.signing_key = str(uuid.uuid4())
336
-
337
- write_values_file("updated_values.yaml", values)
338
- typer.secho(
339
- "Run `helm upgrade robusta robusta/robusta -f ./updated_values.yaml`",
340
- fg="green",
341
- )
342
-
343
-
344
304
  @app.command()
345
305
  def version():
346
306
  """Show the version of the local robusta-cli"""
347
307
  if __version__ == "0.0.0":
348
- typer.echo("running with development version from git")
308
+ typer.echo("running with development version from git (0.0.0)")
349
309
  else:
350
310
  typer.echo(f"version {__version__}")
351
311
 
@@ -421,96 +381,16 @@ def demo_alert(
421
381
  Create a demo alert on AlertManager.
422
382
  The alert pod is selected randomly from the pods in the current namespace
423
383
  """
424
- config.load_kube_config(kube_config)
425
- if not alertmanager_url:
426
- # search cluster alertmanager by known alertmanager labels
427
- alertmanager_url = AlertManagerDiscovery.find_alert_manager_url()
428
- if not alertmanager_url:
429
- typer.secho(
430
- "Alertmanager service could not be auto-discovered. " "Please use the --alertmanager-url parameter",
431
- fg="red",
432
- )
433
- return
434
-
435
- pod = None
436
- for namespace in namespaces:
437
- pods = client.CoreV1Api().list_namespaced_pod(namespace)
438
- if pods.items:
439
- pod = pods.items[0]
440
- break
441
-
442
- if not pod:
384
+ try:
385
+ pod_name, namespace = create_demo_alert(alertmanager_url, namespaces, alert, labels, kube_config, image)
443
386
  typer.secho(
444
- f"Could not find any pod on namespace {namespaces}"
445
- f"Please use the --namespaces parameter to specify a namespace with pods",
446
- fg="red",
387
+ f"Created Alertmanager alert: alert-name: {alert} pod: {pod_name} "
388
+ f"namespace: {namespace}",
389
+ fg="green",
447
390
  )
448
- return
449
-
450
- alert_labels = {
451
- "alertname": alert,
452
- "severity": "critical",
453
- "pod": pod.metadata.name,
454
- "namespace": pod.metadata.namespace,
455
- }
456
- if labels:
457
- for label in labels.split(","):
458
- label_key = label.split("=")[0].strip()
459
- label_value = label.split("=")[1].strip()
460
- alert_labels[label_key] = label_value
461
-
462
- demo_alerts = [
463
- {
464
- "status": "firing",
465
- "labels": alert_labels,
466
- "annotations": {
467
- "summary": "This is a demo alert manager alert created by Robusta",
468
- "description": "Nothing wrong here. This alert will be resolved soon",
469
- },
470
- }
471
- ]
472
-
473
- command = [
474
- "curl",
475
- "-X",
476
- "POST",
477
- f"{alertmanager_url}/api/v1/alerts",
478
- "-H",
479
- "Content-Type: application/json",
480
- "-d",
481
- f"{json.dumps(demo_alerts)}",
482
- ]
483
-
484
- job: Job = Job(
485
- metadata=ObjectMeta(
486
- name=f"alert-job-{random.randint(0, 10000)}",
487
- namespace=pod.metadata.namespace,
488
- ),
489
- spec=JobSpec(
490
- template=PodTemplateSpec(
491
- spec=PodSpec(
492
- containers=[
493
- Container(
494
- name="alert-curl",
495
- image=image,
496
- command=command,
497
- securityContext=SecurityContext(runAsUser=2000),
498
- )
499
- ],
500
- restartPolicy="Never",
501
- ),
502
- ),
503
- completions=1,
504
- ttlSecondsAfterFinished=0, # delete immediately when finished
505
- ),
506
- )
507
- job.create()
508
- typer.secho(
509
- f"Created Alertmanager alert: alert-name: {alert} pod: {pod.metadata.name} "
510
- f"namespace: {pod.metadata.namespace}",
511
- fg="green",
512
- )
513
- typer.echo("\n")
391
+ typer.echo("\n")
392
+ except AlertManagerException as e:
393
+ typer.secho(e.message, fg="red")
514
394
 
515
395
 
516
396
  if __name__ == "__main__":
@@ -12,7 +12,7 @@ import click_spinner
12
12
  import typer
13
13
  import yaml
14
14
 
15
- from robusta.cli.utils import (
15
+ from robusta_cli.utils import (
16
16
  PLAYBOOKS_DIR,
17
17
  _build_exec_command,
18
18
  exec_in_robusta_runner,
@@ -9,8 +9,8 @@ import typer
9
9
  import yaml
10
10
  from pydantic import BaseModel
11
11
 
12
- from robusta.cli.backend_profile import BackendProfile
13
- from robusta.cli.utils import host_for_params
12
+ from robusta_cli.backend_profile import BackendProfile
13
+ from robusta_cli.utils import host_for_params
14
14
 
15
15
  ISSUER: str = "supabase"
16
16
 
@@ -0,0 +1,34 @@
1
+ from pydantic import BaseModel
2
+
3
+ # from robusta.core.sinks.msteams.msteams_sink_params import MsTeamsSinkConfigWrapper, MsTeamsSinkParams
4
+ # from robusta.core.sinks.robusta.robusta_sink_params import RobustaSinkConfigWrapper, RobustaSinkParams
5
+ # from robusta.core.sinks.slack.slack_sink_params import SlackSinkConfigWrapper, SlackSinkParams
6
+
7
+
8
+ class SinkBaseParams(BaseModel):
9
+ name: str
10
+
11
+
12
+ class SlackSinkParams(SinkBaseParams):
13
+ slack_channel: str
14
+ api_key: str
15
+
16
+
17
+ class SlackSinkConfigWrapper(BaseModel):
18
+ slack_sink: SlackSinkParams
19
+
20
+
21
+ class MsTeamsSinkParams(SinkBaseParams):
22
+ webhook_url: str
23
+
24
+
25
+ class MsTeamsSinkConfigWrapper(BaseModel):
26
+ ms_teams_sink: MsTeamsSinkParams
27
+
28
+
29
+ class RobustaSinkParams(SinkBaseParams):
30
+ token: str
31
+
32
+
33
+ class RobustaSinkConfigWrapper(BaseModel):
34
+ robusta_sink: RobustaSinkParams
@@ -1,60 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: robusta-cli
3
- Version: 0.13.1
4
- Summary:
5
- Author: Natan Yellin
6
- Author-email: aantn@users.noreply.github.com
7
- Requires-Python: >=3.8,<3.11
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.8
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Provides-Extra: all
13
- Requires-Dist: CairoSVG (>=2.5.2,<3.0.0) ; extra == "all"
14
- Requires-Dist: Flask (>=3.0.0,<4.0.0) ; extra == "all"
15
- Requires-Dist: PyJWT (==2.4.0)
16
- Requires-Dist: apprise (>=1.5.0,<2.0.0)
17
- Requires-Dist: attrs (>=23.1.0,<24.0.0)
18
- Requires-Dist: better-exceptions (>=0.3.3,<0.4.0) ; extra == "all"
19
- Requires-Dist: bitmath (>=1.3.3.1,<2.0.0.0)
20
- Requires-Dist: boto3 (==1.28.72)
21
- Requires-Dist: botocore (==1.31.72)
22
- Requires-Dist: click-spinner (>=0.1.10,<0.2.0)
23
- Requires-Dist: colorlog (>=5.0.1,<6.0.0)
24
- Requires-Dist: croniter (>=1.3.15,<2.0.0)
25
- Requires-Dist: cryptography (>=42.0.5,<43.0.0)
26
- Requires-Dist: datadog-api-client (>=1.2.0,<2.0.0) ; extra == "all"
27
- Requires-Dist: docutils (==0.19)
28
- Requires-Dist: dpath (>=2.0.5,<3.0.0)
29
- Requires-Dist: dulwich (==0.20.28) ; extra == "all"
30
- Requires-Dist: fpdf2 (>=2.7.1,<3.0.0)
31
- Requires-Dist: grafana-api (>=1.0.3,<2.0.0) ; extra == "all"
32
- Requires-Dist: hikaru-model-26 (>=1.1.1,<2.0.0)
33
- Requires-Dist: humanize (>=3.13.1,<4.0.0)
34
- Requires-Dist: idna (>=3.7)
35
- Requires-Dist: jinja2 (>=3.1.4)
36
- Requires-Dist: kafka-python (>=2.0.2,<3.0.0) ; extra == "all"
37
- Requires-Dist: kubernetes (>=26.1.0,<27.0.0)
38
- Requires-Dist: markdown2 (>=2.4.2,<3.0.0)
39
- Requires-Dist: opsgenie-sdk (>=2.1.5,<3.0.0)
40
- Requires-Dist: poetry-core (==1.1.0a7) ; extra == "all"
41
- Requires-Dist: prometheus-client (>=0.12.0,<0.13.0)
42
- Requires-Dist: prometrix (==0.1.16)
43
- Requires-Dist: pydantic (>=1.8.1,<2.0.0)
44
- Requires-Dist: pydash (==8.0.0)
45
- Requires-Dist: pymsteams (>=0.1.16,<0.2.0)
46
- Requires-Dist: pytz (>=2021.3,<2022.0)
47
- Requires-Dist: pyyaml (>=6.0,<7.0)
48
- Requires-Dist: rocketchat-api (>=1.30.0,<2.0.0)
49
- Requires-Dist: sentry-sdk (>=1.5.2,<2.0.0) ; extra == "all"
50
- Requires-Dist: setuptools (>=68.2.2,<69.0.0)
51
- Requires-Dist: slack-sdk (>=3.23.0,<4.0.0)
52
- Requires-Dist: supabase (>=2.4,<3.0) ; extra == "all"
53
- Requires-Dist: tabulate (>=0.8.10,<0.9.0) ; extra == "all"
54
- Requires-Dist: toml (>=0.10.2,<0.11.0)
55
- Requires-Dist: typer (>=0.4.1,<0.5.0)
56
- Requires-Dist: watchdog (>=2.1.0,<3.0.0) ; extra == "all"
57
- Requires-Dist: watchgod (>=0.7,<0.8)
58
- Requires-Dist: webexteamssdk (>=1.6.1,<2.0.0)
59
- Requires-Dist: websocket-client (==1.3.3)
60
- Requires-Dist: werkzeug (>=3.0.3)