In this guide, you will learn how to create a trigger and a webhook. All YAML files used in this guide can be found in examples/getting-started folder.
We use kuard as an example application. The YAML below contains a
Deployment and a
#Create a Trigger
Trigger below defines:
resourceName- Template of the name of
patches- Resources to create. In this example, when the trigger is executed, a copy of the kuard deployment and service will be created.
schema- JSON schema of input data.
#Create a HTTPWebhook
Webhooks are event sources for triggers. In this guide, we will create a
HTTPWebhook, which can be triggered by HTTP JSON API.
#Trigger the Webhook
First, port forward the
Then, send the HTTP request to
pullup-webhook service. The JSON payload includes:
namespace- Namespace of
name- Name of
action- Webhook action. The value must be one of
delete. We use
applyin this example, which means the controller will create resources if not exist, and update them if already exist.
data- Input data, which is used for rendering templates in the trigger.
HTTPWebhook for more info.
This will create a new
kuard-test. The name is generated from
resourceName of the
The newly created
ResourceTemplate will trigger Pullup controller, which will copy the original kuard app and mutate copied resources. Below are the differences between original and copied resources. Some fields are trimmed for better readability.
The copied resources can be updated by triggering the webhook again. For example, if the
version is changed from
The images of
kuard-test deployment will be also updated from
Sometimes changes of input data may cause changes of resource name. For example, if the
suffix is changed from
Instead of updating
kuard-test, Pullup controller will create a new resource
It is important to keep the input data consistent in order to prevent redundant resources from being created.
Finally, change the
delete to delete resources.
- Learn more details about Trigger.
- Besides HTTPWebhook, Pullup also supports GitHubWebhook.
- If you encounter any problems, try to find answers in troubleshooting or file an issue.