From a2de619323b79123187f5c9adb093736dc26c668 Mon Sep 17 00:00:00 2001 From: Kunal1522 Date: Wed, 24 Dec 2025 01:43:44 +0530 Subject: [PATCH 1/4] docs: resolve TODO comments in subscriptions.md - Add example output for 'kn subscription describe' command - Add comprehensive 'Updating a Subscription' section with kn and kubectl examples - Include three practical update scenarios: changing sink, adding dead letter sink, and updating reply sink - Remove TODO comments once addressed Fixes knative/docs issue with incomplete subscription documentation --- .../eventing/channels/subscriptions.md | 91 ++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/docs/versioned/eventing/channels/subscriptions.md b/docs/versioned/eventing/channels/subscriptions.md index 0c2f3660a8b..7e7c4dde605 100644 --- a/docs/versioned/eventing/channels/subscriptions.md +++ b/docs/versioned/eventing/channels/subscriptions.md @@ -140,8 +140,95 @@ You can print details about a Subscription by using the `kn` CLI tool: ```bash kn subscription describe ``` - - + +**Example:** + +```bash +kn subscription describe mysubscription +``` + +!!! Success "Expected output" + ```{ .bash .no-copy } + Name: mysubscription + Namespace: default + Annotations: messaging.knative.dev/creator=user@example.com + messaging.knative.dev/lastModifier=user@example.com + Age: 1h + Channel: Channel:mychannel (messaging.knative.dev/v1) + Subscriber: + URI: http://myservice.default.svc.cluster.local + Reply: + Name: myreply + Kind: InMemoryChannel + API Version: messaging.knative.dev/v1 + DeadLetterSink: + Name: mydlq + Kind: Service + API Version: serving.knative.dev/v1 + + Conditions: + OK TYPE AGE REASON + ++ Ready 1h + ++ AddedToChannel 1h + ++ ChannelReady 1h + ``` + +## Updating a Subscription + +You can update an existing Subscription by using the `kn` CLI tool or by applying an updated YAML file. + +=== "kn" + The `kn subscription create` command can be used to update an existing Subscription. If a Subscription with the specified name already exists, the command updates it with the new configuration. + + **Example 1: Update the Sink of a Subscription** + + To change the Subscriber (Sink) of an existing Subscription named `mysubscription` to a different Knative Service: + + ```bash + kn subscription create mysubscription \ + --channel mychannel \ + --sink ksvc:new-service + ``` + + **Example 2: Add a Dead Letter Sink** + + To add or update the dead letter sink for event delivery failures: + + ```bash + kn subscription create mysubscription \ + --channel mychannel \ + --sink ksvc:myservice \ + --sink-dead-letter ksvc:error-handler + ``` + + **Example 3: Update the Reply Sink** + + To change where reply events are sent: + + ```bash + kn subscription create mysubscription \ + --channel mychannel \ + --sink ksvc:myservice \ + --sink-reply channel:reply-channel + ``` + + !!! note + When updating a Subscription, you must provide all the configuration parameters you want to keep. Any parameters not specified in the update command will use default values. + +=== "kubectl" + 1. Get the current Subscription configuration: + + ```bash + kubectl get subscription -o yaml > subscription.yaml + ``` + + 1. Edit the YAML file to make your desired changes to the `spec` section. + + 1. Apply the updated YAML file: + + ```bash + kubectl apply -f subscription.yaml + ``` ## Deleting Subscriptions From 3ae7f66f6a4f8c0fe99071a529a187bd808c0c27 Mon Sep 17 00:00:00 2001 From: Kunal1522 Date: Wed, 24 Dec 2025 02:40:46 +0530 Subject: [PATCH 2/4] fix: correct kn subscription update commands and kubectl syntax - Replace 'kn subscription create' with 'kn subscription update' for updating subscriptions - Remove unnecessary --channel parameter from update commands - Fix 'kubectl subscription delete' to 'kubectl delete subscription' - Simplify update command examples based on actual kn CLI behavior Verified with local Knative cluster testing. --- docs/versioned/eventing/channels/subscriptions.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/versioned/eventing/channels/subscriptions.md b/docs/versioned/eventing/channels/subscriptions.md index 7e7c4dde605..306ef89dcfb 100644 --- a/docs/versioned/eventing/channels/subscriptions.md +++ b/docs/versioned/eventing/channels/subscriptions.md @@ -178,15 +178,14 @@ kn subscription describe mysubscription You can update an existing Subscription by using the `kn` CLI tool or by applying an updated YAML file. === "kn" - The `kn subscription create` command can be used to update an existing Subscription. If a Subscription with the specified name already exists, the command updates it with the new configuration. + Use the `kn subscription update` command to modify an existing Subscription. **Example 1: Update the Sink of a Subscription** To change the Subscriber (Sink) of an existing Subscription named `mysubscription` to a different Knative Service: ```bash - kn subscription create mysubscription \ - --channel mychannel \ + kn subscription update mysubscription \ --sink ksvc:new-service ``` @@ -195,8 +194,7 @@ You can update an existing Subscription by using the `kn` CLI tool or by applyin To add or update the dead letter sink for event delivery failures: ```bash - kn subscription create mysubscription \ - --channel mychannel \ + kn subscription update mysubscription \ --sink ksvc:myservice \ --sink-dead-letter ksvc:error-handler ``` @@ -206,8 +204,7 @@ You can update an existing Subscription by using the `kn` CLI tool or by applyin To change where reply events are sent: ```bash - kn subscription create mysubscription \ - --channel mychannel \ + kn subscription update mysubscription \ --sink ksvc:myservice \ --sink-reply channel:reply-channel ``` @@ -242,7 +239,7 @@ You can delete a Subscription by using the `kn` or `kubectl` CLI tools. === "kubectl" ```bash - kubectl subscription delete + kubectl delete subscription ``` ## Next steps From 09f334fb5efb0594e72048ba575ea1a8c31a9e57 Mon Sep 17 00:00:00 2001 From: Kunal1522 Date: Wed, 24 Dec 2025 04:26:33 +0530 Subject: [PATCH 3/4] docs: simplify update examples to single comprehensive example Consolidated three separate update examples into one that shows all parameters together. Makes the documentation more concise while still covering all update scenarios. --- .../eventing/channels/subscriptions.md | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/docs/versioned/eventing/channels/subscriptions.md b/docs/versioned/eventing/channels/subscriptions.md index 306ef89dcfb..9638452dd40 100644 --- a/docs/versioned/eventing/channels/subscriptions.md +++ b/docs/versioned/eventing/channels/subscriptions.md @@ -180,35 +180,20 @@ You can update an existing Subscription by using the `kn` CLI tool or by applyin === "kn" Use the `kn subscription update` command to modify an existing Subscription. - **Example 1: Update the Sink of a Subscription** - - To change the Subscriber (Sink) of an existing Subscription named `mysubscription` to a different Knative Service: - - ```bash - kn subscription update mysubscription \ - --sink ksvc:new-service - ``` - - **Example 2: Add a Dead Letter Sink** - - To add or update the dead letter sink for event delivery failures: - - ```bash - kn subscription update mysubscription \ - --sink ksvc:myservice \ - --sink-dead-letter ksvc:error-handler - ``` - - **Example 3: Update the Reply Sink** - - To change where reply events are sent: + **Example:** ```bash kn subscription update mysubscription \ --sink ksvc:myservice \ + --sink-dead-letter ksvc:error-handler \ --sink-reply channel:reply-channel ``` + You can update individual parameters as needed: + - `--sink`: Change the subscriber (destination for events) + - `--sink-dead-letter`: Add or update the dead letter sink for failed deliveries + - `--sink-reply`: Update where reply events are sent + !!! note When updating a Subscription, you must provide all the configuration parameters you want to keep. Any parameters not specified in the update command will use default values. From f7b0116d8d6bdb32597dcc7e075d54effb72e50f Mon Sep 17 00:00:00 2001 From: Kunal1522 Date: Wed, 24 Dec 2025 04:28:57 +0530 Subject: [PATCH 4/4] revert: undo kubectl delete syntax change Reverting kubectl command back to original syntax as requested. --- docs/versioned/eventing/channels/subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versioned/eventing/channels/subscriptions.md b/docs/versioned/eventing/channels/subscriptions.md index 9638452dd40..94276abd61c 100644 --- a/docs/versioned/eventing/channels/subscriptions.md +++ b/docs/versioned/eventing/channels/subscriptions.md @@ -224,7 +224,7 @@ You can delete a Subscription by using the `kn` or `kubectl` CLI tools. === "kubectl" ```bash - kubectl delete subscription + kubectl subscription delete ``` ## Next steps