Skip to content

2.25.2.0-b59

@shahrooz1997 shahrooz1997 tagged this 26 Feb 15:47
Summary:
Allow users to add webhooks do DR config to be called during failover and switchover to send the ips of the the new primary universe.

Example of usage:

EditDrConfig endpoint
`{{base_url}}/customers/{{customer_uuid}}/dr_configs/{{dr_config_uuid}}/edit`

Request body:
```
{
    "webhookUrls": ["http://localhost:8000", ...]
}
```
Also, the GET DrConfig response will also contain the webhooks

Example:
```
{
  uuid: "<>",
  "name": "dr-config-faithful-coral-xerinae",
  "webhooks": [
        {
            "url": "http://localhost:8000",
            "uuid": "6b9f6b27-056b-4592-ad57-d65faaa110f6"
        },
       ...
   ]
}
```

The webhook will make a POST request to the url with the following body:
```
{
  "drConfigUuid" : "a63db99b-3dd3-49f7-8f89-7471916f8914",
  "ips" : "1.1.1.1,, 2,2,2,2",
  "recordType" : "A",
  "ttl" : 5
}
```
The ttl  and recordType are manually set to 5 seconds and record type A respectively.
```

Test Plan:
Added UTs to test editDrConfig flow to make sure webhooks are added correctly + during `DrConfigWebhookCall` subtask, we correctly call the url of the webhook correctly.

Also manually tested the manually:
1. Create Dr config between source and target universe.
2. Set up a local server listening on port 9000.
3. EditDrConfig to add a webhook url
4. Perform switchover. Make sure the webhook is called.
5. Perform failover. Make sure the webhook is called.

Reviewers: #yba-api-review!, jmak, cwang

Subscribers: sanketh, yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D40984
Assets 2
Loading