Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

A Kong plugin to create CloudEvents from HTTP requests. These events can be used in a Knative cluster with the TriggerMesh integration platform.

Notifications You must be signed in to change notification settings

triggermesh/kong-cloudevents-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kong CloudEvents plugin

TriggerMesh CloudEvents plugin for Kong opens the doors for HTTP requests into the systems that are using CloudEvent data format. The requests that are passing through the plugin are supplemented by the required headers to comply with CloudEvents specifications.

More technical details about external plugins development can be found here.

Configuration

Currently, the only parameter exposed in the plugin configuration is eventType. If this parameter is not set in the configuration, the default value of io.triggermesh.flow.kong-ce-plugin is used as the type of incoming events.

Deployment

This plugin is written in Golang as "embedded server" in accordance with the documentation.

As the plugin is still under development and it is not available in Kong Plugin Hub, deployment can be done by re-building Kong's Proxy with the plugin binary and configurations embedded in the image:

docker build -t <username>/kong . --platform linux/amd64

After the image is built, depending on the test environment, it can be pushed to the registry and used in the Kong Ingress deployment.

docker push <username>/kong

Let's assume that the Kong project is installed in the Kubernetes cluster:

kubectl -n kong set image deployment/ingress-kong proxy=<username>/kong@sha256:<hash>

Make sure that the new pod is up and running:

kubectl -n kong get pods
NAME                            READY   STATUS    RESTARTS   AGE
ingress-kong-59d4b75b87-xzjm9   2/2     Running   2          10m

Test

Since one of the platforms that are heavily utilizing CloudEvents data format is Knative, we will assume that the test cluster already has Serving and Eventing components installed. It should also be noted that Knative is not set to use Kong as its Ingress Gateway, although this configuration is possible and should simplify services usage.

  1. Deploy Sockeye service:

    kubectl apply -f config/sockeye.yaml
  2. Open config/kong.yaml and update the <namespace> value, make sure that url parameter points to Sockeye service

  3. Expose Kong's management API:

    kubectl -n kong port-forward deployment/ingress-kong 8444
  4. In the second console create the service:

    curl -k https://localhost:8444/config -F config=@config/kong.yml
  5. Open Sockeye's web interface and send POST request to Kong Ingress:

    KONG_ADDRESS=$(kubectl -n kong get svc kong-proxy -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
    
    curl -v $KONG_ADDRESS -d '{"hello":"CloudEvents"}' -H "Content-Type: application/json"

    *if $KONG_ADDRESS doesn't hold the right ingress address, retrieve the address manually.

The Sockeye service should display a new event generated by the plugin:

CloudEvent in Sockeye

Support

We would love your feedback on this plugin so don't hesitate to let us know what is wrong and how we could improve it, just file an issue

Code of Conduct

This plugin is by no means part of CNCF but we abide by its code of conduct

About

A Kong plugin to create CloudEvents from HTTP requests. These events can be used in a Knative cluster with the TriggerMesh integration platform.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published