mirror of https://github.com/knative/docs.git
docs(cloudevents): try cloudevents-nodejs with kn (#2827)
* docs(cloudevents): try cloudevents-nodejs with kn Adds tabbed instructions for deploying and deleting the Node.js cloudevents sample using the `kn` CLI. Signed-off-by: Lance Ball <lball@redhat.com> * squash: fix copy paste problems Signed-off-by: Lance Ball <lball@redhat.com> * squash: incorporate PR feedback Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
parent
089473ffc8
commit
a615243372
|
|
@ -30,10 +30,10 @@ cd knative-docs/docs/serving/samples/cloudevents/cloudevents-nodejs
|
|||
- [Docker](https://www.docker.com) installed and running on your local machine,
|
||||
and a Docker Hub account configured (we'll use it for a container registry).
|
||||
|
||||
## The sample code.
|
||||
## The Sample Code
|
||||
|
||||
1. If you look in `index.js`, you will see two key functions for the
|
||||
different modes of operation:
|
||||
In the `index.js` file, you will see two key functions for the different modes
|
||||
of operation:
|
||||
|
||||
```js
|
||||
const receiveAndSend = (cloudEvent, res) => {
|
||||
|
|
@ -47,7 +47,9 @@ cd knative-docs/docs/serving/samples/cloudevents/cloudevents-nodejs
|
|||
}
|
||||
```
|
||||
|
||||
1. If you look in `Dockerfile`, you will see how the dependencies are installed using npm.
|
||||
## Build and Deploy the Application
|
||||
|
||||
In the `Dockerfile`, you can see how the dependencies are installed using npm.
|
||||
You can build and push this to your registry of choice via:
|
||||
|
||||
```shell
|
||||
|
|
@ -55,13 +57,25 @@ cd knative-docs/docs/serving/samples/cloudevents/cloudevents-nodejs
|
|||
docker push <image>
|
||||
```
|
||||
|
||||
1. If you look in `service.yaml`, take the `<image>` name above and insert it
|
||||
into the `image:`.
|
||||
{{< tabs name="cloudevents_nodejs_deploy" default="kn" >}} {{% tab name="yaml" %}}
|
||||
|
||||
To deploy the Knative service, edit the `service.yaml` file and replace
|
||||
`<registry/repository/image:tag>` with the image you have just created.
|
||||
|
||||
```shell
|
||||
kubectl apply -f service.yaml
|
||||
```
|
||||
|
||||
{{< /tab >}} {{% tab name="kn" %}}
|
||||
|
||||
To deploy using the `kn` CLI:
|
||||
|
||||
```shell
|
||||
kn service create cloudevents-nodejs --image=<image>
|
||||
```
|
||||
|
||||
{{ /tab }}{{ /tabs }}
|
||||
|
||||
## Testing the sample
|
||||
|
||||
Get the URL for your Service with:
|
||||
|
|
@ -93,8 +107,22 @@ You will get back:
|
|||
|
||||
## Removing the sample app deployment
|
||||
|
||||
To remove the sample app from your cluster, delete the service record:
|
||||
To remove the sample app from your cluster, delete the service.
|
||||
|
||||
{{< tabs name="cloudevents_nodejs_delete" default="kn" >}} {{% tab name="yaml" %}}
|
||||
|
||||
Run:
|
||||
|
||||
```shell
|
||||
kubectl delete --filename service.yaml
|
||||
```
|
||||
|
||||
{{< /tab >}} {{% tab name="kn" %}}
|
||||
|
||||
Run:
|
||||
|
||||
```shell
|
||||
kn service delete cloudevents-nodejs
|
||||
```
|
||||
|
||||
{{ /tab }}{{ /tabs }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue