From b1ceb7520e2e07f73eba9697f8c061b9547a73cf Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Thu, 9 Nov 2023 12:22:18 +0100 Subject: [PATCH 1/5] Adding initial doc for func subscribe Signed-off-by: Matthias Wessendorf --- docs/functions/subscribing-functions.md | 9 +++++++++ docs/snippets/proc-subscribe-function.md | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 docs/functions/subscribing-functions.md create mode 100644 docs/snippets/proc-subscribe-function.md diff --git a/docs/functions/subscribing-functions.md b/docs/functions/subscribing-functions.md new file mode 100644 index 00000000000..8d8c61ead19 --- /dev/null +++ b/docs/functions/subscribing-functions.md @@ -0,0 +1,9 @@ +# Subscribe functions to CloudEvents + +### Prerequisites + +- Knative Eventing installed on the cluster + +### Procedure + +--8<-- "proc-subscribe-function.md" diff --git a/docs/snippets/proc-subscribe-function.md b/docs/snippets/proc-subscribe-function.md new file mode 100644 index 00000000000..327407fdaf8 --- /dev/null +++ b/docs/snippets/proc-subscribe-function.md @@ -0,0 +1,24 @@ + +The `subscribe` command will connect the function to a set of events, matching a series of filters for Cloud Event metadata +and a Knative Broker as the source of events, from where they are consumed. + +=== "func" + + To subscribe the function to events for a given broker, run the following command: + + ```bash + func subscribe subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker + ``` + +=== "kn func" + + To subscribe the function to events for the default broker, run the following command: + + ```bash + func subscribe subscribe --filter type=com.example --filter extension=my-extension-value + ``` + +!!! note + When invoking `func deploy` the CLI will create Knative Triggers for the function. From 328a3fdf86b397f38d20a2404fbd62ff19fc75a9 Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Thu, 9 Nov 2023 12:46:18 +0100 Subject: [PATCH 2/5] correction Signed-off-by: Matthias Wessendorf --- docs/snippets/proc-subscribe-function.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/snippets/proc-subscribe-function.md b/docs/snippets/proc-subscribe-function.md index 327407fdaf8..bfafd7df068 100644 --- a/docs/snippets/proc-subscribe-function.md +++ b/docs/snippets/proc-subscribe-function.md @@ -12,12 +12,24 @@ and a Knative Broker as the source of events, from where they are consumed. func subscribe subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker ``` + To subscribe the function to events for the default broker, run the following command: + + ```bash + func subscribe subscribe --filter type=com.example --filter extension=my-extension-value + ``` + === "kn func" + To subscribe the function to events for a given broker, run the following command: + + ```bash + kn func subscribe subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker + ``` + To subscribe the function to events for the default broker, run the following command: ```bash - func subscribe subscribe --filter type=com.example --filter extension=my-extension-value + kn func subscribe subscribe --filter type=com.example --filter extension=my-extension-value ``` !!! note From 4f06c4f0a220e59df44206187b952f3e4a120321 Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Thu, 9 Nov 2023 14:16:46 +0100 Subject: [PATCH 3/5] Adding hint for deploy Signed-off-by: Matthias Wessendorf --- docs/snippets/proc-subscribe-function.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/snippets/proc-subscribe-function.md b/docs/snippets/proc-subscribe-function.md index bfafd7df068..b85239926b9 100644 --- a/docs/snippets/proc-subscribe-function.md +++ b/docs/snippets/proc-subscribe-function.md @@ -9,13 +9,13 @@ and a Knative Broker as the source of events, from where they are consumed. To subscribe the function to events for a given broker, run the following command: ```bash - func subscribe subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker + func subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker ``` To subscribe the function to events for the default broker, run the following command: ```bash - func subscribe subscribe --filter type=com.example --filter extension=my-extension-value + func subscribe --filter type=com.example --filter extension=my-extension-value ``` === "kn func" @@ -23,14 +23,22 @@ and a Knative Broker as the source of events, from where they are consumed. To subscribe the function to events for a given broker, run the following command: ```bash - kn func subscribe subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker + kn func subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker ``` To subscribe the function to events for the default broker, run the following command: ```bash - kn func subscribe subscribe --filter type=com.example --filter extension=my-extension-value + kn func subscribe --filter type=com.example --filter extension=my-extension-value ``` !!! note When invoking `func deploy` the CLI will create Knative Triggers for the function. + +!!! Success "Expected output" + ```{ .bash .no-copy } + 🙌 Function image built: /hello:latest + 🎯 Creating Triggers on the cluster + ✅ Function deployed in namespace "default" and exposed at URL: + http://hello.default.127.0.0.1.sslip.io + ``` From 65f0911129ee825eea4a35ec6f10e904edf0594d Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Thu, 9 Nov 2023 15:27:49 +0100 Subject: [PATCH 4/5] Adding index Signed-off-by: Matthias Wessendorf --- config/nav.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/nav.yml b/config/nav.yml index 5e236f55308..2b055a656e2 100644 --- a/config/nav.yml +++ b/config/nav.yml @@ -88,6 +88,7 @@ nav: - Creating functions: functions/creating-functions.md - Building functions: functions/building-functions.md - Running functions: functions/running-functions.md + - Subscribing functions: functions/subscribing-functions.md - Deploying functions: functions/deploying-functions.md - Invoking functions: functions/invoking-functions.md - Language packs: functions/language-packs.md From d25f299e45c94759366d2ba04f7ec5240b1211af Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Fri, 10 Nov 2023 08:00:02 +0100 Subject: [PATCH 5/5] Updates Signed-off-by: Matthias Wessendorf --- docs/functions/subscribing-functions.md | 28 ++++++++++++++++++++++++ docs/snippets/proc-subscribe-function.md | 11 ---------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/functions/subscribing-functions.md b/docs/functions/subscribing-functions.md index 8d8c61ead19..53fb4e44db6 100644 --- a/docs/functions/subscribing-functions.md +++ b/docs/functions/subscribing-functions.md @@ -7,3 +7,31 @@ ### Procedure --8<-- "proc-subscribe-function.md" + +### Deployment with Triggers + +When invoking `func deploy` the CLI will create Knative Triggers for the function. + +=== "func" + + Deploy the function with Triggers by running the command inside the project directory: + + ```bash + func deploy + ``` + +=== "kn func" + + Deploy the function with Triggers by running the command inside the project directory: + + ```bash + kn func deploy + ``` + +!!! Success "Expected output" + ```{ .bash .no-copy } + 🙌 Function image built: /hello:latest + 🎯 Creating Triggers on the cluster + ✅ Function deployed in namespace "default" and exposed at URL: + http://hello.default.127.0.0.1.sslip.io + ``` diff --git a/docs/snippets/proc-subscribe-function.md b/docs/snippets/proc-subscribe-function.md index b85239926b9..d8c2654f793 100644 --- a/docs/snippets/proc-subscribe-function.md +++ b/docs/snippets/proc-subscribe-function.md @@ -31,14 +31,3 @@ and a Knative Broker as the source of events, from where they are consumed. ```bash kn func subscribe --filter type=com.example --filter extension=my-extension-value ``` - -!!! note - When invoking `func deploy` the CLI will create Knative Triggers for the function. - -!!! Success "Expected output" - ```{ .bash .no-copy } - 🙌 Function image built: /hello:latest - 🎯 Creating Triggers on the cluster - ✅ Function deployed in namespace "default" and exposed at URL: - http://hello.default.127.0.0.1.sslip.io - ```