kubeshop / botkube

An app that helps you monitor your Kubernetes cluster, debug critical deployments & gives recommendations for standard practices
https://botkube.io
MIT License
2.15k stars 289 forks source link

Add PagerDuty integration platform #1446

Closed mszostok closed 6 months ago

mszostok commented 6 months ago

Description

Changes proposed in this pull request:

Testing

  1. Create cluster
  2. Install ArgoCD and create example app
  3. Create PagerDuty service
  4. Change the argocd plugin to get rid of cloud check (we need to use local values.yaml)
  5. Build plugin: PLUGIN_TARGETS='argocd' make build-plugins-single
  6. Serve plugin: make serve-local-plugins
  7. Use such configuration:

    communications:
      default-group:
        ## Settings for PagerDuty.
        pagerDuty:
          # -- If true, enables PagerDuty.
          enabled: true
          # -- The Integration Service Key
          integrationKey: 'key'
          bindings:
            # -- Notification sources configuration for the PagerDuty.
            sources:
              - k8s-err-events
              - k8s-deploy
              - argocd
    sources:
      argocd:
        displayName: argocd
        local-cloud/argocd:
          enabled: true
          config:
            log:
              level: debug
            argoCD:
              notificationsConfigMap:
                name: argocd-notifications-cm
                namespace: argocd
              uiBaseUrl: http://localhost:8080
            defaultSubscriptions:
              applications:
                - name: guestbook # your app name
                  namespace: argocd
            webhook:
              name: bk-{{ .SourceName }}
              register: true
              url: '{{ .IncomingWebhook.FullURLForSource }}'
    
          context:
            rbac:
              group:
                type: Static
                static:
                  values: [ "argocd" ]
    
      'k8s-deploy':
        displayName: "All events"
        botkube/kubernetes:
          enabled: true
          context:
            rbac:
              group:
                type: Static
                prefix: ""
                static:
                  values: [ "botkube-plugins-default" ]
            enabled: true
          config:
            namespaces:
              include:
                - ".*"
            event:
              types:
                - error
                - create
                - update
                - delete
            resources:
              - type: apps/v1/deployments
                event: # Overrides 'source'.kubernetes.event
                  types:
                    - create
                    - update
                    - delete
                    - error
                updateSetting:
                  includeDiff: true
                  fields:
                    - spec.template.spec.containers[*].image
    
    plugins:
      cacheDir: "/tmp/plugins"
      repositories:
        botkube:
          url: https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml
        local-cloud:
          url:  http://localhost:3010/botkube.yaml
    
    settings:
      log:
        level: "debug"
        formatter: text
      kubeconfig: "/Users/mszostok/.kube/config"
      clusterName: "labs"
      upgradeNotifier: false
    
    analytics:
      disable: true
    
  8. Run Botkube. I did it locally.

Related issue(s)