Alertmanager supports main stream receivers

  • Related issues: #2521 [FEATURE] Alertmanager supports main stream receivers

Category:

  • Alter manager

Verification Steps

  1. Prepare another VM or machine have the same subnet with the Harvester
  2. Prepare a webhook server on the VM, reference to https://github.com/w13915984028/harvester-develop-summary/blob/main/test-log-event-audit-with-webhook-server.md
  3. You may need to install python3 web package, refer to https://webpy.org/install
  4. Run export PORT=8094 on the webhook server VM
  5. Launch the webhook server python3 simple-webhook-server.py
    davidtclin@ubuntu-clean:~$ python3 simple-webhook-server.py
    usage: export PORT=1234 to set http server port number as 1234
    start a simple webhook server, PORT 8094 @ 2022-09-21 16:39:58.706792 
    
    http://0.0.0.0:8094/
    
  6. Access Harvester Alertmanager Configs page in Monitoring
  7. Create an Alertmanager config image
  8. Access the created Alertmanager config
  9. Click Add receiver image
  10. Select webhook page
  11. Click Add webhook image
  12. Add `http://server_ip:8094 to the URL image
  13. Access Harvester node
  14. Run kubectl get alertmanagerconfig -A -o yaml
  15. Check the webhook server have applied to the Altertmanagerconfig pod
  16. Check the webhook receiver can be created image

Refer to HEP document for more details https://github.com/w13915984028/harvester/blob/fix2517/enhancements/20220720-alertmanager.md

Expected Results

  1. We can add webhook type receiver from the Altermanager Config page for the given namespace image

    image

  2. Can applied the changes to alertmanagerconfig pod in Harveser

    harv0921:~ # kubectl get alertmanagerconfig -A -o yaml
    apiVersion: v1
    items:
    - apiVersion: monitoring.coreos.com/v1alpha1
    kind: AlertmanagerConfig
    metadata:
        creationTimestamp: "2022-09-21T08:16:21Z"
        generation: 1
        name: alert-receiver
        namespace: default
        resourceVersion: "14566"
        uid: 8f9c30a2-42c1-4831-92b5-8abf71134333
    spec:
        receivers: []
        route:
        groupBy: []
        groupInterval: 5m
        groupWait: 30s
        matchers: []
        repeatInterval: 4h
    - apiVersion: monitoring.coreos.com/v1alpha1
    kind: AlertmanagerConfig
    metadata:
        creationTimestamp: "2022-09-21T08:48:38Z"
        generation: 2
        name: alertmanager
        namespace: default
        resourceVersion: "39171"
        uid: 32f813c3-24fd-4faf-a270-1e7723a5dfdf
    spec:
        receivers:
        - name: webhook
        webhookConfigs:
        - httpConfig:
            tlsConfig: {}
            sendResolved: false
            url: http://192.168.122.230:8094
        route:
        groupBy: []
        groupInterval: 5m
        groupWait: 30s
        matchers: []
        repeatInterval: 4h
    kind: List
    metadata:
    resourceVersion: ""
    selfLink: ""