mirror of https://github.com/knative/docs.git
1081 lines
84 KiB
XML
1081 lines
84 KiB
XML
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||
<channel>
|
||
<title>Knative – Knative Serving 'Cloud Events' samples</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/</link>
|
||
<description>Recent content in Knative Serving 'Cloud Events' samples on Knative</description>
|
||
<generator>Hugo -- gohugo.io</generator>
|
||
|
||
<atom:link href="https://knative.dev/docs/serving/samples/cloudevents/index.xml" rel="self" type="application/rss+xml" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - .NET Core</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-dotnet/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-dotnet/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in ASP.NET and C# that can receive and send Cloud Events that you
|
||
can use for testing. It supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working for the Knative Eventing <code>Broker</code> concept.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source)</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-dotnet
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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="the-sample-code">The sample code</h2>
|
||
<ol>
|
||
<li>
|
||
<p>If you look in <code>controllers\CloudEventsController.cs</code>, you will see two key functions for the
|
||
different modes of operation:</p>
|
||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-csharp" data-lang="csharp"><span style="color:#204a87;font-weight:bold">private</span> <span style="color:#204a87;font-weight:bold">async</span> <span style="color:#000">Task</span><span style="color:#000;font-weight:bold">&lt;</span><span style="color:#000">IActionResult</span><span style="color:#000;font-weight:bold">&gt;</span> <span style="color:#000">ReceiveAndSend</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">CloudEvent</span> <span style="color:#000">receivedEvent</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#8f5902;font-style:italic">// This is called whenever an event is received if $K_SINK is set, and sends a new event
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// to the url in $K_SINK.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
|
||
<span style="color:#204a87;font-weight:bold">private</span> <span style="color:#000">IActionResult</span> <span style="color:#000">ReceiveAndReply</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">CloudEvent</span> <span style="color:#000">receivedEvent</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#8f5902;font-style:italic">// This is called whenever an event is received if $K_SINK is NOT set, and it replies with
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// the new event instead.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
</code></pre></div></li>
|
||
<li>
|
||
<p>If you look in <code>Dockerfile</code>, you will see a method for pulling in the
|
||
dependencies and building an ASP.NET container based on Alpine. You can build
|
||
and push this to your registry of choice via:</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">docker build -t &lt;image&gt; .
|
||
docker push &lt;image&gt;
|
||
</code></pre></div></li>
|
||
<li>
|
||
<p>If you look in <code>service.yaml</code>, take the <code>&lt;image&gt;</code> name above and insert it
|
||
into the <code>image:</code> field.</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 service.yaml
|
||
</code></pre></div></li>
|
||
</ol>
|
||
<h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-dotnet http://cloudevents-dotnet... cloudevents-dotnet-ss5pj cloudevents-dotnet-ss5pj True
|
||
</code></pre></div><p>Then send a cloud event to it with:</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 -X POST <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> -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-source: curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> &lt;URL from kubectl <span style="color:#204a87">command</span> above&gt;
|
||
</code></pre></div><p>You will get back:</p>
|
||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json"><span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;specversion&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;1.0&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;type&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;dev.knative.docs.sample&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;source&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;https://github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-dotnet&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;id&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;d662b6f6-35ff-4b98-bffd-5ae9eee23dab&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;time&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;2020-05-19T01:26:23.3500138Z&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;datacontenttype&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;application/json&#34;</span><span style="color:#000;font-weight:bold">,</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;data&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#204a87;font-weight:bold">&#34;message&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;Hello, Dave&#34;</span>
|
||
<span style="color:#000;font-weight:bold">}</span>
|
||
<span style="color:#000;font-weight:bold">}</span>
|
||
</code></pre></div><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 service.yaml
|
||
</code></pre></div>
|
||
</description>
|
||
</item>
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - Go</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-go/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-go/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in Go that can receive and send Cloud Events that you
|
||
can use for testing. It supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working for the Knative Eventing <code>Broker</code> concept.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source)</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-go
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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="the-sample-code">The sample code.</h2>
|
||
<ol>
|
||
<li>
|
||
<p>If you look in <code>cloudevents.go</code>, you will see two key functions for the
|
||
different modes of operation:</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">func</span> <span style="color:#000;font-weight:bold">(</span><span style="color:#000">recv</span> <span style="color:#ce5c00;font-weight:bold">*</span><span style="color:#000">Receiver</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000">ReceiveAndSend</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">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:#8f5902;font-style:italic">// This is called whenever an event is received if $K_SINK is set, and sends a new event
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// to the url in $K_SINK.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
|
||
<span style="color:#204a87;font-weight:bold">func</span> <span style="color:#000;font-weight:bold">(</span><span style="color:#000">recv</span> <span style="color:#ce5c00;font-weight:bold">*</span><span style="color:#000">Receiver</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000">ReceiveAndReply</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">// This is called whenever an event is received if $K_SINK is NOT set, and it replies with
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// the new event instead.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
</code></pre></div></li>
|
||
<li>
|
||
<p>Choose how you would like to build the application:</p>
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_go_build" role="tablist">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_go_build-0-tab" data-toggle="tab" href="#cloudevents_go_build-0" role="tab" aria-controls="cloudevents_go_build-0" aria-selected="true">Dockerfile</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_go_build-1-tab" data-toggle="tab" href="#cloudevents_go_build-1" role="tab" aria-controls="cloudevents_go_build-1" aria-selected="true">ko</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_go_build-0" role="tabpanel" aria-labelledby="cloudevents_go_build-0-tab">
|
||
|
||
<p>If you look in <code>Dockerfile</code>, you will see a method for pulling in the
|
||
dependencies and building a small Go container based on Alpine. You can build
|
||
and push this to your registry of choice via:</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">docker build -t &lt;image&gt; .
|
||
docker push &lt;image&gt;
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_go_build-1" role="tabpanel" aria-labelledby="cloudevents_go_build-1-tab">
|
||
|
||
<p>You can use <a href="https://github.com/google/ko"><code>ko</code></a> to build and push just the image with:</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">ko publish github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-go
|
||
</code></pre></div><p>However, if you use <code>ko</code> for the next step, this is not necessary.</p>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</li>
|
||
<li>
|
||
<p>Choose how you would like to deploy the application:</p>
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_go_deploy" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_go_deploy-0-tab" data-toggle="tab" href="#cloudevents_go_deploy-0" role="tab" aria-controls="cloudevents_go_deploy-0" aria-selected="true">yaml (with Dockerfile)</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_go_deploy-1-tab" data-toggle="tab" href="#cloudevents_go_deploy-1" role="tab" aria-controls="cloudevents_go_deploy-1" aria-selected="true">yaml (with ko)</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_go_deploy-2-tab" data-toggle="tab" href="#cloudevents_go_deploy-2" role="tab" aria-controls="cloudevents_go_deploy-2" aria-selected="true">kn (with Dockerfile)</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_go_deploy-3-tab" data-toggle="tab" href="#cloudevents_go_deploy-3" role="tab" aria-controls="cloudevents_go_deploy-3" aria-selected="true">kn (with ko)</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_go_deploy-0" role="tabpanel" aria-labelledby="cloudevents_go_deploy-0-tab">
|
||
|
||
<p>If you look in <code>service.yaml</code>, take the <code>&lt;image&gt;</code> name above and insert it
|
||
into the <code>image:</code> field, then run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_go_deploy-1" role="tabpanel" aria-labelledby="cloudevents_go_deploy-1-tab">
|
||
|
||
<p>If using <code>ko</code> to build and push:</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">ko apply -f service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_go_deploy-2" role="tabpanel" aria-labelledby="cloudevents_go_deploy-2-tab">
|
||
|
||
<p>If using <code>kn</code> to deploy:</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">kn service create cloudevents-go --image<span style="color:#ce5c00;font-weight:bold">=</span>&lt;IMAGE&gt;
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_go_deploy-3" role="tabpanel" aria-labelledby="cloudevents_go_deploy-3-tab">
|
||
|
||
<p>You can compose <code>kn</code> and <code>ko</code> to build and deploy with a single step using:</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">kn service create cloudevents-go --image<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87;font-weight:bold">$(</span>ko publish github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-go<span style="color:#204a87;font-weight:bold">)</span>
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</li>
|
||
</ol>
|
||
<h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-go http://cloudevents-go.default.1.2.3.4.sslip.io cloudevents-go-ss5pj cloudevents-go-ss5pj True
|
||
</code></pre></div><p>Then send a cloud event to it with:</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 -X POST <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> -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-source: curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-go.default.1.2.3.4.sslip.io
|
||
</code></pre></div><p>You will get back:</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:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;message&#34;</span>:<span style="color:#4e9a06">&#34;Hello, Dave&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||
</code></pre></div><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 service.yaml
|
||
</code></pre></div>
|
||
</description>
|
||
</item>
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - Java and Spring</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-spring/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-spring/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in Java using Spring Cloud Function that can receive CloudEvents. It
|
||
supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working with the Knative Eventing <code>Broker</code> concept. The
|
||
input event is modified assigning a new source and type attribute.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source). The input event is modified assigning a new
|
||
source and type attribute.</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-spring
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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="build-and-deploy-the-sample">Build and deploy the sample</h2>
|
||
<p>To build the image, run:</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">mvn compile jib:build -Dimage<span style="color:#ce5c00;font-weight:bold">=</span>&lt;image_name&gt;
|
||
</code></pre></div><p>To deploy the Knative Service, edit the <code>service.yaml</code> file and replace <code>&lt;image&gt;</code>
|
||
with the deployed image name. Then run:</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 service.yaml
|
||
</code></pre></div><h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-spring http://cloudevents-java.sslip.io cloudevents-spring-86h28 cloudevents-spring-86h28 True
|
||
</code></pre></div><p>Then send a CloudEvent to it with:</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 <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-java.sslip.io
|
||
</code></pre></div><p>You can also send CloudEvents spawning a temporary curl pod in your cluster
|
||
with:</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 run curl <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> --image<span style="color:#ce5c00;font-weight:bold">=</span>curlimages/curl --rm<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87">true</span> --restart<span style="color:#ce5c00;font-weight:bold">=</span>Never -ti -- <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-java.default.svc
|
||
</code></pre></div><p>You&rsquo;ll see on the console:</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">&gt; POST / HTTP/1.1
|
||
&gt; Host: localhost:8080
|
||
&gt; User-Agent: curl/7.69.1
|
||
&gt; Accept: */*
|
||
&gt; content-type: application/json
|
||
&gt; ce-specversion: 1.0
|
||
&gt; ce-source: http://curl-command
|
||
&gt; ce-type: curl.demo
|
||
&gt; ce-id: 123-abc
|
||
&gt; Content-Length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&gt;
|
||
&lt; HTTP/1.1 <span style="color:#0000cf;font-weight:bold">202</span> Accepted
|
||
&lt; ce-specversion: 1.0
|
||
&lt; ce-id: 123-abc
|
||
&lt; ce-source: https://github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-spring
|
||
&lt; ce-type: curl.demo
|
||
&lt; content-type: application/json
|
||
&lt; content-length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&lt;
|
||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;name&#34;</span>:<span style="color:#4e9a06">&#34;Dave&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||
</code></pre></div><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 service.yaml
|
||
</code></pre></div><h2 id="removing-the-sample-app-deployment-1">Removing the sample app deployment</h2>
|
||
<p>To remove the sample app from your cluster, delete the service:</p>
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_spring_delete" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_spring_delete-0-tab" data-toggle="tab" href="#cloudevents_spring_delete-0" role="tab" aria-controls="cloudevents_spring_delete-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_spring_delete-1-tab" data-toggle="tab" href="#cloudevents_spring_delete-1" role="tab" aria-controls="cloudevents_spring_delete-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_spring_delete-0" role="tabpanel" aria-labelledby="cloudevents_spring_delete-0-tab">
|
||
|
||
<p>Run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_spring_delete-1" role="tabpanel" aria-labelledby="cloudevents_spring_delete-1-tab">
|
||
|
||
<p>Run:</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">kn service delete cloudevents-spring
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</description>
|
||
</item>
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - Java and Vert.x</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-vertx/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-vertx/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in Java using Vert.x that can receive CloudEvents. It
|
||
supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working for the Knative Eventing <code>Broker</code> concept. The
|
||
input event is modified assigning a new source and type attribute.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source). The input event is modified assigning a new
|
||
source and type attribute.</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-vertx
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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="build-and-deploy-the-sample">Build and deploy the sample</h2>
|
||
<p>To build the image, run:</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">mvn compile jib:build -Dimage<span style="color:#ce5c00;font-weight:bold">=</span>&lt;image_name&gt;
|
||
</code></pre></div>
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_vertx_deploy" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_vertx_deploy-0-tab" data-toggle="tab" href="#cloudevents_vertx_deploy-0" role="tab" aria-controls="cloudevents_vertx_deploy-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_vertx_deploy-1-tab" data-toggle="tab" href="#cloudevents_vertx_deploy-1" role="tab" aria-controls="cloudevents_vertx_deploy-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_vertx_deploy-0" role="tabpanel" aria-labelledby="cloudevents_vertx_deploy-0-tab">
|
||
|
||
<p>To deploy the Knative Service, look in the <code>service.yaml</code> and replace <code>&lt;image&gt;</code> with the deployed image name. Then run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_vertx_deploy-1" role="tabpanel" aria-labelledby="cloudevents_vertx_deploy-1-tab">
|
||
|
||
<p>If using <code>kn</code> to deploy:</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">kn service create cloudevents-vertx --image<span style="color:#ce5c00;font-weight:bold">=</span>&lt;image&gt;
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-vertx http://cloudevents-java.sslip.io cloudevents-vertx-86h28 cloudevents-vertx-86h28 True
|
||
</code></pre></div><p>Then send a CloudEvent to it with:</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 <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-java.sslip.io
|
||
</code></pre></div><p>You can also send CloudEvents spawning a temporary curl pod in your cluster
|
||
with:</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 run curl <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> --image<span style="color:#ce5c00;font-weight:bold">=</span>curlimages/curl --rm<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87">true</span> --restart<span style="color:#ce5c00;font-weight:bold">=</span>Never -ti -- <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-java.default.svc
|
||
</code></pre></div><p>You&rsquo;ll see on the console:</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">&gt; POST / HTTP/1.1
|
||
&gt; Host: localhost:8080
|
||
&gt; User-Agent: curl/7.69.1
|
||
&gt; Accept: */*
|
||
&gt; content-type: application/json
|
||
&gt; ce-specversion: 1.0
|
||
&gt; ce-source: http://curl-command
|
||
&gt; ce-type: curl.demo
|
||
&gt; ce-id: 123-abc
|
||
&gt; Content-Length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&gt;
|
||
&lt; HTTP/1.1 <span style="color:#0000cf;font-weight:bold">202</span> Accepted
|
||
&lt; ce-specversion: 1.0
|
||
&lt; ce-id: 123-abc
|
||
&lt; ce-source: https://github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-vertx
|
||
&lt; ce-type: curl.demo
|
||
&lt; content-type: application/json
|
||
&lt; content-length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&lt;
|
||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;name&#34;</span>:<span style="color:#4e9a06">&#34;Dave&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||
</code></pre></div><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:</p>
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_vertx_delete" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_vertx_delete-0-tab" data-toggle="tab" href="#cloudevents_vertx_delete-0" role="tab" aria-controls="cloudevents_vertx_delete-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_vertx_delete-1-tab" data-toggle="tab" href="#cloudevents_vertx_delete-1" role="tab" aria-controls="cloudevents_vertx_delete-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_vertx_delete-0" role="tabpanel" aria-labelledby="cloudevents_vertx_delete-0-tab">
|
||
|
||
<p>Run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_vertx_delete-1" role="tabpanel" aria-labelledby="cloudevents_vertx_delete-1-tab">
|
||
|
||
<p>Run:</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">kn service delete cloudevents-vertx
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</description>
|
||
</item>
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - Node.js</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-nodejs/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-nodejs/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in Node.js that can receive and send Cloud Events that you
|
||
can use for testing. It supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working for the Knative Eventing <code>Broker</code> concept.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source)</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-nodejs
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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="the-sample-code">The Sample Code</h2>
|
||
<p>In the <code>index.js</code> file, you will see two key functions for the different modes
|
||
of operation:</p>
|
||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-js" data-lang="js"><span style="color:#204a87;font-weight:bold">const</span> <span style="color:#000">receiveAndSend</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">(</span><span style="color:#000">cloudEvent</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">res</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">=&gt;</span> <span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#8f5902;font-style:italic">// This is called whenever an event is received if $K_SINK is set, and sends a new event
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// to the url in $K_SINK.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
|
||
<span style="color:#204a87;font-weight:bold">const</span> <span style="color:#000">receiveAndReply</span> <span style="color:#ce5c00;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">(</span><span style="color:#000">cloudEvent</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">res</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">=&gt;</span> <span style="color:#000;font-weight:bold">{</span>
|
||
<span style="color:#8f5902;font-style:italic">// This is called whenever an event is received if $K_SINK is NOT set, and it replies with
|
||
</span><span style="color:#8f5902;font-style:italic"></span> <span style="color:#8f5902;font-style:italic">// the new event instead.
|
||
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#000;font-weight:bold">}</span>
|
||
</code></pre></div><h2 id="build-and-deploy-the-application">Build and Deploy the Application</h2>
|
||
<p>In the <code>Dockerfile</code>, you can see how the dependencies are installed using npm.
|
||
You can build and push this to your registry of choice via:</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">docker build -t &lt;image&gt; .
|
||
docker push &lt;image&gt;
|
||
</code></pre></div>
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_nodejs_deploy" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_nodejs_deploy-0-tab" data-toggle="tab" href="#cloudevents_nodejs_deploy-0" role="tab" aria-controls="cloudevents_nodejs_deploy-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_nodejs_deploy-1-tab" data-toggle="tab" href="#cloudevents_nodejs_deploy-1" role="tab" aria-controls="cloudevents_nodejs_deploy-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_nodejs_deploy-0" role="tabpanel" aria-labelledby="cloudevents_nodejs_deploy-0-tab">
|
||
|
||
<p>To deploy the Knative service, edit the <code>service.yaml</code> file and replace
|
||
<code>&lt;registry/repository/image:tag&gt;</code> with the image you have just 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 apply -f service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_nodejs_deploy-1" role="tabpanel" aria-labelledby="cloudevents_nodejs_deploy-1-tab">
|
||
|
||
<p>To deploy using the <code>kn</code> CLI:</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">kn service create cloudevents-nodejs --image<span style="color:#ce5c00;font-weight:bold">=</span>&lt;image&gt;
|
||
</code></pre></div><p>{{ /tab }}{{ /tabs }}</p>
|
||
<h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-nodejs http://cloudevents-nodejs.default.1.2.3.4.sslip.io cloudevents-nodejs-ss5pj cloudevents-nodejs-ss5pj True
|
||
</code></pre></div><p>Then send a cloud event to it with:</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 -X POST <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> -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-source: curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-nodejs.default.1.2.3.4.sslip.io
|
||
</code></pre></div><p>You will get back:</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:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;message&#34;</span>:<span style="color:#4e9a06">&#34;Hello, Dave&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||
</code></pre></div><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.</p>
|
||
<ul class="nav nav-tabs" id="cloudevents_nodejs_delete" role="tablist">
|
||
<pre><code>&lt;li class=&quot;nav-item &quot;&gt;
|
||
&lt;a class=&quot;nav-link &quot; id=&quot;cloudevents_nodejs_delete-0-tab&quot; data-toggle=&quot;tab&quot; href=&quot;#cloudevents_nodejs_delete-0&quot; role=&quot;tab&quot; aria-controls=&quot;cloudevents_nodejs_delete-0&quot; aria-selected=&quot;true&quot;&gt;yaml&lt;/a&gt;
|
||
&lt;/li&gt;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
&lt;li class=&quot;nav-item active&quot;&gt;
|
||
&lt;a class=&quot;nav-link active&quot; id=&quot;cloudevents_nodejs_delete-1-tab&quot; data-toggle=&quot;tab&quot; href=&quot;#cloudevents_nodejs_delete-1&quot; role=&quot;tab&quot; aria-controls=&quot;cloudevents_nodejs_delete-1&quot; aria-selected=&quot;true&quot;&gt;kn&lt;/a&gt;
|
||
&lt;/li&gt;
|
||
</code></pre>
|
||
</ul>
|
||
<div class="tab-content" >
|
||
<div class="tab-pane fade " id="cloudevents_nodejs_delete-0" role="tabpanel" aria-labelledby="cloudevents_nodejs_delete-0-tab">
|
||
<pre><code> &lt;p&gt;Run:&lt;/p&gt;
|
||
</code></pre>
|
||
<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 service.yaml
|
||
</code></pre></div>
|
||
</div>
|
||
<div class="tab-pane fade show active" id="cloudevents_nodejs_delete-1" role="tabpanel" aria-labelledby="cloudevents_nodejs_delete-1-tab">
|
||
<pre><code> &lt;p&gt;Run:&lt;/p&gt;
|
||
</code></pre>
|
||
<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">kn service delete cloudevents-nodejs
|
||
</code></pre></div><p>{{ /tab }}{{ /tabs }}</p>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</description>
|
||
</item>
|
||
|
||
<item>
|
||
<title>Docs: Cloud Events - Rust</title>
|
||
<link>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-rust/</link>
|
||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||
|
||
<guid>https://knative.dev/docs/serving/samples/cloudevents/cloudevents-rust/</guid>
|
||
<description>
|
||
|
||
|
||
<p>A simple web app written in Rust using <a href="https://github.com/actix/actix-web">Actix web</a>
|
||
that can receive CloudEvents. It supports running in two modes:</p>
|
||
<ol>
|
||
<li>
|
||
<p>The default mode has the app reply to your input events with the output
|
||
event, which is simplest for demonstrating things working in isolation, but
|
||
is also the model for working for the Knative Eventing <code>Broker</code> concept.
|
||
The input event is modified assigning a new source and type attribute.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>K_SINK</code> mode has the app send events to the destination encoded in
|
||
<code>$K_SINK</code>, which is useful to demonstrate how folks can synthesize events to
|
||
send to a Service or Broker when not initiated by a Broker invocation (e.g.
|
||
implementing an event source).
|
||
The input event is modified assigning a new source and type attribute.</p>
|
||
</li>
|
||
</ol>
|
||
<p>The application will use <code>$K_SINK</code>-mode whenever the environment variable is
|
||
specified.</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;release-0.23&#34;</span> https://github.com/knative/docs knative-docs
|
||
<span style="color:#204a87">cd</span> knative-docs/docs/serving/samples/cloudevents/cloudevents-rust
|
||
</code></pre></div><h2 id="before-you-begin">Before you begin</h2>
|
||
<ul>
|
||
<li>A Kubernetes cluster with Knative installed and DNS configured. Follow the
|
||
<a href="../../../../install/">installation instructions</a> if you need to
|
||
create one.</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>
|
||
<li>This guide uses Rust <code>musl</code> toolchain to build the image in order to create
|
||
really small docker images. To install the Rust toolchain: <a href="https://rustup.rs/"><code>rustup</code></a>.
|
||
To install musl support: <a href="https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html">MUSL support for fully static binaries</a>.</li>
|
||
</ul>
|
||
<h2 id="build-and-deploy-the-sample">Build and deploy the sample</h2>
|
||
<p>To build the binary, run:</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">cargo build --target x86_64-unknown-linux-musl --release
|
||
</code></pre></div><p>This will build a statically linked binary, in order to create an image from scratch. Now build the docker image:</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">docker build -t &lt;image&gt; .
|
||
</code></pre></div>
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_rust_deploy" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_rust_deploy-0-tab" data-toggle="tab" href="#cloudevents_rust_deploy-0" role="tab" aria-controls="cloudevents_rust_deploy-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_rust_deploy-1-tab" data-toggle="tab" href="#cloudevents_rust_deploy-1" role="tab" aria-controls="cloudevents_rust_deploy-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_rust_deploy-0" role="tabpanel" aria-labelledby="cloudevents_rust_deploy-0-tab">
|
||
|
||
<p>To deploy the Knative Service, look in the <code>service.yaml</code> and replace <code>&lt;image&gt;</code> with the deployed image name. Then run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_rust_deploy-1" role="tabpanel" aria-labelledby="cloudevents_rust_deploy-1-tab">
|
||
|
||
<p>If using <code>kn</code> to deploy:</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">kn service create cloudevents-rust --image<span style="color:#ce5c00;font-weight:bold">=</span>&lt;image&gt;
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<h2 id="testing-the-sample">Testing the sample</h2>
|
||
<p>Get the URL for your Service with:</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 ksvc
|
||
NAME URL LATESTCREATED LATESTREADY READY REASON
|
||
cloudevents-rust http://cloudevents-rust.sslip.io cloudevents-rust-vl8fq cloudevents-rust-vl8fq True
|
||
</code></pre></div><p>Then send a CloudEvent to it with:</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 <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-rust.sslip.io
|
||
</code></pre></div><p>You can also send CloudEvents spawning a temporary curl pod in your cluster with:</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 run curl <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> --image<span style="color:#ce5c00;font-weight:bold">=</span>curlimages/curl --rm<span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#204a87">true</span> --restart<span style="color:#ce5c00;font-weight:bold">=</span>Never -ti -- <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -X POST -v <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> -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-source: http://curl-command&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-type: curl.demo&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -H <span style="color:#4e9a06">&#34;ce-id: 123-abc&#34;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> -d <span style="color:#4e9a06">&#39;{&#34;name&#34;:&#34;Dave&#34;}&#39;</span> <span style="color:#4e9a06">\
|
||
</span><span style="color:#4e9a06"></span> http://cloudevents-rust.default.svc
|
||
</code></pre></div><p>You&rsquo;ll get as result:</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">&gt; POST / HTTP/1.1
|
||
&gt; Host: localhost:8080
|
||
&gt; User-Agent: curl/7.69.1
|
||
&gt; Accept: */*
|
||
&gt; content-type: application/json
|
||
&gt; ce-specversion: 1.0
|
||
&gt; ce-source: http://curl-command
|
||
&gt; ce-type: curl.demo
|
||
&gt; ce-id: 123-abc
|
||
&gt; Content-Length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&gt;
|
||
&lt; HTTP/1.1 <span style="color:#0000cf;font-weight:bold">200</span> OK
|
||
&lt; content-length: <span style="color:#0000cf;font-weight:bold">15</span>
|
||
&lt; content-type: application/json
|
||
&lt; ce-specversion: 1.0
|
||
&lt; ce-id: 123-abc
|
||
&lt; ce-type: dev.knative.docs.sample
|
||
&lt; ce-source: https://github.com/knative/docs/docs/serving/samples/cloudevents/cloudevents-rust
|
||
&lt; date: Sat, <span style="color:#0000cf;font-weight:bold">23</span> May <span style="color:#0000cf;font-weight:bold">2020</span> 09:00:01 GMT
|
||
&lt;
|
||
<span style="color:#ce5c00;font-weight:bold">{</span><span style="color:#4e9a06">&#34;name&#34;</span>:<span style="color:#4e9a06">&#34;Dave&#34;</span><span style="color:#ce5c00;font-weight:bold">}</span>
|
||
</code></pre></div><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.</p>
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav nav-tabs" id="cloudevents_rust_delete" role="tablist">
|
||
|
||
|
||
|
||
|
||
<li class="nav-item ">
|
||
<a class="nav-link " id="cloudevents_rust_delete-0-tab" data-toggle="tab" href="#cloudevents_rust_delete-0" role="tab" aria-controls="cloudevents_rust_delete-0" aria-selected="true">yaml</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="nav-item active">
|
||
<a class="nav-link active" id="cloudevents_rust_delete-1-tab" data-toggle="tab" href="#cloudevents_rust_delete-1" role="tab" aria-controls="cloudevents_rust_delete-1" aria-selected="true">kn</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<div class="tab-content" >
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade " id="cloudevents_rust_delete-0" role="tabpanel" aria-labelledby="cloudevents_rust_delete-0-tab">
|
||
|
||
<p>Run:</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 service.yaml
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="tab-pane fade show active" id="cloudevents_rust_delete-1" role="tabpanel" aria-labelledby="cloudevents_rust_delete-1-tab">
|
||
|
||
<p>Run:</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">kn service delete cloudevents-rust
|
||
</code></pre></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</description>
|
||
</item>
|
||
|
||
</channel>
|
||
</rss>
|