v0.13.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2020 License: Apache-2.0


Knative Eventing Operator

The following will install Knative Eventing and configure it appropriately for your cluster in the knative-eventing namespace:

kubectl apply -f deploy/crds/eventing_v1alpha1_knativeeventing_crd.yaml
kubectl apply -f deploy/

To be clear, the operator will be deployed in the default namespace, and then it will install Knative Eventing in the knative-eventing namespace.


Operator SDK

This operator was created using the operator-sdk. It's not strictly required but does provide some handy tooling.

The KnativeEventing Custom Resource

The installation of Knative Eventing is triggered by the creation of an KnativeEventing custom resource. When it starts, the operator will automatically create one of these in the knative-eventing namespace if it doesn't already exist.

The operator will ignore all other KnativeEventing resources. Only the one in the knative-eventing namespace will trigger the installation, reconfiguration, or removal of the knative eventing resources.

The following are all equivalent:

kubectl get -oyaml -n knative-eventing
kubectl get -oyaml -n knative-eventing knativeeventing
kubectl get -oyaml -n knative-eventing ke

To uninstall Knative Eventing, simply delete the KnativeEventing resource.

kubectl delete ke -n knative-eventing --all


It can be convenient to run the operator outside of the cluster to test changes. The following command will build the operator and use your current "kube config" to connect to the cluster:

operator-sdk up local --namespace=""

Pass --help for further details on the various operator-sdk subcommands, and pass --help to the operator itself to see its available options:

operator-sdk up local --operator-flags "--help"
Building the Operator Image

To build the operator,

operator-sdk build$REPO/knative-eventing-operator:$VERSION

The image should match what's in deploy/operator.yaml and the $VERSION should match version.go and correspond to the contents of deploy/resources.

There is a handy script that will build and push an image to and tag the source:


Operator Framework

The remaining sections only apply if you wish to create the metadata required by the Operator Lifecycle Manager

Create a ClusterServiceVersion

The OLM requires special manifests that the operator-sdk can help generate.

Create a ClusterServiceVersion for the version that corresponds to the manifest[s] beneath deploy/resources. The $PREVIOUS_VERSION is the CSV yours will replace.

operator-sdk olm-catalog gen-csv \
    --csv-version $VERSION \
    --from-version $PREVIOUS_VERSION \

Most values should carry over, but if you're starting from scratch, some post-editing of the file it generates may be required:

  • Add fields to address any warnings it reports
  • Verify description and displayName fields for all owned CRD's
Create a CatalogSource

The script should yield a valid ConfigMap and CatalogSource comprised of the ClusterServiceVersions, CustomResourceDefinitions, and package manifest in the bundle beneath deploy/olm-catalog. You should apply its output in the namespace where the other CatalogSources live on your cluster, e.g. openshift-marketplace:

CN_NS=$(kubectl get catalogsources --all-namespaces | tail -1 | awk '{print $1}')
./hack/ | kubectl apply -n $CN_NS -f -
Using OLM on Minikube

You can test the operator using minikube after installing OLM on it:

minikube start
kubectl apply -f
kubectl apply -f

Once all the pods in the olm namespace are running, install the operator like so:

./hack/ | kubectl apply -n $CN_NS -f -

Interacting with OLM is possible using kubectl but the OKD console is "friendlier". If you have docker installed, use this script to fire it up on http://localhost:9000.

Using kubectl

To install Knative Eventing into the knative-eventing namespace, simply subscribe to the operator by running this script:

CN_NS=$(kubectl get catalogsources --all-namespaces | tail -1 | awk '{print $1}')
OPERATOR_NS=$(kubectl get og --all-namespaces | grep global-operators | awk '{print $1}')
cat <<-EOF | kubectl apply -f -
kind: Subscription
  name: knative-eventing-operator-sub
  generateName: knative-eventing-operator-
  namespace: $OPERATOR_NS
  source: knative-eventing-operator
  sourceNamespace: $CN_NS
  name: knative-eventing-operator
  channel: alpha


Path Synopsis
Package v1alpha1 contains API Schema definitions for the eventing v1alpha1 API group +k8s:deepcopy-gen=package,register Package v1alpha1 contains API Schema definitions for the eventing v1alpha1 API group +k8s:deepcopy-gen=package,register
Package v1alpha1 contains API Schema definitions for the eventing v1alpha1 API group +k8s:deepcopy-gen=package,register Package v1alpha1 contains API Schema definitions for the eventing v1alpha1 API group +k8s:deepcopy-gen=package,register

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL