robusta icon indicating copy to clipboard operation
robusta copied to clipboard

How to turn off `on_kubernetes_any_resource_all_changes` trigger that sends messages to telegram in every pod creation.

Open IdeoG opened this issue 3 years ago • 11 comments
trafficstars

subj, i found it was declared in ConfigLoader as internal trigger.

Notifications on every pod creation/deletion is redudant in our logic, or we just want to separate telegram alerts for release notifications and alerts. it would be helpful to do that.

IdeoG avatar Sep 19 '22 22:09 IdeoG

Thank you for reporting this @IdeoG

Do you have any customPlaybooks configured? If so, can you please share your customPlaybooks section ? (Please make sure not to share any sensitive value)

arikalon1 avatar Sep 19 '22 23:09 arikalon1

builtinPlaybooks:
- triggers:
    - on_kubernetes_warning_event:
        namespace_prefix: jupyterhub
  actions:
    - resource_babysitter: {}

so, it's a part of my values.yaml config file.

IdeoG avatar Sep 19 '22 23:09 IdeoG

Typically, Robusta installation has the values.yaml file, which is the defaults file, and the generated_values.yaml file, which is the overrides file.

Is it configured this way on your installation as well?

Regardless, you're welcome to join our Slack community. We're available there as well. You can find the link to our Slack channel here: https://home.robusta.dev/

arikalon1 avatar Sep 20 '22 07:09 arikalon1

Oh, i see, suddenly, i used trainers.values.yaml filename, so i renamed it to values.yaml and hope it will help. Thank you!

IdeoG avatar Sep 20 '22 07:09 IdeoG

Hmm, it didn't work. Pod created/deleted events are coming to my tg group. Is there any ideas

IdeoG avatar Sep 20 '22 08:09 IdeoG

Can you please share your generated_values.yaml file (without the sensitive values, if there are any)

arikalon1 avatar Sep 20 '22 08:09 arikalon1

builtinPlaybooks:
- triggers:
    - on_kubernetes_warning_event:
        namespace_prefix: jupyterhub
  actions:
    - resource_babysitter: {}


globalConfig:
  signing_key: ...
  account_id: 631b58c8-d88d-4c63-b7c8-94e0be313823
sinksConfig:
- telegram_sink:
    name: personal_telegram sink
    bot_token: ...
    chat_id: -1001758586891
disableCloudRouting: true
runner:
  sendAdditionalTelemetry: false

IdeoG avatar Sep 20 '22 08:09 IdeoG

Can you explain when you'd like to get a notification on telegram? For example, when a deployment is created, or when a statefulset is changed?

arikalon1 avatar Sep 20 '22 09:09 arikalon1

Sure! My use cases:

  1. Deployment update was started and finished
  2. Deployment was created and creation was successful
  3. Any k8s object warnings from namespace
  4. Pod errors, such as OomKiller, Loopbackoff

Thank you for your help!

IdeoG avatar Sep 20 '22 13:09 IdeoG

Thank you

In general, when adding new playbooks, you should use the customPlaybooks value, and not the builtinPlaybooks

Specifically, regarding your use cases:

  1. Deployment update
- triggers:
  - on_deployment_update: {}
  actions:
  - resource_babysitter: 
      fields_to_monitor:
      - spec

This will send a change event, whenever the deployment spec change.

  1. Deployment creation
- triggers:
  - on_deployment_create: {}
  actions:
  - create_finding:
      aggregation_key: "Deployment Created"
      severity: INFO
      title: "New deployment created"
      description: "New deployment: name - $name on namespace - $namespace"
  1. k8s warnings from namespace This might be too spammy, but if you do want it, this is the playbook you need:
- triggers:
  - on_kubernetes_warning_event_create:
      exclude: ["NodeSysctlChange"]
  actions:
  - event_report: {}
  - event_resource_events: {}
  1. Pod crash loops, oom kills etc are configured by default. You don't need to modify anything

So, your generated_values.yaml file should have:

customPlaybooks:
- triggers:
  - on_deployment_update: {}
  actions:
  - resource_babysitter: 
      fields_to_monitor:
      - spec

- triggers:
  - on_deployment_create: {}
  actions:
  - create_finding:
      aggregation_key: "Deployment Created"
      severity: INFO
      title: "New deployment created"
      description: "New deployment: name - $name on namespace - $namespace"

- triggers:
  - on_kubernetes_warning_event_create:
      exclude: ["NodeSysctlChange"]
  actions:
  - event_report: {}
  - event_resource_events: {}

Please let us know if you have additional questions

arikalon1 avatar Sep 20 '22 13:09 arikalon1

@IdeoG , did the above configuration solve your use cases?

arikalon1 avatar Sep 22 '22 15:09 arikalon1

Closing due to inactivity. @IdeoG please feel free to re-open if you have issues.

aantn avatar Feb 22 '24 16:02 aantn