remove old hugo static build for v0.21 (#4154)
Signed-off-by: Carlos Santana <csantana23@gmail.com>
|
@ -1,17 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Alternate Brokers</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/alternate/</link>
|
||||
<description>Recent content in Alternate Brokers on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/broker/alternate/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,502 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Broker</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/</link>
|
||||
<description>Recent content in Broker on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/broker/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Apache Kafka Broker</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/kafka-broker/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/broker/kafka-broker/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>The Apache Kafka Broker is a native Broker implementation, that reduces
|
||||
network hops, supports any Kafka version, and has a better integration
|
||||
with Apache Kafka for the Knative Broker and Trigger model.</p>
|
||||
<p>Notable features are:</p>
|
||||
<ul>
|
||||
<li>Control plane High Availability</li>
|
||||
<li>Horizontally scalable data plane</li>
|
||||
<li><a href="#kafka-producer-and-consumer-configurations">Extensively configurable</a></li>
|
||||
<li>Ordered delivery of events based on <a href="https://github.com/cloudevents/spec/blob/master/extensions/partitioning.md">CloudEvents partitioning extension</a></li>
|
||||
<li>Support any Kafka version, see <a href="https://cwiki.apache.org/confluence/display/KAFKA/Compatibility+Matrix">compatibility matrix</a></li>
|
||||
</ul>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<ol>
|
||||
<li><a href="../../../install/any-kubernetes-cluster#installing-the-eventing-component">Knative Eventing installation</a>.</li>
|
||||
<li>An Apache Kafka cluster (if you&rsquo;re just getting started you can follow <a href="https://strimzi.io/quickstarts/">Strimzi Quickstart page</a>).</li>
|
||||
</ol>
|
||||
<h2 id="installation">Installation</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Install the Kafka controller by entering the following command:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl apply --filename https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.21.0/eventing-kafka-controller.yaml
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Install the Kafka Broker data plane by entering the following command:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl apply --filename https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.21.0/eventing-kafka-broker.yaml
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Verify that <code>kafka-controller</code>, <code>kafka-broker-receiver</code> and <code>kafka-broker-dispatcher</code> are running,
|
||||
by entering the following command:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl get deployments.apps -n knative-eventing
|
||||
</code></pre></div><p>Example output:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
eventing-controller 1/1 <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span> 10s
|
||||
eventing-webhook 1/1 <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span> 9s
|
||||
kafka-controller 1/1 <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span> 3s
|
||||
kafka-broker-dispatcher 1/1 <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span> 4s
|
||||
kafka-broker-receiver 1/1 <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span> 5s
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h2 id="create-a-kafka-broker">Create a Kafka Broker</h2>
|
||||
<p>A Kafka Broker object looks like this:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">eventing.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Broker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># case-sensitive</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/broker.class</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Kafka</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration specific to this broker.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-broker-config</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Optional dead letter sink, you can specify either:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># - deadLetterSink.ref, which is a reference to a Callable</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># - deadLetterSink.uri, which is an absolute URI to a Callable (It can potentially be out of the Kubernetes cluster)</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">delivery</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">deadLetterSink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">dlq-service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p><code>spec.config</code> should reference any <code>ConfigMap</code> that looks like the following:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-broker-config</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Number of topic partitions</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default.topic.partitions</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;10&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Replication factor of topic messages.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default.topic.replication.factor</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;1&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># A comma separated list of bootstrap servers. (It can be in or out the k8s cluster)</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrap.servers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;my-cluster-kafka-bootstrap.kafka:9092&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>The above <code>ConfigMap</code> is installed in the cluster. You can edit
|
||||
the configuration or create a new one with the same values
|
||||
depending on your needs.</p>
|
||||
<p><strong>NOTE:</strong> The <code>default.topic.replication.factor</code> value must be less than or equal to the number of Kafka broker instances in your cluster. For example, if you only have one Kafka broker, the <code>default.topic.replication.factor</code> value should not be more than <code>1</code>.</p>
|
||||
<h2 id="set-as-default-broker-implementation">Set as default broker implementation</h2>
|
||||
<p>To set the Kafka broker as the default implementation for all brokers in the Knative deployment,
|
||||
you can apply global settings by modifying the <code>config-br-defaults</code> ConfigMap in the <code>knative-eventing</code> namespace.</p>
|
||||
<p>This allows you to avoid configuring individual or per-namespace settings for each broker,
|
||||
such as <code>metadata.annotations.eventing.knative.dev/broker.class</code> or <code>spec.config</code>.</p>
|
||||
<p>The following YAML is an example of a <code>config-br-defaults</code> ConfigMap using Kafka broker as the default implementation.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: Kafka
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: kafka-broker-config
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespaceDefaults:
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace1:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: Kafka
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: kafka-broker-config
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace2:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: Kafka
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: kafka-broker-config
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><h2 id="security">Security</h2>
|
||||
<p>Apache Kafka supports different security features, Knative supports the followings:</p>
|
||||
<ul>
|
||||
<li><a href="#authentication-using-sasl">Authentication using <code>SASL</code> without encryption</a></li>
|
||||
<li><a href="#authentication-using-sasl-and-encryption-using-ssl">Authentication using <code>SASL</code> and encryption using <code>SSL</code></a></li>
|
||||
<li><a href="#authentication-and-encryption-using-ssl">Authentication and encryption using <code>SSL</code></a></li>
|
||||
<li><a href="#encryption-using-ssl-without-client-authentication">Encryption using <code>SSL</code> without client authentication</a></li>
|
||||
</ul>
|
||||
<p>To enable security features, in the <code>ConfigMap</code> referenced by <code>broker.spec.config</code>, we can reference a <code>Secret</code>:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-broker-config</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Other configurations</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># ...</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Reference a Secret called my_secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">auth.secret.ref.name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">my_secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>The <code>Secret</code> <code>my_secret</code> must exist in the same namespace of the <code>ConfigMap</code> referenced by <code>broker.spec.config</code>,
|
||||
in this case: <code>knative-eventing</code>.</p>
|
||||
<p><em>Note: Certificates and keys must be in <a href="https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail"><code>PEM</code> format</a>.</em></p>
|
||||
<h3 id="authentication-using-sasl">Authentication using SASL</h3>
|
||||
<p>Knative supports the following SASL mechanisms:</p>
|
||||
<ul>
|
||||
<li><code>PLAIN</code></li>
|
||||
<li><code>SCRAM-SHA-256</code></li>
|
||||
<li><code>SCRAM-SHA-512</code></li>
|
||||
</ul>
|
||||
<p>To use a specific SASL mechanism replace <code>&lt;sasl_mechanism&gt;</code> with the mechanism of your choice.</p>
|
||||
<h3 id="authentication-using-sasl-without-encryption">Authentication using SASL without encryption</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl create secret --namespace &lt;namespace&gt; generic &lt;my_secret&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">protocol</span><span style="color:#ce5c00;font-weight:bold">=</span>SASL_PLAINTEXT <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span>sasl.mechanism<span style="color:#ce5c00;font-weight:bold">=</span>&lt;sasl_mechanism&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">user</span><span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_user&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">password</span><span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_password&gt;
|
||||
</code></pre></div><h3 id="authentication-using-sasl-and-encryption-using-ssl">Authentication using SASL and encryption using SSL</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl create secret --namespace &lt;namespace&gt; generic &lt;my_secret&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">protocol</span><span style="color:#ce5c00;font-weight:bold">=</span>SASL_SSL <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span>sasl.mechanism<span style="color:#ce5c00;font-weight:bold">=</span>&lt;sasl_mechanism&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-file<span style="color:#ce5c00;font-weight:bold">=</span>ca.crt<span style="color:#ce5c00;font-weight:bold">=</span>caroot.pem <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">user</span><span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_user&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">password</span><span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_password&gt;
|
||||
</code></pre></div><h3 id="encryption-using-ssl-without-client-authentication">Encryption using SSL without client authentication</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl create secret --namespace &lt;namespace&gt; generic &lt;my_secret&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">protocol</span><span style="color:#ce5c00;font-weight:bold">=</span>SSL <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-file<span style="color:#ce5c00;font-weight:bold">=</span>ca.crt<span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_caroot.pem_file_path&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span>user.skip<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87">true</span>
|
||||
</code></pre></div><h3 id="authentication-and-encryption-using-ssl">Authentication and encryption using SSL</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl create secret --namespace &lt;namespace&gt; generic &lt;my_secret&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-literal<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">protocol</span><span style="color:#ce5c00;font-weight:bold">=</span>SSL <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-file<span style="color:#ce5c00;font-weight:bold">=</span>ca.crt<span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_caroot.pem_file_path&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-file<span style="color:#ce5c00;font-weight:bold">=</span>user.crt<span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_cert.pem_file_path&gt; <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> --from-file<span style="color:#ce5c00;font-weight:bold">=</span>user.key<span style="color:#ce5c00;font-weight:bold">=</span>&lt;my_key.pem_file_path&gt;
|
||||
</code></pre></div><p><em>NOTE: <code>ca.crt</code> can be omitted to fallback to use system&rsquo;s root CA set.</em></p>
|
||||
<h2 id="kafka-producer-and-consumer-configurations">Kafka Producer and Consumer configurations</h2>
|
||||
<p>Knative exposes all available Kafka producer and consumer configurations that can be modified to suit your workloads.</p>
|
||||
<p>You can change these configurations by modifying the <code>config-kafka-broker-data-plane</code> <code>ConfigMap</code> in
|
||||
the <code>knative-eventing</code> namespace.</p>
|
||||
<p>Documentation for the settings available in this <code>ConfigMap</code> is available on the
|
||||
<a href="https://kafka.apache.org/documentation/">Apache Kafka website</a>,
|
||||
in particular, <a href="https://kafka.apache.org/documentation/#producerconfigs">Producer configurations</a>
|
||||
and <a href="https://kafka.apache.org/documentation/#consumerconfigs">Consumer configurations</a>.</p>
|
||||
<h2 id="enable-debug-logging-for-data-plane-components">Enable debug logging for data plane components</h2>
|
||||
<p>The following YAML shows the default logging configuration for data plane components, that is created during the
|
||||
installation step:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-config-logging</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">config.xml</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;configuration&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;appender name=&#34;jsonConsoleAppender&#34; class=&#34;ch.qos.logback.core.ConsoleAppender&#34;&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;encoder class=&#34;net.logstash.logback.encoder.LogstashEncoder&#34;/&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/appender&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;root level=&#34;INFO&#34;&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;appender-ref ref=&#34;jsonConsoleAppender&#34;/&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/root&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/configuration&gt;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>To change the logging level to <code>DEBUG</code>, you need to:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Apply the following <code>kafka-config-logging</code> <code>ConfigMap</code> or replace <code>level=&quot;INFO&quot;</code> with <code>level=&quot;DEBUG&quot;</code> to the
|
||||
<code>ConfigMap</code> <code>kafka-config-logging</code>:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-config-logging</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">config.xml</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;configuration&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;appender name=&#34;jsonConsoleAppender&#34; class=&#34;ch.qos.logback.core.ConsoleAppender&#34;&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;encoder class=&#34;net.logstash.logback.encoder.LogstashEncoder&#34;/&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/appender&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;root level=&#34;DEBUG&#34;&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;appender-ref ref=&#34;jsonConsoleAppender&#34;/&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/root&gt;
|
||||
</span><span style="color:#8f5902;font-style:italic"> &lt;/configuration&gt;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Restart the <code>kafka-broker-receiver</code> and the <code>kafka-broker-dispatcher</code>, by entering the following commands:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">kubectl rollout restart deployment -n knative-eventing kafka-broker-receiver
|
||||
kubectl rollout restart deployment -n knative-eventing kafka-broker-dispatcher
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h3 id="additional-information">Additional information</h3>
|
||||
<ul>
|
||||
<li>To report bugs or add feature requests, open an issue in the <a href="https://github.com/knative-sandbox/eventing-kafka-broker">eventing-kafka-broker repository</a>.</li>
|
||||
</ul>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Default Broker ConfigMap</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/config-br-defaults/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/broker/config-br-defaults/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p><strong>NOTE:</strong> This guide assumes Knative Eventing is installed in the <code>knative-eventing</code> namespace. If you have installed Knative Eventing in a different namespace, replace <code>default</code> with the name of that namespace.</p>
|
||||
<p>Knative Eventing provides a <code>config-br-defaults</code> ConfigMap, which provides default configuration settings to enable the creation of Brokers and Channels.</p>
|
||||
<p>If you are using the <code>config-br-defaults</code> ConfigMap default configuration, the example below will create a Broker called <code>default</code> in the default namespace, and uses <code>MTChannelBasedBroker</code> as the
|
||||
implementation.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f - <span style="color:#4e9a06">&lt;&lt;EOF
|
||||
</span><span style="color:#4e9a06">apiVersion: eventing.knative.dev/v1
|
||||
</span><span style="color:#4e9a06">kind: Broker
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: default
|
||||
</span><span style="color:#4e9a06"> namespace: default
|
||||
</span><span style="color:#4e9a06">EOF</span>
|
||||
</code></pre></div><p>The following example shows a Broker where the configuration is specified in a ConfigMap <code>config-br-default-channel</code>:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">eventing.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Broker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/broker.class</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">MTChannelBasedBroker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration specific to this broker.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-default-channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><h2 id="format-of-the-file">Format of the file</h2>
|
||||
<p>Let&rsquo;s look at the <code>ConfigMap</code> that comes out of the box when you install a
|
||||
release (v0.16.0 in this example):</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/release</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">devel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration for defaulting channels that do not specify CRD implementations.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: MTChannelBasedBroker
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: config-br-default-channel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>This means that any Broker created without a specific BrokerClass annotation
|
||||
will use <code>MTChannelBasedBroker</code>, and any Broker without a <code>spec.config</code>
|
||||
will have <code>spec.config</code> like so:</p>
|
||||
<pre><code>spec:
|
||||
config:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: config-br-default-channel
|
||||
namespace: knative-eventing
|
||||
</code></pre><h2 id="changing-the-default-brokerclass">Changing the default BrokerClass</h2>
|
||||
<h3 id="changing-the-default-brokerclass-for-the-cluster">Changing the default BrokerClass for the cluster</h3>
|
||||
<p>If you have installed a different Broker, or multiple, you can change the
|
||||
default Broker used at the cluster level and by namespace. If you for example
|
||||
have installed MT Channel Based Broker as well as <code>YourBroker</code> and would prefer
|
||||
that by default any Broker created uses <code>YourBroker</code> you could modify the
|
||||
<code>ConfigMap</code> to look like this:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/release</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">devel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration for defaulting channels that do not specify CRD implementations.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: YourBroker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Now every Broker created in the cluster without the BrokerClass annotation will
|
||||
be using <code>YourBroker</code> as the Broker implementation. Note that you can always use
|
||||
a different implementation by explicitly specifying the BrokerClass annotation
|
||||
when you create a Broker.</p>
|
||||
<h3 id="changing-the-default-brokerclass-for-namespaces">Changing the default BrokerClass for namespaces</h3>
|
||||
<p>As mentioned, you can also control the defaulting behaviour for some set of
|
||||
namespaces. So, if for example, you wanted to use <code>YourBroker</code> for all the other
|
||||
Brokers created, but wanted to use <code>MTChannelBasedBroker</code> for the following
|
||||
namespaces: <code>namespace1</code> and <code>namespace2</code>. You would modify the config map like
|
||||
this:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/release</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">devel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration for defaulting channels that do not specify CRD implementations.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: YourBroker
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespaceDefaults:
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace1:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: MTChannelBasedBroker
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace2:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: MTChannelBasedBroker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><h2 id="changing-the-default-configuration-of-the-broker">Changing the default configuration of the Broker</h2>
|
||||
<h3 id="changing-the-default-configuration-for-the-cluster">Changing the default configuration for the cluster</h3>
|
||||
<p>You can also control Broker configuration defaulting behaviour by specifying
|
||||
what gets defaulted into a broker.spec.config if left empty when being created.</p>
|
||||
<p>If you have installed a different Channel implementation (for example Kafka),
|
||||
and by default would like to use that for any Broker created you could change
|
||||
the ConfigMap to look like this:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/release</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">devel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration for defaulting channels that do not specify CRD implementations.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: MTChannelBasedBroker
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: config-kafka-channel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Now every Broker created in the cluster without spec.config will be configured
|
||||
to use <code>config-kafka-channel</code> <code>ConfigMap</code>. Note that you can always still
|
||||
explicitly specify a different configuration for any given Broker by specifying
|
||||
it in the <code>spec.config</code>.</p>
|
||||
<h3 id="changing-the-default-configuration-for-namespaces">Changing the default configuration for namespaces</h3>
|
||||
<p>As mentioned, you can also control the defaulting behaviour for some set of
|
||||
namespaces. So, if for example, you wanted to use <code>config-kafka-channel</code> for all
|
||||
the other Brokers created, but wanted to use <code>config-br-default-channel</code> config
|
||||
the following namespaces: <code>namespace3</code> and <code>namespace4</code>. You would modify the
|
||||
<code>ConfigMap</code> like this:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">config-br-defaults</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/release</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">devel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># Configuration for defaulting channels that do not specify CRD implementations.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-br-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> brokerClass: MTChannelBasedBroker
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: config-kafka-channel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespaceDefaults:
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace3:
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: config-br-default-channel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace4:
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: ConfigMap
|
||||
</span><span style="color:#8f5902;font-style:italic"> name: config-br-default-channel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespace: knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Note that we do not override the brokerClass for these namespaces. The
|
||||
brokerClass and config are independently configurable.</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Kafka Channel ConfigMap</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/kafka-configmap/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/broker/kafka-configmap/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p><strong>NOTE:</strong> This guide assumes Knative Eventing is installed in the <code>knative-eventing</code>
|
||||
namespace. If you have installed Knative Eventing in a different namespace, replace
|
||||
<code>knative-eventing</code> with the name of that namespace.</p>
|
||||
<p>To use Kafka channels, you must create a YAML file that specifies how these
|
||||
channels will be created.</p>
|
||||
<p><strong>NOTE:</strong> You must install the Kafka Channel first.</p>
|
||||
<p>You can copy the following sample code into your <code>kafka-channel</code> ConfigMap:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">channelTemplateSpec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: messaging.knative.dev/v1beta1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: KafkaChannel
|
||||
</span><span style="color:#8f5902;font-style:italic"> spec:
|
||||
</span><span style="color:#8f5902;font-style:italic"> numPartitions: 3
|
||||
</span><span style="color:#8f5902;font-style:italic"> replicationFactor: 1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p><strong>NOTE:</strong> This example specifies two extra parameters that are specific to Kafka
|
||||
Channels; <code>numPartitions</code> and <code>replicationFactor</code>.</p>
|
||||
<p>To create a Broker that uses the KafkaChannel, specify the <code>kafka-channel</code> ConfigMap:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f - <span style="color:#4e9a06">&lt;&lt;EOF
|
||||
</span><span style="color:#4e9a06">apiVersion: eventing.knative.dev/v1
|
||||
</span><span style="color:#4e9a06">kind: Broker
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> annotations:
|
||||
</span><span style="color:#4e9a06"> eventing.knative.dev/broker.class: MTChannelBasedBroker
|
||||
</span><span style="color:#4e9a06"> name: kafka-backed-broker
|
||||
</span><span style="color:#4e9a06"> namespace: default
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> config:
|
||||
</span><span style="color:#4e9a06"> apiVersion: v1
|
||||
</span><span style="color:#4e9a06"> kind: ConfigMap
|
||||
</span><span style="color:#4e9a06"> name: kafka-channel
|
||||
</span><span style="color:#4e9a06"> namespace: knative-eventing
|
||||
</span><span style="color:#4e9a06">EOF</span>
|
||||
</code></pre></div>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Alternate Brokers</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/broker/alternate/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/broker/alternate/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>In the Knative Eventing ecosystem, alternate Broker implementations are welcome as long as they
|
||||
respect the <a href="https://github.com/knative/eventing/blob/master/docs/spec/broker.md">Broker Conformance Spec</a>.</p>
|
||||
<p>Below is a list of brokers provided by the community or vendors in addition to the default broker
|
||||
implementations provided by Knative Eventing.</p>
|
||||
<h2 id="gcp-broker">GCP Broker</h2>
|
||||
<p>The GCP Broker is optimized for running in GCP. For more details, refer to the <a href="https://github.com/google/knative-gcp/blob/master/docs/install/install-gcp-broker.md">doc</a>.</p>
|
||||
<h2 id="apache-kafka-broker">Apache Kafka Broker</h2>
|
||||
<p>For information about the Apache Kafka broker, see <a href="../kafka-broker">link</a>.</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,32 +0,0 @@
|
|||
# List of available Channel implementation for persistence of the events associated with a given channel
|
||||
channels:
|
||||
- name: InMemoryChannel
|
||||
url: https://github.com/knative/eventing/tree/{{< branch >}}/config/channels/in-memory-channel/README.md
|
||||
status: Proof of Concept
|
||||
support: None
|
||||
description: >
|
||||
In-memory channels are a best effort Channel. They should NOT be used in Production. They are useful for development.
|
||||
- name: KafkaChannel
|
||||
url: https://github.com/knative-sandbox/eventing-kafka/tree/{{< branch >}}/pkg/channel/consolidated/README.md
|
||||
status: Proof of Concept
|
||||
support: None
|
||||
description: >
|
||||
Channels are backed by [Apache Kafka](http://kafka.apache.org/) topics.
|
||||
- name: NatssChannel
|
||||
url: https://github.com/knative-sandbox/eventing-natss/tree/{{< branch >}}/config/README.md
|
||||
status: Proof of Concept
|
||||
support: None
|
||||
description: >
|
||||
Channels are backed by [NATS Streaming](https://github.com/nats-io/nats-streaming-server#configuring).
|
||||
- name: GCP PubSub
|
||||
url: https://github.com/google/knative-gcp
|
||||
status: Proof of Concept
|
||||
support: None
|
||||
description: >
|
||||
Channels are backed by [GCP PubSub](https://cloud.google.com/pubsub/).
|
||||
- name: Knative sandbox channel that uses Confluent Go Client, and the librdkafka C library
|
||||
url: https://github.com/knative-sandbox/eventing-kafka
|
||||
status: Proof of Concept
|
||||
support: None
|
||||
description: >
|
||||
Kafka Channel implementation, contributed by SAP's Kyma project, is a Knative Eventing implementation of a Kafka backed channel which provides advanced functionality and production grade qualities as an alternative to what the eventing-contrib/kafka implementation offers.
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
title: "Available Channels"
|
||||
#linkTitle: "Channels"
|
||||
weight: 40
|
||||
type: "docs"
|
||||
---
|
||||
|
||||
{{ "" }}
|
||||
|
||||
{{- /* This will be interpreted given a yamlChannels object. */ -}}
|
||||
|
||||
{{- /* Ignore this next paragraph, it is only intended in the generated markdown, not here. */ -}}
|
||||
<!--
|
||||
This is a generated file and should not be changed manually. All changes should follow the
|
||||
procedure:
|
||||
|
||||
1. Update the information in [`channels.yaml`](channels.yaml).
|
||||
|
||||
2. Run the generator tool:
|
||||
```shell
|
||||
go run eventing/channels/generator/main.go
|
||||
```
|
||||
-->
|
||||
|
||||
This is a non-exhaustive list of the available Channels for Knative Eventing.
|
||||
|
||||
Notes:
|
||||
|
||||
* Inclusion in this list is not an endorsement, nor does it imply any level of
|
||||
support.
|
||||
|
||||
Name | Status | Support | Description
|
||||
--- | --- | --- | ---
|
||||
{{ range .Channels -}}
|
||||
[{{ .Name }}]({{ .Url }}) | {{ .Status }} | {{ .Support }} | {{ .Description }}
|
||||
{{- end }}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
Copyright 2019 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"text/template"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var (
|
||||
yamlFile = flag.String("yaml", "eventing/channels/channels.yaml", "The YAML file to parse to generate the mark down.")
|
||||
templateFile = flag.String("template", "eventing/channels/generator/ReadmeTemplate.gomd", "The template file to fill in.")
|
||||
mdFile = flag.String("md", "eventing/channels/channels-crds.md", "The mark down file to write to. Any existing file will be overwritten.")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
yamlChannels := parseYaml()
|
||||
tmpl := createTemplate()
|
||||
writeMarkdown(yamlChannels, tmpl)
|
||||
}
|
||||
|
||||
func parseYaml() *yamlChannels {
|
||||
fileBytes, err := ioutil.ReadFile(*yamlFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to read the YAML file '%s': %v", *yamlFile, err)
|
||||
}
|
||||
|
||||
channels := &yamlChannels{}
|
||||
err = yaml.UnmarshalStrict(fileBytes, channels)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to unmarshal the YAML file '%s': %v", *yamlFile, err)
|
||||
}
|
||||
|
||||
// Sort the three lists.
|
||||
sortAlphabetically(channels.Channels)
|
||||
|
||||
return channels
|
||||
}
|
||||
|
||||
func sortAlphabetically(slice []channel) {
|
||||
sortByName := func(i, j int) bool {
|
||||
return slice[i].Name < slice[j].Name
|
||||
}
|
||||
sort.SliceStable(slice, sortByName)
|
||||
}
|
||||
|
||||
type yamlChannels struct {
|
||||
Channels []channel `yaml:"channels"`
|
||||
}
|
||||
|
||||
type channel struct {
|
||||
Name string `yaml:"name"`
|
||||
Url string `yaml:"url"`
|
||||
Status string `yaml:"status"` // TODO Make this an enum.
|
||||
Support string `yaml:"support"`
|
||||
Description string `yaml:"description"`
|
||||
}
|
||||
|
||||
func createTemplate() *template.Template {
|
||||
fileBytes, err := ioutil.ReadFile(*templateFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to read the template file '%s': %v", *templateFile, err)
|
||||
}
|
||||
fileString := string(fileBytes)
|
||||
tmpl, err := template.New("markdown template").Parse(fileString)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to parse the template file '%s': %v", *templateFile, err)
|
||||
}
|
||||
return tmpl
|
||||
}
|
||||
|
||||
func writeMarkdown(yamlChannels *yamlChannels, tmpl *template.Template) {
|
||||
md, err := os.Create(*mdFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to create the markdown file '%s': %v", *mdFile, err)
|
||||
}
|
||||
defer md.Close()
|
||||
|
||||
err = tmpl.Execute(md, yamlChannels)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to execute the template: %v", err)
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 33 KiB |
|
@ -1,174 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Channels</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/channels/</link>
|
||||
<description>Recent content in Channels on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/channels/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Channel types and defaults</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/channels/channel-types-defaults/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/channels/channel-types-defaults/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>Knative provides the InMemoryChannel channel implementation by default. This default implementation is useful for developers who do not want to configure a specific implementation type, such as Apache Kafka or NATSS channels.</p>
|
||||
<p><strong>NOTE:</strong> InMemoryChannel channels should not be used in production environments.</p>
|
||||
<p>The default channel implementation is specified in the <code>default-ch-webhook</code> ConfigMap in the <code>knative-eventing</code> namespace.
|
||||
For more information about modifying ConfigMaps, see <a href="../docs/install/configuring-eventing-cr/">Configuring the Eventing Operator custom resource</a>.</p>
|
||||
<p>In the following example, the cluster default channel implementation is InMemoryChannel, while the namespace default channel implementation for the <code>example-namespace</code> is KafkaChannel.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ConfigMap</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default-ch-webhook</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-eventing</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">default-ch-config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> clusterDefault:
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: messaging.knative.dev/v1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: InMemoryChannel
|
||||
</span><span style="color:#8f5902;font-style:italic"> namespaceDefaults:
|
||||
</span><span style="color:#8f5902;font-style:italic"> example-namespace:
|
||||
</span><span style="color:#8f5902;font-style:italic"> apiVersion: messaging.knative.dev/v1beta1
|
||||
</span><span style="color:#8f5902;font-style:italic"> kind: KafkaChannel
|
||||
</span><span style="color:#8f5902;font-style:italic"> spec:
|
||||
</span><span style="color:#8f5902;font-style:italic"> numPartitions: 2
|
||||
</span><span style="color:#8f5902;font-style:italic"> replicationFactor: 1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Default channels can be configured for the cluster, a namespace on the cluster, or both.</p>
|
||||
<p><strong>NOTE:</strong> If a default channel implementation is configured for a namespace, this will overwrite the configuration for the cluster.</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Creating a channel using cluster or namespace defaults</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/channels/create-default-channel/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/channels/create-default-channel/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>Developers can create channels of any supported implementation type by creating an instance of a Channel object.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create a Channel object:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">messaging.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">my-channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Since this object is created in the <code>default</code> namespace, according to the default ConfigMap example in the previous section, it will be an InMemoryChannel channel implementation.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<!--TODO: Add tabs for kn etc-->
|
||||
<ol start="2">
|
||||
<li>
|
||||
<p>After the Channel object is created, a mutating admission webhook sets the
|
||||
<code>spec.channelTemplate</code> based on the default channel implementation:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">messaging.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">my-channel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">channelTemplate</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">messaging.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">InMemoryChannel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p><strong>NOTE:</strong> The <code>spec.channelTemplate</code> property cannot be changed after creation, since it is set by the default channel mechanism, not the user.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The channel controller creates a backing channel instance
|
||||
based on the <code>spec.channelTemplate</code>.</p>
|
||||
<p>When this mechanism is used, two objects are created, a generic Channel object, and an InMemoryChannel object. The generic object acts as a proxy for the InMemoryChannel object, by copying its subscriptions to and setting its status to that of the InMemoryChannel object.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p><strong>NOTE:</strong> Defaults only apply on object creation. Defaults are applied by the webhook only on Channel or Sequence creation. If the default settings change, the new defaults will only apply to newly-created channels, brokers, or sequences. Existing ones will not change.</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Available Channels</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/channels/channels-crds/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/channels/channels-crds/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<!--
|
||||
This is a generated file and should not be changed manually. All changes should follow the
|
||||
procedure:
|
||||
|
||||
1. Update the information in [`channels.yaml`](channels.yaml).
|
||||
|
||||
2. Run the generator tool:
|
||||
```shell
|
||||
go run eventing/channels/generator/main.go
|
||||
```
|
||||
-->
|
||||
<p>This is a non-exhaustive list of the available Channels for Knative Eventing.</p>
|
||||
<p>Notes:</p>
|
||||
<ul>
|
||||
<li>Inclusion in this list is not an endorsement, nor does it imply any level of
|
||||
support.</li>
|
||||
</ul>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Support</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://github.com/google/knative-gcp">GCP PubSub</a></td>
|
||||
<td>Proof of Concept</td>
|
||||
<td>None</td>
|
||||
<td>Channels are backed by <a href="https://cloud.google.com/pubsub/">GCP PubSub</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://github.com/knative/eventing/tree/release-0.21/config/channels/in-memory-channel/README.md">InMemoryChannel</a></td>
|
||||
<td>Proof of Concept</td>
|
||||
<td>None</td>
|
||||
<td>In-memory channels are a best effort Channel. They should NOT be used in Production. They are useful for development.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://github.com/knative-sandbox/eventing-kafka/tree/release-0.21/pkg/channel/consolidated/README.md">KafkaChannel - Consolidated</a></td>
|
||||
<td>Proof of Concept</td>
|
||||
<td>None</td>
|
||||
<td>Channels are backed by <a href="http://kafka.apache.org/">Apache Kafka</a> topics. The original Knative KafkaChannel implementation which utilizes a single combined Kafka Producer / Consumer deployment.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://github.com/knative-sandbox/eventing-kafka/tree/release-0.21/pkg/channel/distributed/README.md">KafkaChannel - Distributed</a></td>
|
||||
<td>Proof of Concept</td>
|
||||
<td>None</td>
|
||||
<td>Channels are backed by <a href="http://kafka.apache.org/">Apache Kafka</a> topics. An alternate KafkaChannel implementation, contributed by SAP&rsquo;s <a href="https://kyma-project.io/">Kyma</a> project, which provides a more granular deployment of Producers / Consumers.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://github.com/knative-sandbox/eventing-natss/tree/release-0.21/config/README.md">NatssChannel</a></td>
|
||||
<td>Proof of Concept</td>
|
||||
<td>None</td>
|
||||
<td>Channels are backed by <a href="https://github.com/nats-io/nats-streaming-server#configuring">NATS Streaming</a>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1 +0,0 @@
|
|||
<!DOCTYPE html><html><head><title>https://knative.dev/v0.21-docs/eventing/samples/ping-source/</title><link rel="canonical" href="https://knative.dev/v0.21-docs/eventing/samples/ping-source/"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url=https://knative.dev/v0.21-docs/eventing/samples/ping-source/" /></head></html>
|
|
@ -1,610 +0,0 @@
|
|||
[
|
||||
{
|
||||
"duration": 19629,
|
||||
"id": "d48b4d96bb46c90f",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "cfb0c6b6b6104c7b",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "200",
|
||||
"http.url": "http://transformer.includes-incoming-trace-id-2qszn.svc.cluster.local/",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371922002,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 1700,
|
||||
"id": "eb4e31d92bc59aa4",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.12.23",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "c6b6bb23406d262b",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-kne-trigger-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local/",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371972214,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371971464,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 2667,
|
||||
"id": "c6b6bb23406d262b",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.12.23",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "b4c0ea8c8dcca58c",
|
||||
"tags": {
|
||||
"http.host": "br-broker.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371971443,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371920838,
|
||||
"value": "Received 79 bytes"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371941945,
|
||||
"value": "Sent 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 21519,
|
||||
"id": "cfb0c6b6b6104c7b",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "5b25cd8f149589c0",
|
||||
"tags": {
|
||||
"http.host": "br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371920446,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371974164,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 23878,
|
||||
"id": "d966d475c07c46a4",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "cf78241d2df4b9b0",
|
||||
"tags": {
|
||||
"http.host": "br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371974140,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 42942,
|
||||
"id": "5b25cd8f149589c0",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "1d42e9223b858118",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371900088,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371957188,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 398,
|
||||
"id": "76dd0620b4bc9de4",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "d7eb9469c7b49910",
|
||||
"tags": {
|
||||
"http.host": "br-kne-ingress-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371957174,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 14477,
|
||||
"id": "d7eb9469c7b49910",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"parentId": "1d42e9223b858118",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-kne-ingress-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371943313,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 14773,
|
||||
"id": "b4c0ea8c8dcca58c",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "76dd0620b4bc9de4",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker.includes-incoming-trace-id-2qszn.svc.cluster.local/",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371959548,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371860719,
|
||||
"value": "GetConn"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371860796,
|
||||
"value": "DNSStart"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371879299,
|
||||
"value": "DNSDone"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371879313,
|
||||
"value": "ConnectStart"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371881319,
|
||||
"value": "ConnectDone"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371881372,
|
||||
"value": "GotConn"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371881488,
|
||||
"value": "WroteHeaders"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371881495,
|
||||
"value": "WroteRequest"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371900479,
|
||||
"value": "GotFirstResponseByte"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371900571,
|
||||
"value": "PutIdleConn"
|
||||
}
|
||||
],
|
||||
"duration": 40002,
|
||||
"id": "1616272c1fcedd5b",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.28.6.176",
|
||||
"port": 80,
|
||||
"serviceName": "sender"
|
||||
},
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371860637,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 17206,
|
||||
"id": "a11e466e5415b2b1",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.12.23",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "7c86d0b868bd3d38",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-kne-trigger-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local/",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371882715,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371899323,
|
||||
"value": "Received 79 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 319,
|
||||
"id": "1d42e9223b858118",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "a11e466e5415b2b1",
|
||||
"tags": {
|
||||
"http.host": "br-kne-trigger-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371899306,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 21505,
|
||||
"id": "9908b1fceda49168",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "1d42e9223b858118",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371900749,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371972653,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 425,
|
||||
"id": "53b25c437ad4a960",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "eb4e31d92bc59aa4",
|
||||
"tags": {
|
||||
"http.host": "br-kne-trigger-kn-channel.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371972631,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 27202,
|
||||
"id": "cf78241d2df4b9b0",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "53b25c437ad4a960",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371973561,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371992370,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 4860,
|
||||
"id": "9fd1516ec8487f29",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.28.5.249",
|
||||
"port": 80,
|
||||
"serviceName": "logger"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "e31ce234cae840cd",
|
||||
"tags": {
|
||||
"http.host": "logger.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371992328,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371881923,
|
||||
"value": "Received 79 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 18198,
|
||||
"id": "7c86d0b868bd3d38",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.12.23",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "1616272c1fcedd5b",
|
||||
"tags": {
|
||||
"http.host": "br-broker.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371881868,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371940689,
|
||||
"value": "Received 79 bytes"
|
||||
},
|
||||
{
|
||||
"timestamp": 1571264371941061,
|
||||
"value": "Sent 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 487,
|
||||
"id": "ec377f2b219848d6",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.28.0.226",
|
||||
"port": 80,
|
||||
"serviceName": "transformer"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "d48b4d96bb46c90f",
|
||||
"tags": {
|
||||
"http.host": "transformer.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "200",
|
||||
"http.url": "/",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371940634,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 2608,
|
||||
"id": "3087b26640ecb5dc",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.1.43",
|
||||
"port": 80,
|
||||
"serviceName": "imc-dispatcher"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "53b25c437ad4a960",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371973526,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371920415,
|
||||
"value": "Received 79 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 1335,
|
||||
"id": "cad53fd7b1dacee6",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "9908b1fceda49168",
|
||||
"tags": {
|
||||
"http.host": "br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/triggers/includes-incoming-trace-id-2qszn/logger/f8804e2a-f062-11e9-8de0-42010a800086",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371920397,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"annotations": [
|
||||
{
|
||||
"timestamp": 1571264371974165,
|
||||
"value": "Received 89 bytes"
|
||||
}
|
||||
],
|
||||
"duration": 1476,
|
||||
"id": "de415b55c5b2c338",
|
||||
"kind": "SERVER",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"parentId": "3087b26640ecb5dc",
|
||||
"tags": {
|
||||
"http.host": "br-broker-filter.includes-incoming-trace-id-2qszn.svc.cluster.local",
|
||||
"http.method": "POST",
|
||||
"http.path": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.status_code": "202",
|
||||
"http.url": "/triggers/includes-incoming-trace-id-2qszn/transformer/f89da9fb-f062-11e9-8de0-42010a800086",
|
||||
"http.user_agent": "Go-http-client/1.1",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371974140,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
},
|
||||
{
|
||||
"duration": 23207,
|
||||
"id": "e31ce234cae840cd",
|
||||
"kind": "CLIENT",
|
||||
"localEndpoint": {
|
||||
"ipv4": "10.32.2.177",
|
||||
"port": 80,
|
||||
"serviceName": "br-broker-filter.includes-incoming-trace-id-2qszn"
|
||||
},
|
||||
"name": "/",
|
||||
"parentId": "d966d475c07c46a4",
|
||||
"tags": {
|
||||
"http.host": "",
|
||||
"http.method": "POST",
|
||||
"http.path": "/",
|
||||
"http.status_code": "202",
|
||||
"http.url": "http://logger.includes-incoming-trace-id-2qszn.svc.cluster.local/",
|
||||
"opencensus.status_description": "OK"
|
||||
},
|
||||
"timestamp": 1571264371974586,
|
||||
"traceId": "ee46c4c6be1df717b3b82f55b531912f"
|
||||
}
|
||||
]
|
Before Width: | Height: | Size: 14 KiB |
|
@ -1,153 +0,0 @@
|
|||
# This is a simple example that creates a source and sends events to a function.
|
||||
|
||||
# The namespace the example lives in.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: knative-debug
|
||||
|
||||
---
|
||||
|
||||
# The event source.
|
||||
|
||||
apiVersion: sources.knative.dev/v1alpha1
|
||||
kind: ApiServerSource
|
||||
metadata:
|
||||
name: src
|
||||
namespace: knative-debug
|
||||
spec:
|
||||
serviceAccountName: service-account
|
||||
mode: Resource
|
||||
resources:
|
||||
- apiVersion: v1
|
||||
kind: Event
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: messaging.knative.dev/v1
|
||||
kind: InMemoryChannel
|
||||
name: chan
|
||||
|
||||
---
|
||||
|
||||
# The Channel events are sent to.
|
||||
|
||||
apiVersion: messaging.knative.dev/v1
|
||||
kind: InMemoryChannel
|
||||
metadata:
|
||||
name: chan
|
||||
namespace: knative-debug
|
||||
---
|
||||
|
||||
# The Subscription to the InMemoryChannel.
|
||||
|
||||
apiVersion: messaging.knative.dev/v1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: sub
|
||||
namespace: knative-debug
|
||||
spec:
|
||||
channel:
|
||||
apiVersion: messaging.knative.dev/v1
|
||||
kind: InMemoryChannel
|
||||
name: chan
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
name: svc
|
||||
|
||||
---
|
||||
|
||||
# K8s Service which points at the Deployment below.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc
|
||||
namespace: knative-debug
|
||||
spec:
|
||||
selector:
|
||||
app: fn
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
|
||||
---
|
||||
|
||||
# K8s Deployment that simply writes input requests to its log.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fn
|
||||
namespace: knative-debug
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fn
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fn
|
||||
spec:
|
||||
containers:
|
||||
- name: user-container
|
||||
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
|
||||
# Everything after this is just structure for the above.
|
||||
|
||||
---
|
||||
|
||||
# K8s Service Account that runs `src`'s container.
|
||||
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: service-account
|
||||
namespace: knative-debug
|
||||
|
||||
---
|
||||
|
||||
# The permissions that `src` needs.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: event-watcher
|
||||
namespace: knative-debug
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
|
||||
---
|
||||
|
||||
# Give `src`'s service account the necessary permissions.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: k8s-ra-event-watcher
|
||||
namespace: knative-debug
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: event-watcher
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: service-account
|
||||
namespace: knative-debug
|
|
@ -1,145 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Eventing Flows</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/flows/</link>
|
||||
<description>Recent content in Eventing Flows on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/flows/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Parallel</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/flows/parallel/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/flows/parallel/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>Parallel CRD provides a way to easily define a list of branches, each receiving
|
||||
the same CloudEvent sent to the Parallel ingress channel. Typically, each branch
|
||||
consists of a filter function guarding the execution of the branch.</p>
|
||||
<p>Parallel creates <code>Channel</code>s and <code>Subscription</code>s under the hood.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<h3 id="parallel-spec">Parallel Spec</h3>
|
||||
<p>Parallel has three parts for the Spec:</p>
|
||||
<ol>
|
||||
<li><code>branches</code> defines the list of <code>filter</code> and <code>subscriber</code> pairs, one per branch,
|
||||
and optionally a <code>reply</code> object. For each branch:
|
||||
<ol>
|
||||
<li>(optional) the <code>filter</code> is evaluated and when it returns an event the <code>subscriber</code> is
|
||||
executed. Both <code>filter</code> and <code>subscriber</code> must be <code>Addressable</code>.</li>
|
||||
<li>the event returned by the <code>subscriber</code> is sent to the branch <code>reply</code>
|
||||
object. When the <code>reply</code> is empty, the event is sent to the <code>spec.reply</code>
|
||||
object (see below).</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>(optional) <code>channelTemplate</code> defines the Template which will be used to
|
||||
create <code>Channel</code>s.</li>
|
||||
<li>(optional) <code>reply</code> defines where the result of each branch is sent to when
|
||||
the branch does not have its own <code>reply</code> object.</li>
|
||||
</ol>
|
||||
<h3 id="parallel-status">Parallel Status</h3>
|
||||
<p>Parallel has three parts for the Status:</p>
|
||||
<ol>
|
||||
<li><code>conditions</code> which details the overall status of the Parallel object</li>
|
||||
<li><code>ingressChannelStatus</code> and <code>branchesStatuses</code> which convey the status of
|
||||
underlying <code>Channel</code> and <code>Subscription</code> resource that are created as part of
|
||||
this Parallel.</li>
|
||||
<li><code>address</code> which is exposed so that Parallel can be used where Addressable can
|
||||
be used. Sending to this address will target the <code>Channel</code> which is fronting
|
||||
this Parallel (same as <code>ingressChannelStatus</code>).</li>
|
||||
</ol>
|
||||
<h2 id="examples">Examples</h2>
|
||||
<p>Learn how to use Parallel by following the <a href="../../samples/parallel/index.html">examples</a></p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Sequence</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/flows/sequence/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/flows/sequence/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>Sequence CRD provides a way to define an in-order list of functions that will be
|
||||
invoked. Each step can modify, filter or create a new kind of an event. Sequence
|
||||
creates <code>Channel</code>s and <code>Subscription</code>s under the hood.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<h3 id="sequence-spec">Sequence Spec</h3>
|
||||
<p>Sequence has three parts for the Spec:</p>
|
||||
<ol>
|
||||
<li><code>Steps</code> which defines the in-order list of <code>Subscriber</code>s, aka, which
|
||||
functions are executed in the listed order. These are specified using the
|
||||
<code>messaging.v1.SubscriberSpec</code> just like you would when creating
|
||||
<code>Subscription</code>. Each step should be <code>Addressable</code>.</li>
|
||||
<li><code>ChannelTemplate</code> defines the Template which will be used to create
|
||||
<code>Channel</code>s between the steps.</li>
|
||||
<li><code>Reply</code> (Optional) Reference to where the results of the final step in the
|
||||
sequence are sent to.</li>
|
||||
</ol>
|
||||
<h3 id="sequence-status">Sequence Status</h3>
|
||||
<p>Sequence has four parts for the Status:</p>
|
||||
<ol>
|
||||
<li>Conditions which detail the overall Status of the Sequence object</li>
|
||||
<li>ChannelStatuses which convey the Status of underlying <code>Channel</code> resources
|
||||
that are created as part of this Sequence. It is an array and each Status
|
||||
corresponds to the Step number, so the first entry in the array is the Status
|
||||
of the <code>Channel</code> before the first Step.</li>
|
||||
<li>SubscriptionStatuses which convey the Status of underlying <code>Subscription</code>
|
||||
resources that are created as part of this Sequence. It is an array and each
|
||||
Status corresponds to the Step number, so the first entry in the array is the
|
||||
<code>Subscription</code> which is created to wire the first channel to the first step
|
||||
in the <code>Steps</code> array.</li>
|
||||
<li>AddressStatus which is exposed so that Sequence can be used where Addressable
|
||||
can be used. Sending to this address will target the <code>Channel</code> which is
|
||||
fronting the first Step in the Sequence.</li>
|
||||
</ol>
|
||||
<h2 id="examples">Examples</h2>
|
||||
<p>For each of these examples below, we&rsquo;ll use
|
||||
<a href="https://knative.dev/docs/eventing/samples/ping-source/"><code>PingSource</code></a> as
|
||||
the source of events.</p>
|
||||
<p>We also use a very simple
|
||||
<a href="https://github.com/vaikas-google/transformer">transformer</a> which performs very
|
||||
trivial transformation of the incoming events to demonstrate they have passed
|
||||
through each stage.</p>
|
||||
<h3 id="sequence-with-no-reply-terminal-last-stepsamplessequencesequence-terminalindexhtml"><a href="../../samples/sequence/sequence-terminal/index.html">Sequence with no reply (terminal last Step)</a></h3>
|
||||
<p>For the first example, we&rsquo;ll use a 3 Step <code>Sequence</code> that is wired directly into
|
||||
the <code>PingSource</code>. Each of the steps simply tacks on &ldquo;- Handled by
|
||||
<STEP NUMBER>&rdquo;, for example the first Step in the <code>Sequence</code> will take the
|
||||
incoming message and append &ldquo;- Handled by 0&rdquo; to the incoming message.</p>
|
||||
<h3 id="sequence-with-reply-last-step-produces-outputsamplessequencesequence-reply-to-event-displayindexhtml"><a href="../../samples/sequence/sequence-reply-to-event-display/index.html">Sequence with reply (last Step produces output)</a></h3>
|
||||
<p>For the next example, we&rsquo;ll use the same 3 Step <code>Sequence</code> that is wired
|
||||
directly into the <code>PingSource</code>. Each of the steps simply tacks on &ldquo;- Handled
|
||||
by <STEP NUMBER>&rdquo;, for example the first Step in the <code>Sequence</code> will take the
|
||||
incoming message and append &ldquo;- Handled by 0&rdquo; to the incoming message.</p>
|
||||
<p>The only difference is that we&rsquo;ll use the <code>Subscriber.Spec.Reply</code> field to wire
|
||||
the output of the last Step to an event display pod.</p>
|
||||
<h3 id="chaining-sequences-togethersamplessequencesequence-reply-to-sequenceindexhtml"><a href="../../samples/sequence/sequence-reply-to-sequence/index.html">Chaining Sequences together</a></h3>
|
||||
<p>For the next example, we&rsquo;ll use the same 3 Step <code>Sequence</code> that is wired
|
||||
directly into the <code>PingSource</code>. Each of the steps simply tacks on &ldquo;- Handled
|
||||
by <STEP NUMBER>&rdquo;, for example the first Step in the <code>Sequence</code> will take the
|
||||
incoming message and append &ldquo;- Handled by 0&rdquo; to the incoming message.</p>
|
||||
<p>The only difference is that we&rsquo;ll use the <code>Subscriber.Spec.Reply</code> field to wire
|
||||
the output of the last Step to another <code>Sequence</code> that does the same message
|
||||
modifications as the first pipeline (with different steps however).</p>
|
||||
<h3 id="using-sequence-with-brokertrigger-modelsamplessequencesequence-with-broker-triggerindexhtml"><a href="../../samples/sequence/sequence-with-broker-trigger/index.html">Using Sequence with Broker/Trigger model</a></h3>
|
||||
<p>You can also create a Trigger which targets <code>Sequence</code>. This time we&rsquo;ll wire
|
||||
<code>PingSource</code> to send events to a <code>Broker</code> and then we&rsquo;ll have the <code>Sequence</code>
|
||||
emit the resulting Events back into the Broker so that the results of the
|
||||
<code>Sequence</code> can be observed by other <code>Trigger</code>s.</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
Before Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 36 KiB |
|
@ -1,24 +0,0 @@
|
|||
apiVersion: sources.knative.dev/v1
|
||||
kind: ContainerSource
|
||||
metadata:
|
||||
name: test-heartbeats
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
# This corresponds to a heartbeats image uri you build and publish,
|
||||
# e.g. gcr.io/[gcloud-project]/knative.dev/eventing-contrib/cmd/heartbeats
|
||||
- image: knative.dev/eventing-contrib/cmd/heartbeats
|
||||
name: heartbeats
|
||||
args:
|
||||
- --period=1
|
||||
env:
|
||||
- name: POD_NAME
|
||||
value: "mypod"
|
||||
- name: POD_NAMESPACE
|
||||
value: "event-test"
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: event-display
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2019 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,23 +0,0 @@
|
|||
apiVersion: sources.knative.dev/v1alpha1
|
||||
kind: GitHubSource
|
||||
metadata:
|
||||
name: githubsourcesample
|
||||
spec:
|
||||
eventTypes:
|
||||
- pull_request
|
||||
ownerAndRepository: <YOUR USER>/<YOUR REPO>
|
||||
accessToken:
|
||||
secretKeyRef:
|
||||
name: githubsecret
|
||||
key: accessToken
|
||||
secretToken:
|
||||
secretKeyRef:
|
||||
name: githubsecret
|
||||
key: secretToken
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: github-message-dumper
|
||||
# To use GitHub Enterprise you would need to add an entry for your githubAPIURL similar to the example below
|
||||
# githubAPIURL: "https://github.mycompany.com/api/v3/"
|
|
@ -1,8 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: githubsecret
|
||||
type: Opaque
|
||||
stringData:
|
||||
accessToken: <YOUR PERSONAL ACCESS TOKEN FROM GITHUB>
|
||||
secretToken: <YOUR RANDOM STRING>
|
Before Width: | Height: | Size: 59 KiB |
|
@ -1,10 +0,0 @@
|
|||
# This is a very simple Knative Service that writes the input request to its log.
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: github-message-dumper
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
Before Width: | Height: | Size: 20 KiB |
|
@ -1,30 +0,0 @@
|
|||
# Use the official Golang image to create a build artifact.
|
||||
# This is based on Debian and sets the GOPATH to /go.
|
||||
# https://hub.docker.com/_/golang
|
||||
FROM golang:1.14 as builder
|
||||
|
||||
# Copy local code to the container image.
|
||||
WORKDIR /app
|
||||
|
||||
# Retrieve application dependencies using go modules.
|
||||
# Allows container builds to reuse downloaded dependencies.
|
||||
COPY go.* ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy local code to the container image.
|
||||
COPY . ./
|
||||
|
||||
# Build the binary.
|
||||
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o helloworld
|
||||
|
||||
# Use a Docker multi-stage build to create a lean production image.
|
||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||
FROM alpine:3
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
# Copy the binary to the production image from the builder stage.
|
||||
COPY --from=builder /app/helloworld /helloworld
|
||||
|
||||
# Run the web service on container startup.
|
||||
CMD ["/helloworld"]
|
|
@ -1,13 +0,0 @@
|
|||
package main
|
||||
|
||||
// HelloWorld defines the Data of CloudEvent with type=dev.knative.samples.helloworld
|
||||
type HelloWorld struct {
|
||||
// Msg holds the message from the event
|
||||
Msg string `json:"msg,omitempty"`
|
||||
}
|
||||
|
||||
// HiFromKnative defines the Data of CloudEvent with type=dev.knative.samples.hifromknative
|
||||
type HiFromKnative struct {
|
||||
// Msg holds the message from the event
|
||||
Msg string `json:"msg,omitempty"`
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
module knative.dev/docs/docs/eventing/samples/helloworld/helloworld-go
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/cloudevents/sdk-go/v2 v2.0.0-RC2
|
||||
github.com/google/uuid v1.1.1
|
||||
)
|
|
@ -1,276 +0,0 @@
|
|||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.40.0/go.mod h1:Tk58MuI9rbLMKlAjeO/bDnteAx7tX2gJIXw4T5Jwlro=
|
||||
contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA=
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
|
||||
github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
github.com/Azure/go-amqp v0.12.7/go.mod h1:qApuH6OFTSKZFmCOxccvAv5rLizBQf4v8pRmG138DPo=
|
||||
github.com/Azure/go-autorest/autorest v0.2.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E=
|
||||
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc=
|
||||
github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8=
|
||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
|
||||
github.com/aslakhellesoy/gox v1.0.100/go.mod h1:AJl542QsKKG96COVsv0N74HHzVQgDIQPceVUh1aeU2M=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudevents/sdk-go v1.1.2 h1:mg/7d+BzubBPrPpH1bdeF85BQZYV85j7Ljqat3+m+qE=
|
||||
github.com/cloudevents/sdk-go v1.1.2/go.mod h1:ss+jWJ88wypiewnPEzChSBzTYXGpdcILoN9YHk8uhTQ=
|
||||
github.com/cloudevents/sdk-go v1.2.0 h1:2AxI14EJUw1PclJ5gZJtzbxnHIfNMdi76Qq3P3G1BRU=
|
||||
github.com/cloudevents/sdk-go/v2 v2.0.0-RC2 h1:XXqj/WXjOWhxUR8/+Ovn5YtSuIE83uOD6Gy3vUnBdUQ=
|
||||
github.com/cloudevents/sdk-go/v2 v2.0.0-RC2/go.mod h1:f6d2RzSysHwhr4EsysDapUIWyJOFKqIhDisATXEa6Wk=
|
||||
github.com/cloudevents/sdk-go/v2 v2.0.0-preview8 h1:9CdwLDStqSoPxCkpnJQT0npptb8GjYcFtdELAQpXgqU=
|
||||
github.com/cloudevents/sdk-go/v2 v2.0.0-preview8/go.mod h1:akZr/joO3DfDft2KZnI91LEs15NSKIBNPYcAMBQ1xbk=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cucumber/gherkin-go/v11 v11.0.0/go.mod h1:CX33k2XU2qog4e+TFjOValoq6mIUq0DmVccZs238R9w=
|
||||
github.com/cucumber/godog v0.9.0/go.mod h1:roWCHkpeK6UTOyIRRl7IR+fgfBeZ4vZR7OSq2J/NbM4=
|
||||
github.com/cucumber/messages-go/v10 v10.0.1/go.mod h1:kA5T38CBlBbYLU12TIrJ4fk4wSkVVOgyh7Enyy8WnSg=
|
||||
github.com/cucumber/messages-go/v10 v10.0.3/go.mod h1:9jMZ2Y8ZxjLY6TG2+x344nt5rXstVVDYSdS5ySfI1WY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
|
||||
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac h1:+2b6iGRJe3hvV/yVXrd41yVEjxuFHxasJqDhkIjS4gk=
|
||||
github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac/go.mod h1:Frd2bnT3w5FB5q49ENTfVlztJES+1k/7lyWX2+9gq/M=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
|
||||
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
|
||||
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
|
||||
github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg=
|
||||
github.com/nats-io/nats-streaming-server v0.17.0/go.mod h1:ewPBEsmp62Znl3dcRsYtlcfwudxHEdYMtYqUQSt4fE0=
|
||||
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
|
||||
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nats-io/stan.go v0.6.0/go.mod h1:eIcD5bi3pqbHT/xIIvXMwvzXYElgouBvaVRftaE+eac=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
pack.ag/amqp v0.11.0/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
|
@ -1,45 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
cloudevents "github.com/cloudevents/sdk-go/v2"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func receive(ctx context.Context, event cloudevents.Event) (*cloudevents.Event, cloudevents.Result) {
|
||||
// Here is where your code to process the event will go.
|
||||
// In this example we will log the event msg
|
||||
log.Printf("Event received. \n%s\n", event)
|
||||
data := &HelloWorld{}
|
||||
if err := event.DataAs(data); err != nil {
|
||||
log.Printf("Error while extracting cloudevent Data: %s\n", err.Error())
|
||||
return nil, cloudevents.NewHTTPResult(400, "failed to convert data: %s", err)
|
||||
}
|
||||
log.Printf("Hello World Message from received event %q", data.Msg)
|
||||
|
||||
// Respond with another event (optional)
|
||||
// This is optional and is intended to show how to respond back with another event after processing.
|
||||
// The response will go back into the knative eventing system just like any other event
|
||||
newEvent := cloudevents.NewEvent()
|
||||
// Setting the ID here is not necessary. When using NewDefaultClient the ID is set
|
||||
// automatically. We set the ID anyway so it appears in the log below.
|
||||
newEvent.SetID(uuid.New().String())
|
||||
newEvent.SetSource("knative/eventing/samples/hello-world")
|
||||
newEvent.SetType("dev.knative.samples.hifromknative")
|
||||
if err := newEvent.SetData(cloudevents.ApplicationJSON, HiFromKnative{Msg: "Hi from helloworld-go app!"}); err != nil {
|
||||
return nil, cloudevents.NewHTTPResult(500, "failed to set response data: %s", err)
|
||||
}
|
||||
log.Printf("Responding with event\n%s\n", newEvent)
|
||||
return &newEvent, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.Print("Hello world sample started.")
|
||||
c, err := cloudevents.NewDefaultClient()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client, %v", err)
|
||||
}
|
||||
log.Fatal(c.StartReceiver(context.Background(), receive))
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Hello World - Golang</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-go/</link>
|
||||
<description>Recent content in Hello World - Golang on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-go/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,66 +0,0 @@
|
|||
# Namespace for sample application
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: knative-samples
|
||||
---
|
||||
# A default broker
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Broker
|
||||
metadata:
|
||||
name: default
|
||||
namespace: knative-samples
|
||||
spec: {}
|
||||
---
|
||||
# Helloworld-go app deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: helloworld-go
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels: &labels
|
||||
app: helloworld-go
|
||||
template:
|
||||
metadata:
|
||||
labels: *labels
|
||||
spec:
|
||||
containers:
|
||||
- name: helloworld-go
|
||||
image: docker.io/{username}/helloworld-go
|
||||
---
|
||||
# Service that exposes helloworld-go app.
|
||||
# This will be the subscriber for the Trigger
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helloworld-go
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
selector:
|
||||
app: helloworld-go
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
---
|
||||
# Knative Eventing Trigger to trigger the helloworld-go service
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Trigger
|
||||
metadata:
|
||||
name: helloworld-go
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
broker: default
|
||||
filter:
|
||||
attributes:
|
||||
type: dev.knative.samples.helloworld
|
||||
source: dev.knative.samples/helloworldsource
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
name: helloworld-go
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
FROM python:alpine3.7
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT [ "python" ]
|
||||
|
||||
CMD [ "helloworld.py" ]
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
from flask import Flask, request, make_response
|
||||
import uuid
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
def hello_world():
|
||||
app.logger.warning(request.data)
|
||||
# Respond with another event (optional)
|
||||
response = make_response({
|
||||
"msg": "Hi from helloworld-python app!"
|
||||
})
|
||||
response.headers["Ce-Id"] = str(uuid.uuid4())
|
||||
response.headers["Ce-specversion"] = "0.3"
|
||||
response.headers["Ce-Source"] = "knative/eventing/samples/hello-world"
|
||||
response.headers["Ce-Type"] = "dev.knative.samples.hifromknative"
|
||||
return response
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0', port=8080)
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Hello World - Python</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-python/</link>
|
||||
<description>Recent content in Hello World - Python on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-python/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1 +0,0 @@
|
|||
Flask==1.1.1
|
|
@ -1,61 +0,0 @@
|
|||
# Namespace for sample application with eventing enabled
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: knative-samples
|
||||
labels:
|
||||
eventing.knative.dev/injection: enabled
|
||||
---
|
||||
# Helloworld-go app deploment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: helloworld-python
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels: &labels
|
||||
app: helloworld-python
|
||||
template:
|
||||
metadata:
|
||||
labels: *labels
|
||||
spec:
|
||||
containers:
|
||||
- name: helloworld-python
|
||||
image: docker.io/axsauze/helloworld-python
|
||||
imagePullPolicy: IfNotPresent
|
||||
---
|
||||
# Service that exposes helloworld-go app.
|
||||
# This will be the subscriber for the Trigger
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helloworld-python
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
selector:
|
||||
app: helloworld-python
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
---
|
||||
# Knative Eventing Trigger to trigger the helloworld-go service
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Trigger
|
||||
metadata:
|
||||
name: helloworld-python
|
||||
namespace: knative-samples
|
||||
spec:
|
||||
broker: default
|
||||
filter:
|
||||
attributes:
|
||||
type: dev.knative.samples.helloworld
|
||||
source: dev.knative.samples/helloworldsource
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
name: helloworld-python
|
||||
|
|
@ -1,763 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Knative Eventing - Hello World app</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/helloworld/</link>
|
||||
<description>Recent content in Knative Eventing - Hello World app on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/helloworld/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Hello World - Golang</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-go/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-go/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>A simple web app written in Go that you can use to test knative eventing. It
|
||||
shows how to consume a <a href="https://cloudevents.io/">CloudEvent</a> in Knative
|
||||
eventing, and optionally how to respond back with another CloudEvent in the http
|
||||
response, using the
|
||||
<a href="https://github.com/cloudevents/sdk-go">Go SDK for CloudEvents</a></p>
|
||||
<p>We will deploy the app as a
|
||||
<a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">Kubernetes Deployment</a>
|
||||
along with a
|
||||
<a href="https://kubernetes.io/docs/concepts/services-networking/service/">Kubernetes Service</a>.
|
||||
However, you can also deploy the app as a
|
||||
<a href="../../../../serving/index.html">Knative Serving Service</a>.</p>
|
||||
<p>Follow the steps below to create the sample code and then deploy the app to your
|
||||
cluster. You can also download a working copy of the sample, by running the
|
||||
following commands:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">git clone -b <span style="color:#4e9a06">&#34;{{&lt; branch &gt;}}&#34;</span> https://github.com/knative/docs knative-docs
|
||||
<span style="color:#204a87">cd</span> knative-docs/docs/eventing/samples/helloworld/helloworld-go
|
||||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||||
<ul>
|
||||
<li>A Kubernetes cluster with
|
||||
<a href="../../../getting-started#installing-knative-eventing">Knative Eventing</a>
|
||||
installed.</li>
|
||||
<li><a href="https://www.docker.com">Docker</a> installed and running on your local machine,
|
||||
and a Docker Hub account configured (we&rsquo;ll use it for a container registry).</li>
|
||||
</ul>
|
||||
<h2 id="recreating-the-sample-code">Recreating the sample code</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create a new file named <code>helloworld.go</code> and paste the following code. This
|
||||
code creates a basic web server which listens on port 8080:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"> <span style="color:#204a87;font-weight:bold">import</span> <span style="color:#000;font-weight:bold">(</span>
|
||||
<span style="color:#4e9a06">&#34;context&#34;</span>
|
||||
<span style="color:#4e9a06">&#34;log&#34;</span>
|
||||
|
||||
<span style="color:#000">cloudevents</span> <span style="color:#4e9a06">&#34;github.com/cloudevents/sdk-go/v2&#34;</span>
|
||||
<span style="color:#4e9a06">&#34;github.com/google/uuid&#34;</span>
|
||||
<span style="color:#000;font-weight:bold">)</span>
|
||||
|
||||
<span style="color:#204a87;font-weight:bold">func</span> <span style="color:#000">receive</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">ctx</span> <span style="color:#000">context</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Context</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">event</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Event</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">(</span><span style="color:#ce5c00;font-weight:bold">*</span><span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Event</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Result</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#8f5902;font-style:italic">// Here is where your code to process the event will go.
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// In this example we will log the event msg
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Printf</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;Event received. \n%s\n&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">event</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000">data</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#ce5c00;font-weight:bold">&amp;</span><span style="color:#000">HelloWorld</span><span style="color:#000;font-weight:bold">{}</span>
|
||||
<span style="color:#204a87;font-weight:bold">if</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">event</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">DataAs</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">data</span><span style="color:#000;font-weight:bold">);</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">!=</span> <span style="color:#204a87;font-weight:bold">nil</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Printf</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;Error while extracting cloudevent Data: %s\n&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">err</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Error</span><span style="color:#000;font-weight:bold">())</span>
|
||||
<span style="color:#204a87;font-weight:bold">return</span> <span style="color:#204a87;font-weight:bold">nil</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">NewHTTPResult</span><span style="color:#000;font-weight:bold">(</span><span style="color:#0000cf;font-weight:bold">400</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#4e9a06">&#34;failed to convert data: %s&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">err</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Printf</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;Hello World Message from received event %q&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">data</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Msg</span><span style="color:#000;font-weight:bold">)</span>
|
||||
|
||||
<span style="color:#8f5902;font-style:italic">// Respond with another event (optional)
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// This is optional and is intended to show how to respond back with another event after processing.
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// The response will go back into the knative eventing system just like any other event
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#000">newEvent</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">NewEvent</span><span style="color:#000;font-weight:bold">()</span>
|
||||
<span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">SetID</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">uuid</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">New</span><span style="color:#000;font-weight:bold">().</span><span style="color:#000">String</span><span style="color:#000;font-weight:bold">())</span>
|
||||
<span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">SetSource</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;knative/eventing/samples/hello-world&#34;</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">SetType</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;dev.knative.samples.hifromknative&#34;</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#204a87;font-weight:bold">if</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">SetData</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">ApplicationJSON</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">HiFromKnative</span><span style="color:#000;font-weight:bold">{</span><span style="color:#000">Msg</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;Hi from helloworld-go app!&#34;</span><span style="color:#000;font-weight:bold">});</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">!=</span> <span style="color:#204a87;font-weight:bold">nil</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#204a87;font-weight:bold">return</span> <span style="color:#204a87;font-weight:bold">nil</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">NewHTTPResult</span><span style="color:#000;font-weight:bold">(</span><span style="color:#0000cf;font-weight:bold">500</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#4e9a06">&#34;failed to set response data: %s&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">err</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Printf</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;Responding with event\n%s\n&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#204a87;font-weight:bold">return</span> <span style="color:#ce5c00;font-weight:bold">&amp;</span><span style="color:#000">newEvent</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#204a87;font-weight:bold">nil</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
|
||||
<span style="color:#204a87;font-weight:bold">func</span> <span style="color:#000">main</span><span style="color:#000;font-weight:bold">()</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Print</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;Hello world sample started.&#34;</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000">c</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">cloudevents</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">NewDefaultClient</span><span style="color:#000;font-weight:bold">()</span>
|
||||
<span style="color:#204a87;font-weight:bold">if</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">!=</span> <span style="color:#204a87;font-weight:bold">nil</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Fatalf</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;failed to create client, %v&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">err</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
<span style="color:#000">log</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Fatal</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">c</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">StartReceiver</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">context</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Background</span><span style="color:#000;font-weight:bold">(),</span> <span style="color:#000">receive</span><span style="color:#000;font-weight:bold">))</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Create a new file named <code>eventschemas.go</code> and paste the following code. This
|
||||
defines the data schema of the CloudEvents.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"> <span style="color:#204a87;font-weight:bold">package</span> <span style="color:#000">main</span>
|
||||
|
||||
<span style="color:#8f5902;font-style:italic">// HelloWorld defines the Data of CloudEvent with type=dev.knative.samples.helloworld
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#204a87;font-weight:bold">type</span> <span style="color:#000">HelloWorld</span> <span style="color:#204a87;font-weight:bold">struct</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#8f5902;font-style:italic">// Msg holds the message from the event
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#000">Msg</span> <span style="color:#204a87;font-weight:bold">string</span> <span style="color:#4e9a06">`json:&#34;msg,omitempty,string&#34;`</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
|
||||
<span style="color:#8f5902;font-style:italic">// HiFromKnative defines the Data of CloudEvent with type=dev.knative.samples.hifromknative
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#204a87;font-weight:bold">type</span> <span style="color:#000">HiFromKnative</span> <span style="color:#204a87;font-weight:bold">struct</span> <span style="color:#000;font-weight:bold">{</span>
|
||||
<span style="color:#8f5902;font-style:italic">// Msg holds the message from the event
|
||||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#000">Msg</span> <span style="color:#204a87;font-weight:bold">string</span> <span style="color:#4e9a06">`json:&#34;msg,omitempty,string&#34;`</span>
|
||||
<span style="color:#000;font-weight:bold">}</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>In your project directory, create a file named <code>Dockerfile</code> and copy the code
|
||||
block below into it. For detailed instructions on dockerizing a Go app, see
|
||||
<a href="https://blog.golang.org/docker">Deploying Go servers with Docker</a>.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-docker" data-lang="docker"> <span style="color:#8f5902;font-style:italic"># Use the official Golang image to create a build artifact.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># This is based on Debian and sets the GOPATH to /go.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># https://hub.docker.com/_/golang</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> FROM golang:1.14 as builder<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Copy local code to the container image.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> WORKDIR /app<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Retrieve application dependencies using go modules.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Allows container builds to reuse downloaded dependencies.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> COPY go.* ./<span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> RUN go mod download<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Copy local code to the container image.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> COPY . ./<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Build the binary.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># -mod=readonly ensures immutable go.mod and go.sum in container builds.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> RUN <span style="color:#000">CGO_ENABLED</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">0</span> <span style="color:#000">GOOS</span><span style="color:#ce5c00;font-weight:bold">=</span>linux go build -mod<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87">readonly</span> -v -o helloworld<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Use a Docker multi-stage build to create a lean production image.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> FROM alpine:3<span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> RUN apk add --no-cache ca-certificates<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Copy the binary to the production image from the builder stage.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> COPY --from<span style="color:#ce5c00;font-weight:bold">=</span>builder /app/helloworld /helloworld<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> <span style="color:#8f5902;font-style:italic"># Run the web service on container startup.</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span> CMD <span style="color:#ce5c00;font-weight:bold">[</span><span style="color:#4e9a06">&#34;/helloworld&#34;</span><span style="color:#ce5c00;font-weight:bold">]</span><span style="color:#a40000">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Create a new file, <code>sample-app.yaml</code> and copy the following service
|
||||
definition into the file. Make sure to replace <code>{username}</code> with your Docker
|
||||
Hub username.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># Namespace for sample application</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Namespace</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># A default broker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">eventing.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Broker</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>{}<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Helloworld-go app deploment</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">apps/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Deployment</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">replicas</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">matchLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">&amp;labels</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">*labels</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">docker.io/{username}/helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Service that exposes helloworld-go app.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># This will be the subscriber for the Trigger</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ports</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">protocol</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TCP</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">port</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">80</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">targetPort</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">8080</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Knative Eventing Trigger to trigger the helloworld-go service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">eventing.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Trigger</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">broker</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">attributes</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">type</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">dev.knative.samples.helloworld</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">source</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">dev.knative.samples/helloworldsource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Use the go tool to create a
|
||||
<a href="https://github.com/golang/go/wiki/Modules#gomod"><code>go.mod</code></a> manifest.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">go mod init github.com/knative/docs/docs/serving/samples/hello-world/helloworld-go
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h2 id="building-and-deploying-the-sample">Building and deploying the sample</h2>
|
||||
<p>Once you have recreated the sample code files (or used the files in the sample
|
||||
folder) you&rsquo;re ready to build and deploy the sample app.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Use Docker to build the sample code into a container. To build and push with
|
||||
Docker Hub, run these commands replacing <code>{username}</code> with your Docker Hub
|
||||
username:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#8f5902;font-style:italic"># Build the container on your local machine</span>
|
||||
docker build -t <span style="color:#ce5c00;font-weight:bold">{</span>username<span style="color:#ce5c00;font-weight:bold">}</span>/helloworld-go .
|
||||
|
||||
<span style="color:#8f5902;font-style:italic"># Push the container to docker registry</span>
|
||||
docker push <span style="color:#ce5c00;font-weight:bold">{</span>username<span style="color:#ce5c00;font-weight:bold">}</span>/helloworld-go
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>After the build has completed and the container is pushed to docker hub, you
|
||||
can deploy the sample application into your cluster. Ensure that the
|
||||
container image value in <code>sample-app.yaml</code> matches the container you built in
|
||||
the previous step. Apply the configuration using <code>kubectl</code>:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl apply --filename sample-app.yaml
|
||||
</code></pre></div><ol>
|
||||
<li>
|
||||
<p>Above command created a namespace <code>knative-samples</code> and create a default
|
||||
Broker it. Verify using the following command:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get broker --namespace knative-samples
|
||||
</code></pre></div><p><em>Note</em>: you can also use injection based on labels with the
|
||||
<a href="../../../../install/any-kubernetes-cluster">Eventing Sugar Controller</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It deployed the helloworld-go app as a K8s Deployment and created a K8s
|
||||
service names helloworld-go. Verify using the following command.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples get deployments helloworld-go
|
||||
|
||||
kubectl --namespace knative-samples get svc helloworld-go
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>It created a Knative Eventing Trigger to route certain events to the
|
||||
helloworld-go application. Make sure that Ready=true</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples get trigger helloworld-go
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
<h2 id="send-and-verify-cloudevents">Send and verify CloudEvents</h2>
|
||||
<p>Once you have deployed the application and verified that the namespace, sample
|
||||
application and trigger are ready, let&rsquo;s send a CloudEvent.</p>
|
||||
<h3 id="send-cloudevent-to-the-broker">Send CloudEvent to the Broker</h3>
|
||||
<p>We can send an http request directly to the <a href="../../../broker/README.md">Broker</a>
|
||||
with correct CloudEvent headers set.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Deploy a curl pod and SSH into it</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples run curl --image<span style="color:#ce5c00;font-weight:bold">=</span>radial/busyboxplus:curl -it
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Get the Broker URL</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples get broker default
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Run the following in the SSH terminal. Please replace the URL with the URL of
|
||||
the default broker.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">curl -v <span style="color:#4e9a06">&#34;http://broker-ingress.knative-eventing.svc.cluster.local/knative-samples/default&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -X POST <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;Ce-Specversion: 1.0&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;Ce-Type: dev.knative.samples.helloworld&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;Ce-Source: dev.knative.samples/helloworldsource&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;Content-Type: application/json&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;msg&#34;:&#34;Hello World from the curl pod.&#34;}&#39;</span>
|
||||
|
||||
<span style="color:#204a87">exit</span>
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h3 id="verify-that-event-is-received-by-helloworld-go-app">Verify that event is received by helloworld-go app</h3>
|
||||
<p>Helloworld-go app logs the context and the msg of the above event, and replies
|
||||
back with another event.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Display helloworld-go app logs</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples logs -l <span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">=</span>helloworld-go --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">50</span>
|
||||
</code></pre></div><p>You should see something similar to:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">Event received.
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.samples.helloworld
|
||||
source: dev.knative.samples/helloworldsource
|
||||
id: 536808d3-88be-4077-9d7a-a3f162705f79
|
||||
time: 2019-10-04T22:35:26.05871736Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
knativearrivaltime: 2019-10-04T22:35:26Z
|
||||
knativehistory: default-kn2-trigger-kn-channel.knative-samples.svc.cluster.local
|
||||
traceparent: 00-971d4644229653483d38c46e92a959c7-92c66312e4bb39be-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;msg&#34;</span>:<span style="color:#4e9a06">&#34;Hello World from the curl pod.&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
|
||||
Hello World Message <span style="color:#4e9a06">&#34;Hello World from the curl pod.&#34;</span>
|
||||
Responded with event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.samples.hifromknative
|
||||
source: knative/eventing/samples/hello-world
|
||||
id: 37458d77-01f5-411e-a243-a459bbf79682
|
||||
datacontenttype: application/json
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;msg&#34;</span>:<span style="color:#4e9a06">&#34;Hi from Knative!&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
|
||||
</code></pre></div><p>Play around with the CloudEvent attributes in the curl command and the
|
||||
trigger specification to understand how
|
||||
<a href="../../../broker/index.html#trigger">Triggers work</a>.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h2 id="verify-reply-from-helloworld-go-app">Verify reply from helloworld-go app</h2>
|
||||
<p><code>helloworld-go</code> app replies back with an event of
|
||||
<code>type= dev.knative.samples.hifromknative</code>, and
|
||||
<code>source=knative/eventing/samples/hello-world</code>. This event enters the eventing
|
||||
mesh via the Broker and can be delivered to other services using a Trigger</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Deploy a pod that receives any CloudEvent and logs the event to its output.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples apply --filename - <span style="color:#4e9a06">&lt;&lt; END
|
||||
</span><span style="color:#4e9a06"># event-display app deploment
|
||||
</span><span style="color:#4e9a06">apiVersion: apps/v1
|
||||
</span><span style="color:#4e9a06">kind: Deployment
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> replicas: 1
|
||||
</span><span style="color:#4e9a06"> selector:
|
||||
</span><span style="color:#4e9a06"> matchLabels: &amp;labels
|
||||
</span><span style="color:#4e9a06"> app: event-display
|
||||
</span><span style="color:#4e9a06"> template:
|
||||
</span><span style="color:#4e9a06"> metadata:
|
||||
</span><span style="color:#4e9a06"> labels: *labels
|
||||
</span><span style="color:#4e9a06"> spec:
|
||||
</span><span style="color:#4e9a06"> containers:
|
||||
</span><span style="color:#4e9a06"> - name: helloworld-go
|
||||
</span><span style="color:#4e9a06"> # Source code: https://github.com/knative/eventing-contrib/tree/master/cmd/event_display
|
||||
</span><span style="color:#4e9a06"> image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
||||
</span><span style="color:#4e9a06">---
|
||||
</span><span style="color:#4e9a06"># Service that exposes event-display app.
|
||||
</span><span style="color:#4e9a06"># This will be the subscriber for the Trigger
|
||||
</span><span style="color:#4e9a06">kind: Service
|
||||
</span><span style="color:#4e9a06">apiVersion: v1
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> selector:
|
||||
</span><span style="color:#4e9a06"> app: event-display
|
||||
</span><span style="color:#4e9a06"> ports:
|
||||
</span><span style="color:#4e9a06"> - protocol: TCP
|
||||
</span><span style="color:#4e9a06"> port: 80
|
||||
</span><span style="color:#4e9a06"> targetPort: 8080
|
||||
</span><span style="color:#4e9a06">END</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Create a trigger to deliver the event to the above service</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples apply --filename - <span style="color:#4e9a06">&lt;&lt; END
|
||||
</span><span style="color:#4e9a06">apiVersion: eventing.knative.dev/v1
|
||||
</span><span style="color:#4e9a06">kind: Trigger
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> broker: default
|
||||
</span><span style="color:#4e9a06"> filter:
|
||||
</span><span style="color:#4e9a06"> attributes:
|
||||
</span><span style="color:#4e9a06"> type: dev.knative.samples.hifromknative
|
||||
</span><span style="color:#4e9a06"> source: knative/eventing/samples/hello-world
|
||||
</span><span style="color:#4e9a06"> subscriber:
|
||||
</span><span style="color:#4e9a06"> ref:
|
||||
</span><span style="color:#4e9a06"> apiVersion: v1
|
||||
</span><span style="color:#4e9a06"> kind: Service
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06">END</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p><a href="###Send-CloudEvent-to-the-Broker">Send a CloudEvent to the Broker</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Check the logs of event-display service</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples logs -l <span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">=</span>event-display --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">50</span>
|
||||
</code></pre></div><p>You should see something similar to:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"> cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.samples.hifromknative
|
||||
source: knative/eventing/samples/hello-world
|
||||
id: 8a7384b9-8bbe-4634-bf0f-ead07e450b2a
|
||||
time: 2019-10-04T22:53:39.844943931Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
knativearrivaltime: 2019-10-04T22:53:39Z
|
||||
knativehistory: default-kn2-ingress-kn-channel.knative-samples.svc.cluster.local
|
||||
traceparent: 00-4b01db030b9ea04bb150b77c8fa86509-2740816590a7604f-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;msg&#34;</span>: <span style="color:#4e9a06">&#34;Hi from helloworld-go app!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<p><strong>Note: You could use the above approach to test your applications too.</strong></p>
|
||||
<h2 id="removing-the-sample-app-deployment">Removing the sample app deployment</h2>
|
||||
<p>To remove the sample app from your cluster, delete the service record:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete --filename sample-app.yaml
|
||||
</code></pre></div>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Hello World - Python</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-python/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/helloworld/helloworld-python/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>A simple web app written in Python that you can use to test knative eventing. It shows how to consume a <a href="https://cloudevents.io/">CloudEvent</a> in Knative eventing, and optionally how to respond back with another CloudEvent in the http response, by adding the Cloud Eventing headers outlined in the Cloud Events standard definition.</p>
|
||||
<p>We will deploy the app as a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">Kubernetes Deployment</a> along with a <a href="https://kubernetes.io/docs/concepts/services-networking/service/">Kubernetes Service</a>.
|
||||
However, you can also deploy the app as a <a href="../../../../serving/index.html">Knative Serving Service</a>.</p>
|
||||
<p>Follow the steps below to create the sample code and then deploy the app to your
|
||||
cluster. You can also download a working copy of the sample, by running the
|
||||
following commands:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#8f5902;font-style:italic"># Clone the relevant branch version such as &#34;release-0.13&#34;</span>
|
||||
git clone -b <span style="color:#4e9a06">&#34;{{&lt; branch &gt;}}&#34;</span> https://github.com/knative/docs knative-docs
|
||||
<span style="color:#204a87">cd</span> knative-docs/docs/eventing/samples/helloworld/helloworld-python
|
||||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||||
<ul>
|
||||
<li>A Kubernetes cluster with <a href="../../../getting-started#installing-knative-eventing">Knative Eventing</a> installed.</li>
|
||||
<li><a href="https://www.docker.com">Docker</a> installed and running on your local machine,
|
||||
and a Docker Hub account configured (we&rsquo;ll use it for a container registry).</li>
|
||||
</ul>
|
||||
<h2 id="recreating-the-sample-code">Recreating the sample code</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create a new file named <code>helloworld.py</code> and paste the following code. This
|
||||
code creates a basic web server which listens on port 8080:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#204a87;font-weight:bold">from</span> <span style="color:#000">flask</span> <span style="color:#204a87;font-weight:bold">import</span> <span style="color:#000">Flask</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">request</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">make_response</span>
|
||||
<span style="color:#204a87;font-weight:bold">import</span> <span style="color:#000">uuid</span>
|
||||
|
||||
<span style="color:#000">app</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#000">Flask</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">__name__</span><span style="color:#000;font-weight:bold">)</span>
|
||||
|
||||
<span style="color:#5c35cc;font-weight:bold">@app.route</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#39;/&#39;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">methods</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#39;POST&#39;</span><span style="color:#000;font-weight:bold">])</span>
|
||||
<span style="color:#204a87;font-weight:bold">def</span> <span style="color:#000">hello_world</span><span style="color:#000;font-weight:bold">():</span>
|
||||
<span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">logger</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">warning</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">request</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">data</span><span style="color:#000;font-weight:bold">)</span>
|
||||
<span style="color:#8f5902;font-style:italic"># Respond with another event (optional)</span>
|
||||
<span style="color:#000">response</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#000">make_response</span><span style="color:#000;font-weight:bold">({</span>
|
||||
<span style="color:#4e9a06">&#34;msg&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;Hi from helloworld-python app!&#34;</span>
|
||||
<span style="color:#000;font-weight:bold">})</span>
|
||||
<span style="color:#000">response</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">headers</span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#34;Ce-Id&#34;</span><span style="color:#000;font-weight:bold">]</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#204a87">str</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">uuid</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">uuid4</span><span style="color:#000;font-weight:bold">())</span>
|
||||
<span style="color:#000">response</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">headers</span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#34;Ce-specversion&#34;</span><span style="color:#000;font-weight:bold">]</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#4e9a06">&#34;0.3&#34;</span>
|
||||
<span style="color:#000">response</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">headers</span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#34;Ce-Source&#34;</span><span style="color:#000;font-weight:bold">]</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#4e9a06">&#34;knative/eventing/samples/hello-world&#34;</span>
|
||||
<span style="color:#000">response</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">headers</span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#34;Ce-Type&#34;</span><span style="color:#000;font-weight:bold">]</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#4e9a06">&#34;dev.knative.samples.hifromknative&#34;</span>
|
||||
<span style="color:#204a87;font-weight:bold">return</span> <span style="color:#000">response</span>
|
||||
|
||||
<span style="color:#204a87;font-weight:bold">if</span> <span style="color:#000">__name__</span> <span style="color:#ce5c00;font-weight:bold">==</span> <span style="color:#4e9a06">&#39;__main__&#39;</span><span style="color:#000;font-weight:bold">:</span>
|
||||
<span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">.</span><span style="color:#000">run</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">debug</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#3465a4">True</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">host</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#4e9a06">&#39;0.0.0.0&#39;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">port</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">8080</span><span style="color:#000;font-weight:bold">)</span>
|
||||
|
||||
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Add a requirements.txt file containing the following contents:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#000">Flask</span><span style="color:#ce5c00;font-weight:bold">==</span>1.1.1
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>In your project directory, create a file named <code>Dockerfile</code> and copy the code
|
||||
block below into it. For detailed instructions on dockerizing a Go app, see
|
||||
<a href="https://blog.golang.org/docker">Deploying Go servers with Docker</a>.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-docker" data-lang="docker"><span style="color:#204a87;font-weight:bold">FROM</span><span style="color:#4e9a06"> python:alpine3.7</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">COPY</span> . /app<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">WORKDIR</span><span style="color:#4e9a06"> /app</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">RUN</span> pip install -r requirements.txt<span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">EXPOSE</span><span style="color:#4e9a06"> 8080</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">ENTRYPOINT</span> <span style="color:#000;font-weight:bold">[</span> <span style="color:#4e9a06">&#34;python&#34;</span> <span style="color:#000;font-weight:bold">]</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000"></span><span style="color:#204a87;font-weight:bold">CMD</span> <span style="color:#000;font-weight:bold">[</span> <span style="color:#4e9a06">&#34;helloworld.py&#34;</span> <span style="color:#000;font-weight:bold">]</span><span style="color:#a40000">
|
||||
</span><span style="color:#a40000">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Create a new file, <code>sample-app.yaml</code> and copy the following service definition
|
||||
into the file. Make sure to replace <code>{username}</code> with your Docker Hub
|
||||
username.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># Namespace for sample application with eventing enabled</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Namespace</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">eventing.knative.dev/injection</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">enabled</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Helloworld-python app deploment</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">apps/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Deployment</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">replicas</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">matchLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">&amp;labels</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">*labels</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">docker.io/{username}/helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">imagePullPolicy</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">IfNotPresent</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Service that exposes helloworld-python app.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># This will be the subscriber for the Trigger</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ports</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">protocol</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TCP</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">port</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">80</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">targetPort</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">8080</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic"># Knative Eventing Trigger to trigger the helloworld-python service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">eventing.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Trigger</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-samples</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">broker</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">attributes</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">type</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">dev.knative.samples.helloworld</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">source</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">dev.knative.samples/helloworldsource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">helloworld-python</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
</ol>
|
||||
<h2 id="building-and-deploying-the-sample">Building and deploying the sample</h2>
|
||||
<p>Once you have recreated the sample code files (or used the files in the sample
|
||||
folder) you&rsquo;re ready to build and deploy the sample app.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Use Docker to build the sample code into a container. To build and push with
|
||||
Docker Hub, run these commands replacing <code>{username}</code> with your Docker Hub
|
||||
username:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#8f5902;font-style:italic"># Build the container on your local machine</span>
|
||||
docker build -t <span style="color:#ce5c00;font-weight:bold">{</span>username<span style="color:#ce5c00;font-weight:bold">}</span>/helloworld-python .
|
||||
|
||||
<span style="color:#8f5902;font-style:italic"># Push the container to docker registry</span>
|
||||
docker push <span style="color:#ce5c00;font-weight:bold">{</span>username<span style="color:#ce5c00;font-weight:bold">}</span>/helloworld-python
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>After the build has completed and the container is pushed to Docker Hub, you
|
||||
can deploy the sample application into your cluster. Ensure that the container image value
|
||||
in <code>sample-app.yaml</code> matches the container you built in the previous step. Apply
|
||||
the configuration using <code>kubectl</code>:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl apply --filename sample-app.yaml
|
||||
</code></pre></div><ol>
|
||||
<li>Above command created a namespace <code>knative-samples</code> and labelled it with <code>knative-eventing-injection=enabled</code>, to enable eventing in the namespace. Verify using the following command:
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get ns knative-samples --show-labels
|
||||
</code></pre></div></li>
|
||||
<li>It deployed the helloworld-python app as a K8s Deployment and created a K8s service names helloworld-python. Verify using the following command.
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples get deployments helloworld-python
|
||||
kubectl --namespace knative-samples get svc helloworld-python
|
||||
</code></pre></div></li>
|
||||
<li>It created a Knative Eventing Trigger to route certain events to the helloworld-python application. Make sure that Ready=true
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples get trigger helloworld-python
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
<h2 id="send-and-verify-cloudevents">Send and verify CloudEvents</h2>
|
||||
<p>After you have deployed the application, and have verified that the namespace, sample application and trigger are ready, you can send a CloudEvent.</p>
|
||||
<h3 id="send-cloudevent-to-the-broker">Send CloudEvent to the Broker</h3>
|
||||
<p>You can send an HTTP request directly to the Knative <a href="../../../broker-trigger">broker</a> if the correct CloudEvent headers are set.</p>
|
||||
<ol>
|
||||
<li>Deploy a curl pod and SSH into it
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples run curl --image<span style="color:#ce5c00;font-weight:bold">=</span>radial/busyboxplus:curl -it
|
||||
</code></pre></div></li>
|
||||
<li>Run the following in the SSH terminal
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">curl -v <span style="color:#4e9a06">&#34;default-broker.knative-samples.svc.cluster.local&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-X POST <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-H <span style="color:#4e9a06">&#34;Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-H <span style="color:#4e9a06">&#34;Ce-specversion: 0.3&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-H <span style="color:#4e9a06">&#34;Ce-Type: dev.knative.samples.helloworld&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-H <span style="color:#4e9a06">&#34;Ce-Source: dev.knative.samples/helloworldsource&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-H <span style="color:#4e9a06">&#34;Content-Type: application/json&#34;</span> <span style="color:#4e9a06">\
|
||||
</span><span style="color:#4e9a06"></span>-d <span style="color:#4e9a06">&#39;{&#34;msg&#34;:&#34;Hello World from the curl pod.&#34;}&#39;</span>
|
||||
|
||||
<span style="color:#204a87">exit</span>
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h3 id="verify-that-event-is-received-by-helloworld-python-app">Verify that event is received by helloworld-python app</h3>
|
||||
<p>Helloworld-python app logs the context and the msg of the above event, and replies back with another event.</p>
|
||||
<ol>
|
||||
<li>Display helloworld-python app logs
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples logs -l <span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">=</span>helloworld-python --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">50</span>
|
||||
</code></pre></div><p>You should see something similar to:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">Event received. Context: Context Attributes,
|
||||
specversion: 0.3
|
||||
type: dev.knative.samples.helloworld
|
||||
source: dev.knative.samples/helloworldsource
|
||||
id: 536808d3-88be-4077-9d7a-a3f162705f79
|
||||
time: 2019-10-04T22:35:26.05871736Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
knativearrivaltime: 2019-10-04T22:35:26Z
|
||||
knativehistory: default-kn2-trigger-kn-channel.knative-samples.svc.cluster.local
|
||||
traceparent: 00-971d4644229653483d38c46e92a959c7-92c66312e4bb39be-00
|
||||
|
||||
Hello World Message <span style="color:#4e9a06">&#34;Hello World from the curl pod.&#34;</span>
|
||||
Responded with event Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 0.2
|
||||
type: dev.knative.samples.hifromknative
|
||||
source: knative/eventing/samples/hello-world
|
||||
id: 37458d77-01f5-411e-a243-a459bbf79682
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;msg&#34;</span>:<span style="color:#4e9a06">&#34;Hi from Knative!&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<p>Try the CloudEvent attributes in the curl command and the trigger specification to understand how <a href="../../../broker-trigger#trigger">triggers</a> work.</p>
|
||||
<h2 id="verify-reply-from-helloworld-python-app">Verify reply from helloworld-python app</h2>
|
||||
<p>The <code>helloworld-python</code> app replies with an event type <code>type= dev.knative.samples.hifromknative</code>, and source <code>source=knative/eventing/samples/hello-world</code>. The event enters the eventing mesh through the broker, and can be delivered to event sinks using a trigger</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Deploy a pod that receives any CloudEvent and logs the event to its output.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples apply --filename - <span style="color:#4e9a06">&lt;&lt; END
|
||||
</span><span style="color:#4e9a06"># event-display app deploment
|
||||
</span><span style="color:#4e9a06">apiVersion: apps/v1
|
||||
</span><span style="color:#4e9a06">kind: Deployment
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> replicas: 1
|
||||
</span><span style="color:#4e9a06"> selector:
|
||||
</span><span style="color:#4e9a06"> matchLabels: &amp;labels
|
||||
</span><span style="color:#4e9a06"> app: event-display
|
||||
</span><span style="color:#4e9a06"> template:
|
||||
</span><span style="color:#4e9a06"> metadata:
|
||||
</span><span style="color:#4e9a06"> labels: *labels
|
||||
</span><span style="color:#4e9a06"> spec:
|
||||
</span><span style="color:#4e9a06"> containers:
|
||||
</span><span style="color:#4e9a06"> - name: helloworld-python
|
||||
</span><span style="color:#4e9a06"> image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
||||
</span><span style="color:#4e9a06">---
|
||||
</span><span style="color:#4e9a06"># Service that exposes event-display app.
|
||||
</span><span style="color:#4e9a06"># This will be the subscriber for the Trigger
|
||||
</span><span style="color:#4e9a06">kind: Service
|
||||
</span><span style="color:#4e9a06">apiVersion: v1
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> selector:
|
||||
</span><span style="color:#4e9a06"> app: event-display
|
||||
</span><span style="color:#4e9a06"> ports:
|
||||
</span><span style="color:#4e9a06"> - protocol: TCP
|
||||
</span><span style="color:#4e9a06"> port: 80
|
||||
</span><span style="color:#4e9a06"> targetPort: 8080
|
||||
</span><span style="color:#4e9a06">END</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Create a trigger to deliver the event to the above service</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples apply --filename - <span style="color:#4e9a06">&lt;&lt; END
|
||||
</span><span style="color:#4e9a06">apiVersion: eventing.knative.dev/v1
|
||||
</span><span style="color:#4e9a06">kind: Trigger
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06"> namespace: knative-samples
|
||||
</span><span style="color:#4e9a06">spec:
|
||||
</span><span style="color:#4e9a06"> broker: default
|
||||
</span><span style="color:#4e9a06"> filter:
|
||||
</span><span style="color:#4e9a06"> attributes:
|
||||
</span><span style="color:#4e9a06"> type: dev.knative.samples.hifromknative
|
||||
</span><span style="color:#4e9a06"> source: knative/eventing/samples/hello-world
|
||||
</span><span style="color:#4e9a06"> subscriber:
|
||||
</span><span style="color:#4e9a06"> ref:
|
||||
</span><span style="color:#4e9a06"> apiVersion: v1
|
||||
</span><span style="color:#4e9a06"> kind: Service
|
||||
</span><span style="color:#4e9a06"> name: event-display
|
||||
</span><span style="color:#4e9a06">END</span>
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p><a href="###Send-CloudEvent-to-the-Broker">Send a CloudEvent to the Broker</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Check the logs of event-display service</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl --namespace knative-samples logs -l <span style="color:#000">app</span><span style="color:#ce5c00;font-weight:bold">=</span>event-display --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">50</span>
|
||||
</code></pre></div><p>You should see something similar to:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"> cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 0.3
|
||||
type: dev.knative.samples.hifromknative
|
||||
source: knative/eventing/samples/hello-world
|
||||
id: 8a7384b9-8bbe-4634-bf0f-ead07e450b2a
|
||||
time: 2019-10-04T22:53:39.844943931Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
knativearrivaltime: 2019-10-04T22:53:39Z
|
||||
knativehistory: default-kn2-ingress-kn-channel.knative-samples.svc.cluster.local
|
||||
traceparent: 00-4b01db030b9ea04bb150b77c8fa86509-2740816590a7604f-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;msg&#34;</span>: <span style="color:#4e9a06">&#34;Hi from helloworld- app!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<p><strong>Note: You could use the above approach to test your applications too.</strong></p>
|
||||
<h2 id="removing-the-sample-app-deployment">Removing the sample app deployment</h2>
|
||||
<p>To remove the sample app from your cluster, delete the service record:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete --filename sample-app.yaml
|
||||
</code></pre></div>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,18 +0,0 @@
|
|||
# Replace the following before applying this file:
|
||||
# TOPIC_NAME: Replace with the GCP PubSub Topic name.
|
||||
# MY_GCP_PROJECT: Replace with the GCP Project's ID.
|
||||
|
||||
apiVersion: sources.knative.dev/v1alpha1
|
||||
kind: GcpPubSubSource
|
||||
metadata:
|
||||
name: TOPIC_NAME-source
|
||||
spec:
|
||||
gcpCredsSecret:
|
||||
name: google-cloud-key
|
||||
key: key.json
|
||||
googleCloudProject: PROJECT_ID
|
||||
topic: TOPIC_NAME
|
||||
sink:
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Broker
|
||||
name: default
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
MQTT "github.com/eclipse/paho.mqtt.golang"
|
||||
jwt "github.com/form3tech-oss/jwt-go"
|
||||
uuid "github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
host = "mqtt.googleapis.com"
|
||||
port = "8883"
|
||||
idPrefix = "eid"
|
||||
)
|
||||
|
||||
var (
|
||||
deviceID = flag.String("device", "", "Cloud IoT Core Device ID")
|
||||
projectID = flag.String("project", "", "GCP Project ID")
|
||||
registryID = flag.String("registry", "", "Cloud IoT Registry ID (short form)")
|
||||
region = flag.String("region", "us-central1", "GCP Region")
|
||||
numEvents = flag.Int("events", 10, "Number of events to sent")
|
||||
eventSrc = flag.String("src", "", "Event source")
|
||||
certsCA = flag.String("ca", "root-ca.pem", "Download https://pki.google.com/roots.pem")
|
||||
privateKey = flag.String("key", "", "Path to private key file")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
log.Println("Loading Google's roots...")
|
||||
certpool := x509.NewCertPool()
|
||||
pemCerts, err := ioutil.ReadFile(*certsCA)
|
||||
if err == nil {
|
||||
certpool.AppendCertsFromPEM(pemCerts)
|
||||
}
|
||||
|
||||
config := &tls.Config{
|
||||
RootCAs: certpool,
|
||||
ClientAuth: tls.NoClientCert,
|
||||
ClientCAs: nil,
|
||||
InsecureSkipVerify: true,
|
||||
Certificates: []tls.Certificate{},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
|
||||
clientID := fmt.Sprintf("projects/%v/locations/%v/registries/%v/devices/%v",
|
||||
*projectID,
|
||||
*region,
|
||||
*registryID,
|
||||
*deviceID,
|
||||
)
|
||||
|
||||
log.Println("Creating MQTT client options...")
|
||||
opts := MQTT.NewClientOptions()
|
||||
|
||||
broker := fmt.Sprintf("ssl://%v:%v", host, port)
|
||||
log.Printf("Broker '%v'", broker)
|
||||
|
||||
opts.AddBroker(broker)
|
||||
opts.SetClientID(clientID).SetTLSConfig(config)
|
||||
opts.SetUsername("unused")
|
||||
|
||||
token := jwt.New(jwt.SigningMethodRS256)
|
||||
token.Claims = jwt.StandardClaims{
|
||||
Audience: []string{*projectID},
|
||||
IssuedAt: time.Now().Unix(),
|
||||
ExpiresAt: time.Now().Add(24 * time.Hour).Unix(),
|
||||
}
|
||||
|
||||
log.Println("Loading private key...")
|
||||
keyBytes, err := ioutil.ReadFile(*privateKey)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println("Parsing private key...")
|
||||
key, err := jwt.ParseRSAPrivateKeyFromPEM(keyBytes)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println("Signing token")
|
||||
tokenString, err := token.SignedString(key)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println("Setting password...")
|
||||
opts.SetPassword(tokenString)
|
||||
|
||||
opts.SetDefaultPublishHandler(func(client MQTT.Client, msg MQTT.Message) {
|
||||
fmt.Printf("[handler] Topic: %v\n", msg.Topic())
|
||||
fmt.Printf("[handler] Payload: %v\n", msg.Payload())
|
||||
})
|
||||
|
||||
log.Println("Connecting...")
|
||||
client := MQTT.NewClient(opts)
|
||||
if token := client.Connect(); token.Wait() && token.Error() != nil {
|
||||
log.Fatal(token.Error())
|
||||
}
|
||||
|
||||
topic := fmt.Sprintf("/devices/%s/events", *deviceID)
|
||||
log.Println("Publishing messages...")
|
||||
for i := 0; i < *numEvents; i++ {
|
||||
data := makeEvent()
|
||||
log.Printf("Publishing to topic '%s': %v", topic, data)
|
||||
token := client.Publish(
|
||||
topic,
|
||||
0,
|
||||
false,
|
||||
data)
|
||||
token.WaitTimeout(5 * time.Second)
|
||||
if token.Error() != nil {
|
||||
log.Printf("Error publishing: %s", token.Error())
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("Disconnecting...")
|
||||
client.Disconnect(250)
|
||||
|
||||
log.Println("Done")
|
||||
}
|
||||
|
||||
func makeEvent() string {
|
||||
|
||||
s1 := rand.NewSource(time.Now().UnixNano())
|
||||
r1 := rand.New(s1)
|
||||
|
||||
event := struct {
|
||||
SourceID string `json:"source_id"`
|
||||
EventID string `json:"event_id"`
|
||||
EventTs int64 `json:"event_ts"`
|
||||
Metric float32 `json:"metric"`
|
||||
}{
|
||||
SourceID: *eventSrc,
|
||||
EventID: fmt.Sprintf("%s-%s", idPrefix, uuid.New().String()),
|
||||
EventTs: time.Now().UTC().Unix(),
|
||||
Metric: r1.Float32(),
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(event)
|
||||
|
||||
return string(data)
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Trigger
|
||||
metadata:
|
||||
name: iot-demo
|
||||
namespace: default
|
||||
spec:
|
||||
broker: default
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: event-display
|
||||
|
||||
---
|
||||
# This is a very simple Knative Service that writes the input request to its log.
|
||||
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
namespace: default
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,63 +0,0 @@
|
|||
# Copyright 2020 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Replace the following before applying this file:
|
||||
# KAFKA_CONSUMER_GROUP_NAME: Name of Kafka consumer group
|
||||
# KAFKA_BOOTSTRAP_SERVERS: Array of bootstrap servers
|
||||
# KAFKA_SASL_ENABLE: Truthy value to enable/disable SASL, disabled by default (optional)
|
||||
# KAFKA_SASL_USER_SECRET_NAME: Name of secret containing SASL user (optional)
|
||||
# KAFKA_SASL_USER_SECRET_KEY: Key within secret containing SASL user (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_NAME: Name of secret containing SASL password (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_KEY: Key within secret containing SASL password (optional)
|
||||
# KAFKA_TLS_ENABLE: Truthy to enable TLS, disabled by default (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_NAME: Name of secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_KEY: Key within secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_NAME: Name of secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_KEY: Key within secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_NAME: Name of secret containing server CA cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_KEY: Key within secret containing server CA cert to use when connecting with TLS (optional)
|
||||
|
||||
apiVersion: sources.knative.dev/v1beta1
|
||||
kind: KafkaBinding
|
||||
metadata:
|
||||
name: kafka-binding
|
||||
spec:
|
||||
consumerGroup: KAFKA_CONSUMER_GROUP_NAME
|
||||
bootstrapServers:
|
||||
- KAFKA_BOOTSTRAP_SERVERS
|
||||
net:
|
||||
sasl:
|
||||
enable: KAFKA_SASL_ENABLE
|
||||
user:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_USER_SECRET_NAME
|
||||
key: KAFKA_SASL_USER_SECRET_KEY
|
||||
password:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_PASSWORD_SECRET_NAME
|
||||
key: KAFKA_SASL_PASSWORD_SECRET_KEY
|
||||
tls:
|
||||
enable: KAFKA_TLS_ENABLE
|
||||
cert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CERT_SECRET_KEY
|
||||
key:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_KEY_SECRET_NAME
|
||||
key: KAFKA_TLS_KEY_SECRET_KEY
|
||||
caCert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CA_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CA_CERT_SECRET_KEY
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2020 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,78 +0,0 @@
|
|||
# Copyright 2020 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Replace the following before applying this file:
|
||||
# KAFKA_CONSUMER_GROUP_NAME: Name of Kafka consumer group
|
||||
# KAFKA_BOOTSTRAP_SERVERS: Array of bootstrap servers
|
||||
# KAFKA_TOPICS: Array of topics
|
||||
# KAFKA_SASL_ENABLE: Truthy value to enable/disable SASL, disabled by default (optional)
|
||||
# KAFKA_SASL_USER_SECRET_NAME: Name of secret containing SASL user (optional)
|
||||
# KAFKA_SASL_USER_SECRET_KEY: Key within secret containing SASL user (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_NAME: Name of secret containing SASL password (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_KEY: Key within secret containing SASL password (optional)
|
||||
# KAFKA_TLS_ENABLE: Truthy to enable TLS, disabled by default (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_NAME: Name of secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_KEY: Key within secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_NAME: Name of secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_KEY: Key within secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_NAME: Name of secret containing server CA cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_KEY: Key within secret containing server CA cert to use when connecting with TLS (optional)
|
||||
|
||||
apiVersion: sources.knative.dev/v1beta1
|
||||
kind: KafkaSource
|
||||
metadata:
|
||||
name: kafka-source
|
||||
spec:
|
||||
consumerGroup: KAFKA_CONSUMER_GROUP_NAME
|
||||
bootstrapServers:
|
||||
- KAFKA_BOOTSTRAP_SERVERS
|
||||
topics:
|
||||
- KAFKA_TOPICS
|
||||
net:
|
||||
sasl:
|
||||
enable: KAFKA_SASL_ENABLE
|
||||
user:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_USER_SECRET_NAME
|
||||
key: KAFKA_SASL_USER_SECRET_KEY
|
||||
password:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_PASSWORD_SECRET_NAME
|
||||
key: KAFKA_SASL_PASSWORD_SECRET_KEY
|
||||
tls:
|
||||
enable: KAFKA_TLS_ENABLE
|
||||
cert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CERT_SECRET_KEY
|
||||
key:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_KEY_SECRET_NAME
|
||||
key: KAFKA_TLS_KEY_SECRET_KEY
|
||||
caCert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CA_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CA_CERT_SECRET_KEY
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: event-display
|
|
@ -1,9 +0,0 @@
|
|||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: broker-kafka-display
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,37 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: events-sa
|
||||
namespace: default
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: event-watcher
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: k8s-ra-event-watcher
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: event-watcher
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: events-sa
|
||||
namespace: default
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: sources.knative.dev/v1
|
||||
kind: ApiServerSource
|
||||
metadata:
|
||||
name: testevents-kafka-03
|
||||
namespace: default
|
||||
spec:
|
||||
serviceAccountName: events-sa
|
||||
mode: Resource
|
||||
resources:
|
||||
- apiVersion: v1
|
||||
kind: Event
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Broker
|
||||
name: default
|
|
@ -1,12 +0,0 @@
|
|||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Trigger
|
||||
metadata:
|
||||
name: testevents-trigger
|
||||
namespace: default
|
||||
spec:
|
||||
broker: default
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: broker-kafka-display
|
|
@ -1,774 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Apache Kafka examples</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/kafka/</link>
|
||||
<description>Recent content in Apache Kafka examples on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/kafka/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Apache Kafka Binding Example</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/kafka/binding/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/kafka/binding/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>KafkaBinding is responsible for injecting Kafka bootstrap connection information
|
||||
into a Kubernetes resource that embed a PodSpec (as <code>spec.template.spec</code>). This
|
||||
enables easy bootstrapping of a Kafka client.</p>
|
||||
<h2 id="create-a-job-that-uses-kafkabinding">Create a Job that uses KafkaBinding</h2>
|
||||
<p>In the below example a Kubernetes Job will be using the KafkaBinding to produce
|
||||
messages on a Kafka Topic, which will be received by the Event Display service
|
||||
via Kafka Source</p>
|
||||
<h3 id="prerequisites">Prerequisites</h3>
|
||||
<ol>
|
||||
<li>You must ensure that you meet the
|
||||
<a href="../index.html">prerequisites listed in the Apache Kafka overview</a>.</li>
|
||||
<li>This feature is available from Knative Eventing 0.15+</li>
|
||||
</ol>
|
||||
<h3 id="creating-a-kafkasource-source-crd">Creating a <code>KafkaSource</code> source CRD</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Install the <code>KafkaSource</code> sub-component to your Knative cluster:</p>
|
||||
<pre><code>kubectl apply -f https://storage.googleapis.com/knative-releases/eventing-contrib/latest/kafka-source.yaml
|
||||
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Check that the <code>kafka-controller-manager-0</code> pod is running.</p>
|
||||
<pre><code>kubectl get pods --namespace knative-sources
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
kafka-controller-manager-0 1/1 Running 0 42m
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="create-the-event-display-service">Create the Event Display service</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>(Optional) Source code for Event Display service</p>
|
||||
<p>Get the source code of Event Display container image from
|
||||
<a href="https://github.com/knative/eventing-contrib/blob/master/cmd/event_display/main.go">here</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Deploy the Event Display Service via kubectl:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><pre><code>$ kubectl apply --filename event-display.yaml
|
||||
...
|
||||
service.serving.knative.dev/event-display created
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>(Optional) Deploy the Event Display Service via kn cli:</p>
|
||||
<p>Alternatively, you can create the knative service using the <code>kn</code> cli like
|
||||
below</p>
|
||||
<pre><code>kn service create event-display --image=gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Ensure that the Service pod is running. The pod name will be prefixed with
|
||||
<code>event-display</code>.</p>
|
||||
<pre><code>$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
event-display-00001-deployment-5d5df6c7-gv2j4 2/2 Running 0 72s
|
||||
...
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="apache-kafka-event-source">Apache Kafka Event Source</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Modify <code>event-source.yaml</code> accordingly with bootstrap servers, topics,
|
||||
etc&hellip;:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-source</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">consumerGroup</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-group</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">my-cluster-kafka-bootstrap.kafka:9092</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">#note the kafka namespace</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">topics</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">logs</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Deploy the event source.</p>
|
||||
<pre><code>$ kubectl apply -f event-source.yaml
|
||||
...
|
||||
kafkasource.sources.knative.dev/kafka-source created
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Check that the event source pod is running. The pod name will be prefixed
|
||||
with <code>kafka-source</code>.</p>
|
||||
<pre><code>$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
kafka-source-xlnhq-5544766765-dnl5s 1/1 Running 0 40m
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="kafka-binding-resource">Kafka Binding Resource</h3>
|
||||
<p>Create the KafkaBinding that will inject kafka bootstrap information into select
|
||||
<code>Jobs</code>:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Modify <code>kafka-binding.yaml</code> accordingly with bootstrap servers etc&hellip;:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">bindings.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaBinding</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-binding-test</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subject</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">batch/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Job</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">matchLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kafka.topic</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;logs&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">my-cluster-kafka-bootstrap.kafka:9092</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
</ol>
|
||||
<p>In this case, we will bind any <code>Job</code> with the labels <code>kafka.topic: &quot;logs&quot;</code>.</p>
|
||||
<h3 id="create-kubernetes-job">Create Kubernetes Job</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Source code for kafka-publisher service</p>
|
||||
<p>Get the source code of kafka-publisher container image from
|
||||
<a href="https://github.com/knative-sandbox/eventing-kafka/blob/master/test/test_images/kafka-publisher/main.go">here</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Now we will use the kafka-publisher container to send events to kafka topic
|
||||
when the Job runs.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">batch/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Job</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kafka.topic</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;logs&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-publisher-job</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">backoffLimit</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">completions</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">parallelism</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sidecar.istio.io/inject</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;false&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">restartPolicy</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Never</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">docker.io/murugappans/kafka-publisher-1974f83e2ff7c8994707b5e8731528e8@sha256:fd79490514053c643617dc72a43097251fed139c966fd5d131134a0e424882de</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KAFKA_TOPIC</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;logs&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KAFKA_KEY</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;0&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KAFKA_HEADERS</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;content-type:application/json&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KAFKA_VALUE</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;{&#34;msg&#34;:&#34;This is a test!&#34;}&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-publisher</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Check that the Job has run successfully.</p>
|
||||
<pre><code>$ kubectl get jobs
|
||||
NAME COMPLETIONS DURATION AGE
|
||||
kafka-publisher-job 1/1 7s 7s
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="verify">Verify</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Ensure the Event Display received the message sent to it by the Event Source.</p>
|
||||
<pre><code>$ kubectl logs --selector='serving.knative.dev/service=event-display' -c user-container
|
||||
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.kafka.event
|
||||
source: /apis/v1/namespaces/default/kafkasources/kafka-source#logs
|
||||
subject: partition:0#1
|
||||
id: partition:0/offset:1
|
||||
time: 2020-05-17T19:45:02.7Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
kafkaheadercontenttype: application/json
|
||||
key: 0
|
||||
traceparent: 00-f383b779f512358b24ffbf6556a6d6da-cacdbe78ef9b5ad3-00
|
||||
Data,
|
||||
{
|
||||
&quot;msg&quot;: &quot;This is a test!&quot;
|
||||
}
|
||||
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h2 id="connecting-to-a-tls-enabled-kafka-broker">Connecting to a TLS enabled Kafka broker</h2>
|
||||
<p>The KafkaBinding supports TLS and SASL authentication methods. For injecting TLS
|
||||
authentication, please have the below files</p>
|
||||
<ul>
|
||||
<li>CA Certificate</li>
|
||||
<li>Client Certificate and Key</li>
|
||||
</ul>
|
||||
<p>These files are expected to be in pem format, if it is in other format like jks
|
||||
, please convert to pem.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create the certificate files as secrets in the namespace where KafkaBinding
|
||||
is going to be set up</p>
|
||||
<pre><code>$ kubectl create secret generic cacert --from-file=caroot.pem
|
||||
secret/cacert created
|
||||
|
||||
$ kubectl create secret tls kafka-secret --cert=certificate.pem --key=key.pem
|
||||
secret/key created
|
||||
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Apply the kafkabinding-tls.yaml, change bootstrapServers accordingly.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaBinding</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-source-with-tls</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subject</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">batch/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Job</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">matchLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kafka.topic</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;logs&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">net</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">tls</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">enable</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">cert</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">tls.crt</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">tls.key</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">caCert</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">caroot.pem</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">cacert</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">consumerGroup</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-group</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">my-secure-kafka-bootstrap.kafka:443</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
</ol>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Apache Kafka Channel Example</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/kafka/channel/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/kafka/channel/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>You can install and configure the Apache Kafka CRD (<code>KafkaChannel</code>) as the
|
||||
default channel configuration in Knative Eventing.</p>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<ul>
|
||||
<li>Ensure that you meet the
|
||||
<a href="../index.html">prerequisites listed in the Apache Kafka overview</a>.</li>
|
||||
<li>A Kubernetes cluster with
|
||||
<a href="../../../../install/index.html">Knative Kafka Channel installed</a>.</li>
|
||||
</ul>
|
||||
<h2 id="creating-a-kafkachannel-channel-crd">Creating a <code>KafkaChannel</code> channel CRD</h2>
|
||||
<p>Create a new object by configuring the YAML file as follows:</p>
|
||||
<pre><code>cat &lt;&lt;-EOF | kubectl apply -f -
|
||||
---
|
||||
apiVersion: messaging.knative.dev/v1beta1
|
||||
kind: KafkaChannel
|
||||
metadata:
|
||||
name: my-kafka-channel
|
||||
spec:
|
||||
numPartitions: 3
|
||||
replicationFactor: 1
|
||||
EOF
|
||||
</code></pre><h2 id="specifying-the-default-channel-configuration">Specifying the default channel configuration</h2>
|
||||
<p>To configure the usage of the <code>KafkaChannel</code> CRD as the
|
||||
<a href="../../../channels/default-channels">default channel configuration</a>, edit the
|
||||
<code>default-ch-webhook</code> ConfigMap as follows:</p>
|
||||
<pre><code>cat &lt;&lt;-EOF | kubectl apply -f -
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: default-ch-webhook
|
||||
namespace: knative-eventing
|
||||
data:
|
||||
# Configuration for defaulting channels that do not specify CRD implementations.
|
||||
default-ch-config: |
|
||||
clusterDefault:
|
||||
apiVersion: messaging.knative.dev/v1beta1
|
||||
kind: KafkaChannel
|
||||
spec:
|
||||
numPartitions: 3
|
||||
replicationFactor: 1
|
||||
EOF
|
||||
</code></pre><h2 id="creating-an-apache-kafka-channel-using-the-default-channel-configuration">Creating an Apache Kafka channel using the default channel configuration</h2>
|
||||
<p>Now that <code>KafkaChannel</code> is set as the default channel configuration, you can use
|
||||
the <code>channels.messaging.knative.dev</code> CRD to create a new Apache Kafka channel,
|
||||
using the generic <code>Channel</code>:</p>
|
||||
<pre><code>cat &lt;&lt;-EOF | kubectl apply -f -
|
||||
---
|
||||
apiVersion: messaging.knative.dev/v1
|
||||
kind: Channel
|
||||
metadata:
|
||||
name: testchannel-one
|
||||
EOF
|
||||
</code></pre><p>Check Kafka for a <code>testchannel</code> topic. With Strimzi this can be done by using
|
||||
the command:</p>
|
||||
<pre><code>kubectl -n kafka exec -it my-cluster-kafka-0 -- bin/kafka-topics.sh --zookeeper localhost:2181 --list
|
||||
</code></pre><p>The result is:</p>
|
||||
<pre><code>...
|
||||
knative-messaging-kafka.default.testchannel-one
|
||||
...
|
||||
</code></pre><p>The Apache Kafka topic that is created by the channel implementation is prefixed
|
||||
with <code>knative-messaging-kafka</code>. This indicates it is an Apache Kafka channel
|
||||
from Knative. It contains the name of the namespace, <code>default</code> in this example,
|
||||
followed by the actual name of the channel.</p>
|
||||
<h2 id="configuring-the-knative-broker-for-apache-kafka-channels">Configuring the Knative broker for Apache Kafka channels</h2>
|
||||
<p>To setup a broker that will use the new default Kafka channels, you must create
|
||||
a new <em>default</em> broker, using the command:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f - <span style="color:#4e9a06">&lt;&lt;EOF
|
||||
</span><span style="color:#4e9a06">apiVersion: eventing.knative.dev/v1
|
||||
</span><span style="color:#4e9a06">kind: Broker
|
||||
</span><span style="color:#4e9a06">metadata:
|
||||
</span><span style="color:#4e9a06"> name: default
|
||||
</span><span style="color:#4e9a06">EOF</span>
|
||||
</code></pre></div><p>This will give you two pods, such as:</p>
|
||||
<pre><code>default-broker-filter-64658fc79f-nf596 1/1 Running 0 15m
|
||||
default-broker-ingress-ff79755b6-vj9jt 1/1 Running 0 15m
|
||||
|
||||
</code></pre><p>Inside the Apache Kafka cluster you should see two new topics, such as:</p>
|
||||
<pre><code>...
|
||||
knative-messaging-kafka.default.default-kn2-ingress
|
||||
knative-messaging-kafka.default.default-kn2-trigger
|
||||
...
|
||||
</code></pre><h2 id="creating-a-service-and-trigger-to-use-the-apache-kafka-broker">Creating a service and trigger to use the Apache Kafka broker</h2>
|
||||
<p>To use the Apache Kafka based broker, let&rsquo;s take a look at a simple demo. Use
|
||||
the<code>ApiServerSource</code> to publish events to the broker as well as the <code>Trigger</code>
|
||||
API, which then routes events to a Knative <code>Service</code>.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Install <code>ksvc</code>, using the command:</p>
|
||||
<pre><code>kubectl apply -f 000-ksvc.yaml
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Install a source that publishes to the default broker</p>
|
||||
<pre><code>kubectl apply -f 020-k8s-events.yaml
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Create a trigger that routes the events to the <code>ksvc</code>:</p>
|
||||
<pre><code>kubectl apply -f 030-trigger.yaml
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h2 id="verifying-your-apache-kafka-channel-and-broker">Verifying your Apache Kafka channel and broker</h2>
|
||||
<p>Now that your Eventing cluster is configured for Apache Kafka, you can verify
|
||||
your configuration with the following options.</p>
|
||||
<h3 id="receive-events-via-knative">Receive events via Knative</h3>
|
||||
<p>Now you can see the events in the log of the <code>ksvc</code> using the command:</p>
|
||||
<pre><code>kubectl logs --selector='serving.knative.dev/service=broker-kafka-display' -c user-container
|
||||
</code></pre><h2 id="authentication-against-an-apache-kafka">Authentication against an Apache Kafka</h2>
|
||||
<p>In production environments it is common that the Apache Kafka cluster is secured using <a href="http://kafka.apache.org/documentation/#security_ssl">TLS</a> or <a href="http://kafka.apache.org/documentation/#security_sasl">SASL</a>. This section shows how to confiugure the <code>KafkaChannel</code> to work against a protected Apache Kafka cluster, with the two supported TLS and SASL authentication methods.</p>
|
||||
<h3 id="tls-authentication">TLS authentication</h3>
|
||||
<p>To use TLS authentication you must create:</p>
|
||||
<ul>
|
||||
<li>A CA certificate</li>
|
||||
<li>A client certificate and key</li>
|
||||
</ul>
|
||||
<p><strong>NOTE:</strong> Kafka channels require these files to be in <code>.pem</code> format. If your files are in a different format, you must convert them to <code>.pem</code>.</p>
|
||||
<ol>
|
||||
<li>Create the certificate files as secrets in your chosen namespace:</li>
|
||||
</ol>
|
||||
<pre><code>$ kubectl create secret --namespace &lt;namespace&gt; generic &lt;kafka-auth-secret&gt; \
|
||||
--from-file=ca.crt=caroot.pem \
|
||||
--from-file=user.crt=certificate.pem \
|
||||
--from-file=user.key=key.pem
|
||||
</code></pre><p><em>NOTE:</em> It is important to use the same keys (<code>ca.crt</code>, <code>user.crt</code> and <code>user.key</code>).</p>
|
||||
<p>Reference your secret and the namespace of the secret in the <code>config-kafka</code> ConfigMap:</p>
|
||||
<pre><code>apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: config-kafka
|
||||
namespace: knative-eventing
|
||||
data:
|
||||
bootstrapServers: &lt;bootstrap-servers&gt;
|
||||
authSecretName: &lt;kafka-auth-secret&gt;
|
||||
authSecretNamespace: &lt;namespace&gt;
|
||||
</code></pre><h3 id="sasl-authentication">SASL authentication</h3>
|
||||
<p>To use SASL authentication, you will need the following information:</p>
|
||||
<ul>
|
||||
<li>A username and password.</li>
|
||||
<li>The type of SASL mechanism you wish to use. For example; <code>PLAIN</code>, <code>SCRAM-SHA-256</code> or <code>SCRAM-SHA-512</code>.</li>
|
||||
</ul>
|
||||
<p><strong>NOTE:</strong> It is recommended to also enable TLS. If you enable this, you will also need the <code>ca.crt</code> certificate as described in the previous section.</p>
|
||||
<ol>
|
||||
<li>Create the certificate files as secrets in your chosen namespace:</li>
|
||||
</ol>
|
||||
<pre><code>$ kubectl create secret --namespace &lt;namespace&gt; generic &lt;kafka-auth-secret&gt; \
|
||||
--from-file=ca.crt=caroot.pem \
|
||||
--from-literal=password=&quot;SecretPassword&quot; \
|
||||
--from-literal=saslType=&quot;SCRAM-SHA-512&quot; \
|
||||
--from-literal=user=&quot;my-sasl-user&quot;
|
||||
</code></pre><p><em>NOTE:</em> It is important to use the same keys; <code>user</code>, <code>password</code> and <code>saslType</code>.</p>
|
||||
<p>Reference your secret and the namespace of the secret in the <code>config-kafka</code> ConfigMap:</p>
|
||||
<pre><code>apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: config-kafka
|
||||
namespace: knative-eventing
|
||||
data:
|
||||
bootstrapServers: &lt;bootstrap-servers&gt;
|
||||
authSecretName: &lt;kafka-auth-Secret&gt;
|
||||
authSecretNamespace: &lt;namespace&gt;
|
||||
</code></pre>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Apache Kafka Source Example</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/kafka/source/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/kafka/source/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>Tutorial on how to build and deploy a <code>KafkaSource</code> <a href="../../../sources/index.html">Eventing source</a> using a Knative Serving <code>Service</code>.</p>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<ul>
|
||||
<li>Ensure that you meet the <a href="../index.html">prerequisites listed in the Apache Kafka overview</a>.</li>
|
||||
<li>A Kubernetes cluster with <a href="../../../../install/index.html">Knative Kafka Source installed</a>.</li>
|
||||
</ul>
|
||||
<h2 id="apache-kafka-topic-optional">Apache Kafka Topic (Optional)</h2>
|
||||
<ol>
|
||||
<li>If using Strimzi, you can set a topic modifying <code>source/kafka-topic.yaml</code>
|
||||
with your desired:</li>
|
||||
</ol>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Topic</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Cluster Name</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Partitions</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Replicas</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka.strimzi.io/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaTopic</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-demo-topic</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">strimzi.io/cluster</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">my-cluster</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">partitions</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">3</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">replicas</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">config</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">retention.ms</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">7200000</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">segment.bytes</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1073741824</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
</ul>
|
||||
<ol start="2">
|
||||
<li>
|
||||
<p>Deploy the <code>KafkaTopic</code></p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ kubectl apply -f strimzi-topic.yaml
|
||||
kafkatopic.kafka.strimzi.io/knative-demo-topic created
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Ensure the <code>KafkaTopic</code> is running.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ kubectl -n kafka get kafkatopics.kafka.strimzi.io
|
||||
NAME AGE
|
||||
knative-demo-topic 16s
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h2 id="create-the-event-display-service">Create the Event Display service</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Download a copy of the code:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">git clone -b <span style="color:#4e9a06">&#34;{{&lt; branch &gt;}}&#34;</span> https://github.com/knative/docs knative-docs
|
||||
<span style="color:#204a87">cd</span> knative-docs/docs/eventing/samples/kafka/source
|
||||
</code></pre></div></li>
|
||||
<li>
|
||||
<p>Build the Event Display Service (<code>event-display.yaml</code>)</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">namespace</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">default</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#8f5902;font-style:italic"># This corresponds to</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># https://github.com/knative/eventing-contrib/tree/master/cmd/event_display/main.go</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Deploy the Event Display Service</p>
|
||||
<pre><code>$ kubectl apply --filename event-display.yaml
|
||||
...
|
||||
service.serving.knative.dev/event-display created
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Ensure that the Service pod is running. The pod name will be prefixed with
|
||||
<code>event-display</code>.</p>
|
||||
<pre><code>$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
event-display-00001-deployment-5d5df6c7-gv2j4 2/2 Running 0 72s
|
||||
...
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="apache-kafka-event-source">Apache Kafka Event Source</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Modify <code>source/event-source.yaml</code> accordingly with bootstrap servers, topics,
|
||||
etc&hellip;:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-source</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">consumerGroup</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-group</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">my-cluster-kafka-bootstrap.kafka:9092</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># note the kafka namespace</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">topics</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">knative-demo-topic</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
<li>
|
||||
<p>Deploy the event source.</p>
|
||||
<pre><code>$ kubectl apply -f event-source.yaml
|
||||
...
|
||||
kafkasource.sources.knative.dev/kafka-source created
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Check that the event source pod is running. The pod name will be prefixed
|
||||
with <code>kafka-source</code>.</p>
|
||||
<pre><code>$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
kafka-source-xlnhq-5544766765-dnl5s 1/1 Running 0 40m
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Ensure the Apache Kafka Event Source started with the necessary
|
||||
configuration.</p>
|
||||
<pre><code>$ kubectl logs --selector='knative-eventing-source-name=kafka-source'
|
||||
{&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-05-28T10:39:42.104Z&quot;,&quot;caller&quot;:&quot;adapter/adapter.go:81&quot;,&quot;msg&quot;:&quot;Starting with config: &quot;,&quot;Topics&quot;:&quot;.&quot;,&quot;ConsumerGroup&quot;:&quot;...&quot;,&quot;SinkURI&quot;:&quot;...&quot;,&quot;Name&quot;:&quot;.&quot;,&quot;Namespace&quot;:&quot;.&quot;}
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h3 id="verify">Verify</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Produce a message (<code>{&quot;msg&quot;: &quot;This is a test!&quot;}</code>) to the Apache Kafka topic,
|
||||
like shown below:</p>
|
||||
<pre><code>kubectl -n kafka run kafka-producer -ti --image=strimzi/kafka:0.14.0-kafka-2.3.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap:9092 --topic knative-demo-topic
|
||||
If you don't see a command prompt, try pressing enter.
|
||||
&gt;{&quot;msg&quot;: &quot;This is a test!&quot;}
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Check that the Apache Kafka Event Source consumed the message and sent it to
|
||||
its sink properly. Since these logs are captured in debug level, edit the key <code>level</code> of <code>config-logging</code> configmap in <code>knative-sources</code> namespace to look like this:</p>
|
||||
<pre><code>data:
|
||||
loglevel.controller: info
|
||||
loglevel.webhook: info
|
||||
zap-logger-config: |
|
||||
{
|
||||
&quot;level&quot;: &quot;debug&quot;,
|
||||
&quot;development&quot;: false,
|
||||
&quot;outputPaths&quot;: [&quot;stdout&quot;],
|
||||
&quot;errorOutputPaths&quot;: [&quot;stderr&quot;],
|
||||
&quot;encoding&quot;: &quot;json&quot;,
|
||||
&quot;encoderConfig&quot;: {
|
||||
&quot;timeKey&quot;: &quot;ts&quot;,
|
||||
&quot;levelKey&quot;: &quot;level&quot;,
|
||||
&quot;nameKey&quot;: &quot;logger&quot;,
|
||||
&quot;callerKey&quot;: &quot;caller&quot;,
|
||||
&quot;messageKey&quot;: &quot;msg&quot;,
|
||||
&quot;stacktraceKey&quot;: &quot;stacktrace&quot;,
|
||||
&quot;lineEnding&quot;: &quot;&quot;,
|
||||
&quot;levelEncoder&quot;: &quot;&quot;,
|
||||
&quot;timeEncoder&quot;: &quot;iso8601&quot;,
|
||||
&quot;durationEncoder&quot;: &quot;&quot;,
|
||||
&quot;callerEncoder&quot;: &quot;&quot;
|
||||
}
|
||||
}
|
||||
|
||||
</code></pre><p>Now manually delete the kafkasource deployment and allow the <code>kafka-controller-manager</code> deployment running in <code>knative-sources</code> namespace to redeploy it. Debug level logs should be visible now.</p>
|
||||
<pre><code>$ kubectl logs --selector='knative-eventing-source-name=kafka-source'
|
||||
...
|
||||
|
||||
{&quot;level&quot;:&quot;debug&quot;,&quot;ts&quot;:&quot;2020-05-28T10:40:29.400Z&quot;,&quot;caller&quot;:&quot;kafka/consumer_handler.go:77&quot;,&quot;msg&quot;:&quot;Message claimed&quot;,&quot;topic&quot;:&quot;.&quot;,&quot;value&quot;:&quot;.&quot;}
|
||||
{&quot;level&quot;:&quot;debug&quot;,&quot;ts&quot;:&quot;2020-05-28T10:40:31.722Z&quot;,&quot;caller&quot;:&quot;kafka/consumer_handler.go:89&quot;,&quot;msg&quot;:&quot;Message marked&quot;,&quot;topic&quot;:&quot;.&quot;,&quot;value&quot;:&quot;.&quot;}
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Ensure the Event Display received the message sent to it by the Event Source.</p>
|
||||
<pre><code>$ kubectl logs --selector='serving.knative.dev/service=event-display' -c user-container
|
||||
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.kafka.event
|
||||
source: /apis/v1/namespaces/default/kafkasources/kafka-source#my-topic
|
||||
subject: partition:0#564
|
||||
id: partition:0/offset:564
|
||||
time: 2020-02-10T18:10:23.861866615Z
|
||||
datacontenttype: application/json
|
||||
Extensions,
|
||||
key:
|
||||
Data,
|
||||
{
|
||||
&quot;msg&quot;: &quot;This is a test!&quot;
|
||||
}
|
||||
</code></pre></li>
|
||||
</ol>
|
||||
<h2 id="teardown-steps">Teardown Steps</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Remove the Apache Kafka Event Source</p>
|
||||
<pre><code>
|
||||
$ kubectl delete -f source/source.yaml kafkasource.sources.knative.dev
|
||||
&quot;kafka-source&quot; deleted
|
||||
|
||||
</code></pre><ol start="2">
|
||||
<li>Remove the Event Display</li>
|
||||
</ol>
|
||||
<pre><code>
|
||||
$ kubectl delete -f source/event-display.yaml service.serving.knative.dev
|
||||
&quot;event-display&quot; deleted
|
||||
|
||||
</code></pre><ol start="3">
|
||||
<li>Remove the Apache Kafka Event Controller</li>
|
||||
</ol>
|
||||
<pre><code>
|
||||
$ kubectl delete -f https://storage.googleapis.com/knative-releases/eventing-contrib/latest/kafka-source.yaml
|
||||
serviceaccount &quot;kafka-controller-manager&quot; deleted
|
||||
clusterrole.rbac.authorization.k8s.io &quot;eventing-sources-kafka-controller&quot;
|
||||
deleted clusterrolebinding.rbac.authorization.k8s.io
|
||||
&quot;eventing-sources-kafka-controller&quot; deleted
|
||||
customresourcedefinition.apiextensions.k8s.io &quot;kafkasources.sources.knative.dev&quot;
|
||||
deleted service &quot;kafka-controller&quot; deleted statefulset.apps
|
||||
&quot;kafka-controller-manager&quot; deleted
|
||||
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>(Optional) Remove the Apache Kafka Topic</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ kubectl delete -f kafka-topic.yaml
|
||||
kafkatopic.kafka.strimzi.io <span style="color:#4e9a06">&#34;knative-demo-topic&#34;</span> deleted
|
||||
</code></pre></div></li>
|
||||
</ol>
|
||||
<h2 id="optional-specify-the-key-deserializer">(Optional) Specify the key deserializer</h2>
|
||||
<p>When <code>KafkaSource</code> receives a message from Kafka, it dumps the key in the Event
|
||||
extension called <code>Key</code> and dumps Kafka message headers in the extensions
|
||||
starting with <code>kafkaheader</code>.</p>
|
||||
<p>You can specify the key deserializer among four types:</p>
|
||||
<ul>
|
||||
<li><code>string</code> (default) for UTF-8 encoded strings</li>
|
||||
<li><code>int</code> for 32-bit &amp; 64-bit signed integers</li>
|
||||
<li><code>float</code> for 32-bit &amp; 64-bit floating points</li>
|
||||
<li><code>byte-array</code> for a Base64 encoded byte array</li>
|
||||
</ul>
|
||||
<p>To specify it, add the label <code>kafkasources.sources.knative.dev/key-type</code> to the <code>KafkaSource</code> definition like:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-source</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kafkasources.sources.knative.dev/key-type</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">int</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">consumerGroup</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-group</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">my-cluster-kafka-bootstrap.kafka:9092</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic"># note the kafka namespace</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">topics</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#000">knative-demo-topic</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><h2 id="connecting-to-a-tls-enabled-kafka-broker">Connecting to a TLS enabled Kafka broker</h2>
|
||||
<p>The KafkaSource supports TLS and SASL authentication methods. For enabling TLS authentication, please have the below files</p>
|
||||
<ul>
|
||||
<li>CA Certificate</li>
|
||||
<li>Client Certificate and Key</li>
|
||||
</ul>
|
||||
<p>KafkaSource expects these files to be in pem format, if it is in other format like jks, please convert to pem.</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create the certificate files as secrets in the namespace where KafkaSource is going to be set up</p>
|
||||
<pre><code>
|
||||
$ kubectl create secret generic cacert --from-file=caroot.pem
|
||||
secret/cacert created
|
||||
|
||||
$ kubectl create secret tls kafka-secret --cert=certificate.pem --key=key.pem
|
||||
secret/key created
|
||||
|
||||
|
||||
</code></pre></li>
|
||||
<li>
|
||||
<p>Apply the KafkaSource, change bootstrapServers and topics accordingly.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">KafkaSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-source-with-tls</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">net</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">tls</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">enable</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">cert</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">tls.crt</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">tls.key</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">kafka-secret</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">caCert</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">secretKeyRef</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">key</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">caroot.pem</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">cacert</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">consumerGroup</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">knative-group</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">bootstrapServers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span>- <span style="color:#000">my-secure-kafka-bootstrap.kafka:443</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">topics</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span>- <span style="color:#000">knative-demo-topic</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div></li>
|
||||
</ol>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,25 +0,0 @@
|
|||
apiVersion: kafka.strimzi.io/v1beta1
|
||||
kind: Kafka
|
||||
metadata:
|
||||
name: my-cluster
|
||||
spec:
|
||||
kafka:
|
||||
version: 2.4.0
|
||||
replicas: 1
|
||||
listeners:
|
||||
plain: {}
|
||||
tls: {}
|
||||
config:
|
||||
offsets.topic.replication.factor: 1
|
||||
transaction.state.log.replication.factor: 1
|
||||
transaction.state.log.min.isr: 1
|
||||
log.message.format.version: "2.4"
|
||||
storage:
|
||||
type: ephemeral
|
||||
zookeeper:
|
||||
replicas: 3
|
||||
storage:
|
||||
type: ephemeral
|
||||
entityOperator:
|
||||
topicOperator: {}
|
||||
userOperator: {}
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
# Turn colors in this script off by setting the NO_COLOR variable in your
|
||||
# environment to any value:
|
||||
#
|
||||
# $ NO_COLOR=1 test.sh
|
||||
NO_COLOR=${NO_COLOR:-""}
|
||||
if [ -z "$NO_COLOR" ]; then
|
||||
header=$'\e[1;33m'
|
||||
reset=$'\e[0m'
|
||||
else
|
||||
header=''
|
||||
reset=''
|
||||
fi
|
||||
strimzi_version=`curl https://github.com/strimzi/strimzi-kafka-operator/releases/latest | awk -F 'tag/' '{print $2}' | awk -F '"' '{print $1}' 2>/dev/null`
|
||||
function header_text {
|
||||
echo "$header$*$reset"
|
||||
}
|
||||
header_text "Using Strimzi Version: ${strimzi_version}"
|
||||
header_text "Strimzi install"
|
||||
kubectl create namespace kafka
|
||||
curl -L "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${strimzi_version}/strimzi-cluster-operator-${strimzi_version}.yaml" \
|
||||
| sed 's/namespace: .*/namespace: kafka/' \
|
||||
| kubectl -n kafka apply -f -
|
||||
header_text "Applying Strimzi Cluster file"
|
||||
kubectl -n kafka apply -f "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/${strimzi_version}/examples/kafka/kafka-ephemeral-single.yaml"
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2019 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,78 +0,0 @@
|
|||
# Copyright 2019 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Replace the following before applying this file:
|
||||
# KAFKA_CONSUMER_GROUP_NAME: Name of Kafka consumer group
|
||||
# KAFKA_BOOTSTRAP_SERVERS: Comma-separated list of bootstrap servers
|
||||
# KAFKA_TOPICS: Comma-separated list of topics
|
||||
# KAFKA_SASL_ENABLE: Truthy value to enable/disable SASL, disabled by default (optional)
|
||||
# KAFKA_SASL_USER_SECRET_NAME: Name of secret containing SASL user (optional)
|
||||
# KAFKA_SASL_USER_SECRET_KEY: Key within secret containing SASL user (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_NAME: Name of secret containing SASL password (optional)
|
||||
# KAFKA_SASL_PASSWORD_SECRET_KEY: Key within secret containing SASL password (optional)
|
||||
# KAFKA_TLS_ENABLE: Truthy to enable TLS, disabled by default (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_NAME: Name of secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CERT_SECRET_KEY: Key within secret containing client cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_NAME: Name of secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_KEY_SECRET_KEY: Key within secret containing client key to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_NAME: Name of secret containing server CA cert to use when connecting with TLS (optional)
|
||||
# KAFKA_TLS_CA_CERT_SECRET_KEY: Key within secret containing server CA cert to use when connecting with TLS (optional)
|
||||
|
||||
apiVersion: sources.knative.dev/v1beta1
|
||||
kind: KafkaSource
|
||||
metadata:
|
||||
name: kafka-source
|
||||
spec:
|
||||
consumerGroup: KAFKA_CONSUMER_GROUP_NAME
|
||||
bootstrapServers:
|
||||
- KAFKA_BOOTSTRAP_SERVERS
|
||||
topics:
|
||||
- KAFKA_TOPICS
|
||||
net:
|
||||
sasl:
|
||||
enable: KAFKA_SASL_ENABLE
|
||||
user:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_USER_SECRET_NAME
|
||||
key: KAFKA_SASL_USER_SECRET_KEY
|
||||
password:
|
||||
secretKeyRef:
|
||||
name: KAFKA_SASL_PASSWORD_SECRET_NAME
|
||||
key: KAFKA_SASL_PASSWORD_SECRET_KEY
|
||||
tls:
|
||||
enable: KAFKA_TLS_ENABLE
|
||||
cert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CERT_SECRET_KEY
|
||||
key:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_KEY_SECRET_NAME
|
||||
key: KAFKA_TLS_KEY_SECRET_KEY
|
||||
caCert:
|
||||
secretKeyRef:
|
||||
name: KAFKA_TLS_CA_CERT_SECRET_NAME
|
||||
key: KAFKA_TLS_CA_CERT_SECRET_KEY
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: event-display
|
|
@ -1,27 +0,0 @@
|
|||
# Copyright 2019 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: kafka.strimzi.io/v1beta1
|
||||
kind: KafkaTopic
|
||||
metadata:
|
||||
name: knative-demo-topic
|
||||
namespace: kafka
|
||||
labels:
|
||||
strimzi.io/cluster: my-cluster
|
||||
spec:
|
||||
partitions: 3
|
||||
replicas: 1
|
||||
config:
|
||||
retention.ms: 7200000
|
||||
segment.bytes: 1073741824
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: sources.knative.dev/v1
|
||||
kind: ApiServerSource
|
||||
metadata:
|
||||
name: testevents
|
||||
namespace: default
|
||||
spec:
|
||||
serviceAccountName: events-sa
|
||||
mode: Resource
|
||||
resources:
|
||||
- apiVersion: v1
|
||||
kind: Event
|
||||
sink:
|
||||
ref:
|
||||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Broker
|
||||
name: default
|
|
@ -1,37 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: events-sa
|
||||
namespace: default
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: event-watcher
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: k8s-ra-event-watcher
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: event-watcher
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: events-sa
|
||||
namespace: default
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
apiVersion: eventing.knative.dev/v1
|
||||
kind: Trigger
|
||||
metadata:
|
||||
name: testevents-trigger
|
||||
namespace: default
|
||||
spec:
|
||||
broker: default
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
name: event-display
|
||||
|
||||
---
|
||||
|
||||
# This is a very simple Knative Service that writes the input request to its log.
|
||||
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
namespace: default
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- # This corresponds to
|
||||
# https://github.com/knative/eventing-contrib/tree/master/cmd/event_display/main.go
|
||||
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,375 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Parallel Example</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/parallel/</link>
|
||||
<description>Recent content in Parallel Example on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/parallel/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Multiple Cases</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/parallel/multiple-branches/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/parallel/multiple-branches/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>We are going to create a Parallel with two branches:</p>
|
||||
<ul>
|
||||
<li>the first branch accepts events with a time that is is even</li>
|
||||
<li>the second branch accepts events with a time that is is odd</li>
|
||||
</ul>
|
||||
<p>The events produced by each branch are then sent to the <code>event-display</code> service.</p>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<p>Please refer to the sample overview for the <a href="../index.html">prerequisites</a>.</p>
|
||||
<h3 id="create-the-knative-services">Create the Knative Services</h3>
|
||||
<p>Let&rsquo;s first create the filter and transformer services that we will use in our
|
||||
Parallel.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">even-filter</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/filter-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">FILTER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Math.round(Date.parse(event.time) / 60000) % 2 === 0</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-filter</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/filter-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">FILTER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Math.round(Date.parse(event.time) / 60000) % 2 !== 0</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">even-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/transformer-nodejs</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TRANSFORMER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">({&#34;message&#34;: &#34;we are even!&#34;})</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/transformer-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TRANSFORMER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">({&#34;message&#34;: &#34;this is odd!&#34;})</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./filters.yaml -f ./transformers.yaml
|
||||
</code></pre></div><h3 id="create-the-service-displaying-the-events-created-by-sequence">Create the Service displaying the events created by Sequence</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p>Change <code>default</code> below to create the <code>Sequence</code> in the Namespace where you want
|
||||
your resources to be created.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl -n default create -f ./event-display.yaml
|
||||
</code></pre></div><h3 id="create-the-parallel">Create the Parallel</h3>
|
||||
<p>The <code>parallel.yaml</code> file contains the specifications for creating the Parallel.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">flows.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-even-parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">channelTemplate</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">messaging.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">InMemoryChannel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">branches</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">even-filter</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">even-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-filter</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">reply</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./parallel.yaml
|
||||
</code></pre></div><h3 id="create-the-pingsource-targeting-the-parallel">Create the PingSource targeting the Parallel</h3>
|
||||
<p>This will create a PingSource which will send a CloudEvent with
|
||||
<code>{&quot;message&quot;: &quot;Even or odd?&quot;}</code> as the data payload every minute.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta2</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">PingSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">ping-source</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">schedule</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;*/1 * * * *&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">contentType</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;application/json&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;{&#34;message&#34;: &#34;Even or odd?&#34;}&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">flows.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-even-parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./ping-source.yaml
|
||||
</code></pre></div><h3 id="inspecting-the-results">Inspecting the results</h3>
|
||||
<p>You can now see the final output by inspecting the logs of the event-display
|
||||
pods. Note that since we set the <code>PingSource</code> to emit every minute, it might
|
||||
take some time for the events to show up in the logs.</p>
|
||||
<p>Let&rsquo;s look at the <code>event-display</code> log:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl logs -l serving.knative.dev/service<span style="color:#ce5c00;font-weight:bold">=</span>event-display --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">30</span> -c user-container
|
||||
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.sources.ping
|
||||
source: /apis/v1/namespaces/default/pingsources/ping-source
|
||||
id: 015a4cf4-8a43-44a9-8702-3d4171d27ba5
|
||||
time: 2020-03-03T21:24:00.0007254Z
|
||||
datacontenttype: application/json<span style="color:#000;font-weight:bold">;</span> <span style="color:#000">charset</span><span style="color:#ce5c00;font-weight:bold">=</span>utf-8
|
||||
Extensions,
|
||||
knativehistory: odd-even-parallel-kn-parallel-kn-channel.default.svc.cluster.local<span style="color:#000;font-weight:bold">;</span> odd-even-parallel-kn-parallel-0-kn-channel.default.svc.cluster.local
|
||||
traceparent: 00-41a139bf073f3cfcba7bb7ce7f1488fc-68a891ace985221a-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;message&#34;</span>: <span style="color:#4e9a06">&#34;we are even!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.sources.ping
|
||||
source: /apis/v1/namespaces/default/pingsources/ping-source
|
||||
id: 52e6b097-f914-4b5a-8539-165650e85bcd
|
||||
time: 2020-03-03T21:23:00.0004662Z
|
||||
datacontenttype: application/json<span style="color:#000;font-weight:bold">;</span> <span style="color:#000">charset</span><span style="color:#ce5c00;font-weight:bold">=</span>utf-8
|
||||
Extensions,
|
||||
knativehistory: odd-even-parallel-kn-parallel-kn-channel.default.svc.cluster.local<span style="color:#000;font-weight:bold">;</span> odd-even-parallel-kn-parallel-1-kn-channel.default.svc.cluster.local
|
||||
traceparent: 00-58d371410d7daf2033be226860b4ee5d-05d686ee90c3226f-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;message&#34;</span>: <span style="color:#4e9a06">&#34;this is odd!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
</code></pre></div>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>V0.21-Docs: Mutual Exclusive Cases</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/parallel/mutual-exclusivity/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>https://knative.dev/v0.21-docs/eventing/samples/parallel/mutual-exclusivity/</guid>
|
||||
<description>
|
||||
|
||||
|
||||
<p>In this example, we are going to see how we can create a Parallel with mutually
|
||||
exclusive branches.</p>
|
||||
<p>This example is the same as the
|
||||
<a href="../multiple-branches/index.html">multiple branches example</a> except that we are
|
||||
now going to rely on the Knative
|
||||
<a href="https://github.com/lionelvillard/knative-functions#switch">switch</a> function to
|
||||
provide a soft mutual exclusivity guarantee.</p>
|
||||
<p>NOTE: this example must be deployed in the default namespace.</p>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<p>Please refer to the sample overview for the <a href="../index.html">prerequisites</a>.</p>
|
||||
<h3 id="create-the-knative-services">Create the Knative Services</h3>
|
||||
<p>Let&rsquo;s first create the switcher and transformer services that we will use in our
|
||||
Parallel.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-even-odd-switcher</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/switcher-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">EXPRESSION</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Math.round(Date.parse(event.time) / 60000) % 2</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">CASES</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;[0, 1]&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">even-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/transformer-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TRANSFORMER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">({&#34;message&#34;: &#34;we are even!&#34;})</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">---</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">odd-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">villardl/transformer-nodejs:0.1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">env</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">TRANSFORMER</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">value</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">|</span><span style="color:#8f5902;font-style:italic">
|
||||
</span><span style="color:#8f5902;font-style:italic"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">({&#34;message&#34;: &#34;this is odd!&#34;})</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#000">.</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./switcher.yaml -f ./transformers.yaml
|
||||
</code></pre></div><h3 id="create-the-service-displaying-the-events-created-by-parallel">Create the Service displaying the events created by Parallel</h3>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">containers</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">image</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl -n default create -f ./event-display.yaml
|
||||
</code></pre></div><h3 id="create-the-parallel-object">Create the Parallel object</h3>
|
||||
<p>The <code>parallel.yaml</code> file contains the specifications for creating the Parallel
|
||||
object.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">flows.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-odd-even-parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">channelTemplate</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">messaging.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">InMemoryChannel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">branches</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">uri</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;http://me-even-odd-switcher.default.svc.cluster.local/0&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-even-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- <span style="color:#204a87;font-weight:bold">filter</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">uri</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;http://me-even-odd-switcher.default.svc.cluster.local/1&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">subscriber</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-odd-transformer</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">reply</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">serving.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Service</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-event-display</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./parallel.yaml
|
||||
</code></pre></div><h3 id="create-the-pingsource-targeting-the-parallel-object">Create the PingSource targeting the Parallel object</h3>
|
||||
<p>This will create a PingSource which will send a CloudEvent with
|
||||
<code>{&quot;message&quot;: &quot;Even or odd?&quot;}</code> as the data payload every minute.</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">sources.knative.dev/v1beta2</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">PingSource</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-ping-source</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">schedule</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;*/1 * * * *&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">contentType</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#34;application/json&#34;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;{&#34;message&#34;: &#34;Even or odd?&#34;}&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">sink</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">ref</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">flows.knative.dev/v1</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">Parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000">me-odd-even-parallel</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f ./ping-source.yaml
|
||||
</code></pre></div><h3 id="inspecting-the-results">Inspecting the results</h3>
|
||||
<p>You can now see the final output by inspecting the logs of the
|
||||
<code>me-event-display</code> pods. Note that since we set the <code>PingSource</code> to emit every
|
||||
minute, it might take some time for the events to show up in the logs.</p>
|
||||
<p>Let&rsquo;s look at the <code>me-event-display</code> log:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl logs -l serving.knative.dev/service<span style="color:#ce5c00;font-weight:bold">=</span>me-event-display --tail<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#0000cf;font-weight:bold">50</span> -c user-container
|
||||
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.sources.ping
|
||||
source: /apis/v1/namespaces/default/pingsources/me-ping-source
|
||||
id: 0b0db15c-9b36-4388-8eaa-8c23a9dc2707
|
||||
time: 2020-03-03T21:30:00.0007292Z
|
||||
datacontenttype: application/json<span style="color:#000;font-weight:bold">;</span> <span style="color:#000">charset</span><span style="color:#ce5c00;font-weight:bold">=</span>utf-8
|
||||
Extensions,
|
||||
knativehistory: me-odd-even-parallel-kn-parallel-kn-channel.default.svc.cluster.local<span style="color:#000;font-weight:bold">;</span> me-odd-even-parallel-kn-parallel-0-kn-channel.default.svc.cluster.local
|
||||
traceparent: 00-e8b17109cd21d4fa66a86633b5a614c7-ba96d220fe13211c-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;message&#34;</span>: <span style="color:#4e9a06">&#34;we are even!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
☁️ cloudevents.Event
|
||||
Validation: valid
|
||||
Context Attributes,
|
||||
specversion: 1.0
|
||||
type: dev.knative.sources.ping
|
||||
source: /apis/v1/namespaces/default/pingsources/me-ping-source
|
||||
id: 321170d1-dea7-4b18-9290-28adb1de089b
|
||||
time: 2020-03-03T21:31:00.0007847Z
|
||||
datacontenttype: application/json<span style="color:#000;font-weight:bold">;</span> <span style="color:#000">charset</span><span style="color:#ce5c00;font-weight:bold">=</span>utf-8
|
||||
Extensions,
|
||||
knativehistory: me-odd-even-parallel-kn-parallel-kn-channel.default.svc.cluster.local<span style="color:#000;font-weight:bold">;</span> me-odd-even-parallel-kn-parallel-1-kn-channel.default.svc.cluster.local
|
||||
traceparent: 00-78d8b044d23c85789f0a13fd3679ac24-1d69ddde56d620c7-00
|
||||
Data,
|
||||
<span style="color:#ce5c00;font-weight:bold">{</span>
|
||||
<span style="color:#4e9a06">&#34;message&#34;</span>: <span style="color:#4e9a06">&#34;this is odd!&#34;</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">}</span>
|
||||
</code></pre></div>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,9 +0,0 @@
|
|||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: event-display
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
|
|
@ -1,27 +0,0 @@
|
|||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: even-filter
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: villardl/filter-nodejs:0.1
|
||||
env:
|
||||
- name: FILTER
|
||||
value: |
|
||||
Math.round(Date.parse(event.time) / 60000) % 2 === 0
|
||||
---
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: odd-filter
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: villardl/filter-nodejs:0.1
|
||||
env:
|
||||
- name: FILTER
|
||||
value: |
|
||||
Math.round(Date.parse(event.time) / 60000) % 2 !== 0
|
|
@ -1,17 +0,0 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Knative – Multiple Cases</title>
|
||||
<link>https://knative.dev/v0.21-docs/eventing/samples/parallel/multiple-branches/</link>
|
||||
<description>Recent content in Multiple Cases on Knative</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
|
||||
<atom:link href="https://knative.dev/v0.21-docs/eventing/samples/parallel/multiple-branches/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</channel>
|
||||
</rss>
|