#Knative - Functions

If you are using Knative as a provider, all functions inside the service are Knative Serving services.


All of the functions in your serverless service can be found in serverless.yml under the functions property.

service: my-service

  name: knative

# you can overwrite defaults here
#  stage: dev

  - serverless-knative

    handler: function-one.dockerfile
    context: ./code
    handler: gcr.io/knative-releases/github.com/knative/eventing-contrib/cmd/event_display:latest

The handler property points either to the Dockerfile which describes the container image which should be used as a Knative Serving service or to a container image on a remote Container Registry.

You might also want to specify the build context if you're using a Dockerfile as your handler configuration. You can do this with the context configuration. The build context will default to the current working directory if you're not specifying a context configuration.

You can specify an array of functions, which is useful if you separate your functions in to different files:

# serverless.yml
  - ${file(../foo-functions.yml)}
  - ${file(../bar-functions.yml)}
# foo-functions.yml
  handler: fooOne.dockerfile
  handler: fooTwo.dockerfile

Check out the Serverless Variables for all the details and options on how to make your configuration more dynamic.

Have questions?

Head over to the forums to search for your questions and issues or post a new one.