Getting Started
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.
Example Application#
We use kuard as an example application. The YAML below contains a Deployment and a Service.
Create a Trigger#
The Trigger below defines:
resourceName- Template of the name ofResourceTemplate.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 pullup-webhook service.
Then, send the HTTP request to pullup-webhook service. The JSON payload includes:
namespace- Namespace ofHTTPWebhook.name- Name ofHTTPWebhook.action- Webhook action. The value must be one ofcreate,update,apply,delete. We useapplyin 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.
See HTTPWebhook for more info.
This will create a new ResourceTemplate named kuard-test. The name is generated from resourceName of the Trigger.
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.
Update Resources#
The copied resources can be updated by triggering the webhook again. For example, if the version is changed from green to purple.
The images of kuard-test deployment will be also updated from green to purple.
Sometimes changes of input data may cause changes of resource name. For example, if the suffix is changed from test to test2.
Instead of updating kuard-test, Pullup controller will create a new resource kuard-test2.
It is important to keep the input data consistent in order to prevent redundant resources from being created.
Delete Resources#
Finally, change the action to delete to delete resources.
What's Next?#
- 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.