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.
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.
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
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.
-
Deploy Sockeye service:
kubectl apply -f config/sockeye.yaml
-
Open
config/kong.yaml
and update the<namespace>
value, make sure thaturl
parameter points to Sockeye service -
Expose Kong's management API:
kubectl -n kong port-forward deployment/ingress-kong 8444
-
In the second console create the service:
curl -k https://localhost:8444/config -F config=@config/kong.yml
-
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:
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
This plugin is by no means part of CNCF but we abide by its code of conduct