Generate the Scaffolding

To ease user on-boarding tm has a currently experimental feature to generate a scaffolding. To generate the scaffolding for a simple Python function do:

tm generate python

Currently it creates a directory named python, this will soon be customizable. Check the scaffolding:

tree python
└── serverless.yaml

Deploy the Function

To deploy the function you use a single command:

tm deploy -f python --wait

The --wait allows you to wait till all resources enter ready state. Shortly thereafter you will be presented with a URL for your function (i.e a Knative service):

$ tm deploy -f python --wait
Uploading "python" to demo-service-python-function-mcsgp-pod-6dfb31
Waiting for taskrun "demo-service-python-function-mcsgp" ready state
Creating "demo-service-python-function" service
Waiting for service "demo-service-python-function" ready state
Service demo-service-python-function URL:

You will be able to call it easily:

$ curl
{"message": "Hello, the current time is 07:51:46.853233"}

How Does This Work

While this seems straightforward there is a bit of magic being the scene. That's because the Python function being deployed does not have any invoker, it needs to be wrapped into a function runtime.

At TriggerMesh we have developed the Knative Lambda Runtime ( which can deploy an AWS Lambda function to a Knative cluster. We discussed it at length on the AWS blog.

With the scaffolding in place, the serverless.yaml manifest makes a reference to the KLR runtime:

service: demo-service
description: Sample knative service

  name: triggermesh
  registry: knative.registry.svc.cluster.local

    - HANDLER=handler.endpoint

In this runtime you will see a Task object that comes from the Tekton project. Hence in one command tm deploy we create a Task and execute it to build a container image that injects the function into our KLR AWS compatible runtime. This allows us to take an existing lambda function and deploy it to Knative in a Serverless framework manner.

Check the runtime URL to see how Tekton comes into play.

Tear Everything Down

Deleting everything is straightforward:

$ tm delete -f python
Deleting demo-service-python-function

We hope you enjoyed it, if you have any feedback on the use of tm or Knative and Tekton don't hesitate to leave us an issue or contact us at