README

Knative Event Sources for Kyma

Overview

This component contains controllers and adapters for custom Knative sources.

Available event sources:

  • HTTPSource - used for applications emitting HTTP events.

Usage

Project setup

Before running the component, execute the following command once to pull software dependencies, apply mandatory patches, and compile all binaries:

$ make
Run the controller inside the cluster

To deploy the controller inside a cluster, make sure you have ko installed and configured according to the usage instructions, then run:

$ ko apply -f config/
Run the controller locally
Set up the environment

Follow these steps to set up the environment:

NOTE: You only need to do this once.

  1. Create the CustomResourceDefinitions for event source types:

    $ kubectl create -f config/ -l kyma-project.io/crd-install=true
    
  2. Create the kyma-system Namespace if it does not exist. The controller watches ConfigMaps inside it.

    $ kubectl create ns kyma-system
    
  3. Create ConfigMaps for logging and observability in the kyma-system Namespace.

    $ kubectl create -f config/400-config-logging.yaml
    $ kubectl create -f config/400-config-observability.yaml
    
Start the controller
  1. Export the following mandatory environment variables:

    • KUBECONFIG - path to a local kubeconfig file, if different from the default OS location.
    • HTTP_ADAPTER_IMAGE - container image of the HTTP adapter.
  2. Build the binary:

    $ make controller-manager
    
  3. Run the controller:

    $ ./controller-manager
    

Development

Custom types

The client code for custom API objects is generated using code generators. This includes native REST clients, listers and informers, as well as injection code for Knative.

The client code must be re-generated whenever the API for custom types (apis/.../types*.go) changes:

$ make codegen

For details, see Generate code section of the Kubernetes API changes guide.

Expand ▾ Collapse ▴

Directories

Path Synopsis
adapter
apis
sources/v1alpha1
Package v1alpha1 contains the definition of custom API objects.
Package v1alpha1 contains the definition of custom API objects.
client
generated/clientset/internalclientset
This package has the automatically generated clientset.
This package has the automatically generated clientset.
generated/clientset/internalclientset/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
generated/clientset/internalclientset/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
generated/clientset/internalclientset/typed/sources/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/internalclientset/typed/sources/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
cmd
reconciler
errors
Package errors contains custom error types and error utilities for reconcilers.
Package errors contains custom error types and error utilities for reconcilers.
httpsource
Package httpsource implements a controller for the HTTPSource custom resource.
Package httpsource implements a controller for the HTTPSource custom resource.
object
Package object contains utilities for creating and comparing API objects.
Package object contains utilities for creating and comparing API objects.