Publish an event source to your cluster
Start a minikube cluster:
minikube start
Setup
ko
to use the minikube docker instance and local registry:eval $(minikube docker-env)
export KO_DOCKER_REPO=ko.local
Apply the CRD and configuration YAML:
ko apply -f config
Once the
sample-source-controller-manager
is running in theknative-samples
namespace, you can apply theexample.yaml
to connect oursample-source
every10s
directly to aksvc
.apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: knative-samples
spec:
template:
spec:
containers:
- image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
---
apiVersion: samples.knative.dev/v1alpha1
kind: SampleSource
metadata:
name: sample-source
namespace: knative-samples
spec:
interval: "10s"
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
ko apply -f example.yaml
Once reconciled, you can confirm the
ksvc
is outputting valid cloudevents every10s
to align with our specified interval.% kubectl -n knative-samples logs -l serving.knative.dev/service=event-display -c user-container -f
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.sample
source: http://sample.knative.dev/heartbeat-source
id: d4619592-363e-4a41-82d1-b1586c390e24
time: 2019-12-17T01:31:10.795588888Z
datacontenttype: application/json
Data,
{
"Sequence": 0,
"Heartbeat": "10s"
}
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.sample
source: http://sample.knative.dev/heartbeat-source
id: db2edad0-06bc-4234-b9e1-7ea3955841d6
time: 2019-12-17T01:31:20.825969504Z
datacontenttype: application/json
Data,
{
"Sequence": 1,
"Heartbeat": "10s"
}