diff --git a/config/redirects.yml b/config/redirects.yml index 1a15338fbf6..b4117dd3e54 100644 --- a/config/redirects.yml +++ b/config/redirects.yml @@ -20,7 +20,7 @@ plugins: versioned/eventing/broker/rabbitmq-broker/README.md: versioned/eventing/brokers/broker-types/rabbitmq-broker/README.md versioned/eventing/broker/README.md: versioned/eventing/brokers/README.md versioned/concepts/resources/revisions.md: versioned/serving/revisions/README.md - versioned/serving/revision-gc.md: versioned/serving/revisions/revision-developer-config-options.md + versioned/serving/revision-gc.md: versioned/serving/revisions/README.md#disabling-garbage-collection-for-a-revision versioned/serving/configuration/revision-gc.md: versioned/serving/revisions/revision-admin-config-options.md versioned/reference/concepts/duck-typing.md: versioned/eventing/concepts/duck-typing.md versioned/reference/client/README.md: versioned/client/README.md @@ -92,7 +92,7 @@ plugins: versioned/developer/eventing/sinks/README.md: versioned/eventing/sinks/README.md versioned/developer/eventing/sinks/kafka-sink.md: versioned/eventing/sinks/kafka-sink.md versioned/developer/eventing/sources/README.md: versioned/eventing/sources/README.md - versioned/developer/eventing/sources/apiserversource/README.md: versioned/eventing/sources/apiserversource/README.md + versioned/developer/eventing/sources/apiserversource/README.md: versioned/eventing/sources/apiserversource/getting-started.md versioned/developer/eventing/sources/apiserversource/getting-started.md: versioned/eventing/sources/apiserversource/getting-started.md versioned/developer/eventing/sources/apiserversource/reference.md: versioned/eventing/sources/apiserversource/reference.md versioned/developer/eventing/sources/containersource/README.md: versioned/eventing/custom-event-source/containersource/README.md @@ -147,7 +147,7 @@ plugins: versioned/eventing/samples/helloworld/helloworld-python/README.md: https://github.com/knative/docs/tree/main/code-samples/eventing/helloworld/helloworld-python versioned/eventing/samples/kafka/binding/README.md: versioned/eventing/sources/kafka-source/README.md versioned/eventing/samples/kafka/channel/README.md: https://github.com/knative/docs/tree/main/code-samples/eventing/kafka/channel - versioned/eventing/samples/kubernetes-event-source/index.md: versioned/eventing/sources/apiserversource/README.md + versioned/eventing/samples/kubernetes-event-source/index.md: versioned/eventing/sources/apiserversource/getting-started.md versioned/eventing/samples/parallel/README.md: https://github.com/knative/docs/tree/main/code-samples/eventing/parallel versioned/eventing/samples/parallel/multiple-branches/README.md: https://github.com/knative/docs/tree/main/code-samples/eventing/parallel#filter-routing versioned/eventing/samples/parallel/mutual-exclusivity/README.md: https://github.com/knative/docs/tree/main/code-samples/eventing/parallel#switch-routing @@ -181,7 +181,7 @@ plugins: versioned/operator/configuring-serving-cr/index.md: versioned/install/operator/configuring-serving-cr.md versioned/reference/resources/index.md: versioned/client/README.md versioned/serving/autoscaling/autoscaling-concepts.md: versioned/serving/autoscaling/autoscaler-types.md - versioned/serving/autoscaling/target-burst-capacity/index.md: versioned/serving/load-balancing/target-burst-capacity.md + versioned/serving/autoscaling/target-burst-capacity/index.md: versioned/serving/load-balancing/README.md#setting-the-target-burst-capacity versioned/serving/configuring-autoscaling/index.md: versioned/serving/autoscaling/README.md versioned/serving/creating-domain-mappings.md: versioned/serving/services/custom-domains.md versioned/serving/debugging-application-issues.md: versioned/serving/troubleshooting/debugging-application-issues.md @@ -240,3 +240,14 @@ plugins: versioned/getting-started/clean-up.md: versioned/getting-started/next-steps.md#clean-up versioned/bookstore/disclaimer/README.md: versioned/bookstore/disclaimer/disclaimer.md versioned/bookstore/extra-challenge/README.md: versioned/bookstore/extra-challenge/extra-challenges.md + versioned/functions/install-func.md: versioned/functions/running-functions.md + versioned/functions/creating-functions.md: versioned/functions/running-functions.md + versioned/functions/invoking-functions.md: versioned/functions/running-functions.md + versioned/functions/kafka-functions.md: versioned/functions/subscribing-functions.md + versioned/serving/load-balancing/target-burst-capacity.md: versioned/serving/load-balancing/README.md + versioned/serving/load-balancing/activator-capacity.md: versioned/serving/load-balancing/README.md + versioned/serving/revisions/revision-developer-config-options.md: versioned/serving/revisions/README.md + versioned/serving/app-security/secure-pod-defaults.md: versioned/serving/configuration/secure-pod-defaults.md + versioned/eventing/faq/README.md: versioned/eventing/sugar/README.md + versioned/eventing/sources/apiserversource/README.md: versioned/eventing/sources/apiserversource/getting-started.md + versioned/eventing/sources/redis/README.md: versioned/eventing/sources/redis/getting-started.md diff --git a/docs/snippets/route-status-updates.md b/docs/snippets/route-status-updates.md index 7a55b7e8858..f073a32fc39 100644 --- a/docs/snippets/route-status-updates.md +++ b/docs/snippets/route-status-updates.md @@ -18,14 +18,14 @@ spec: revisionName: config-00005 # Pinned to a specific Revision. ``` -Initially 1% of the traffic is rolled out to the Revisions: +Initially 1% of the traffic is rolled out to the new Revision in `status.traffic`: ```yaml apiVersion: serving.knative.dev/v1 kind: Service metadata: ... -spec: +status: ... traffic: - percent: 54 @@ -43,7 +43,7 @@ apiVersion: serving.knative.dev/v1 kind: Service metadata: ... -spec: +status: ... traffic: - percent: 36 @@ -61,7 +61,7 @@ apiVersion: serving.knative.dev/v1 kind: Service metadata: ... -spec: +status: ... traffic: - percent: 55 diff --git a/docs/versioned/.nav.yml b/docs/versioned/.nav.yml index c04631218ba..c066a1415d9 100644 --- a/docs/versioned/.nav.yml +++ b/docs/versioned/.nav.yml @@ -28,67 +28,53 @@ nav: ############################################################################### - Functions: - Overview: functions/README.md - - Install: functions/install-func.md - - Create: functions/creating-functions.md - - Build: functions/building-functions.md - - Run locally: functions/running-functions.md - - Deploy: functions/deploying-functions.md - - Invoke: functions/invoking-functions.md - - Subscribe to events: functions/subscribing-functions.md - - Kafka: functions/kafka-functions.md - - Language packs: functions/language-packs.md + - Develop locally: functions/running-functions.md + - Build an image: functions/building-functions.md + - Deploy a function: functions/deploying-functions.md + - Connect events: functions/subscribing-functions.md + - Templates and runtimes: functions/language-packs.md ############################################################################### # Serving ############################################################################### - Serving: - - Knative Serving: - - Overview: serving/README.md - - Architecture: serving/architecture.md - - Request Flow: serving/request-flow.md - - Converting a Kubernetes Deployment to a Knative Service: serving/convert-deployment-to-knative-service.md + - Overview: serving/README.md + - Architecture: serving/architecture.md + - Request flow: serving/request-flow.md + - Deploy and configure: + - Services overview: serving/services/README.md + - Create a Service: serving/services/creating-services.md + - Convert a Deployment: serving/convert-deployment-to-knative-service.md + - Private registries: serving/deploying-from-private-registry.md + - Resource requests and limits: serving/services/configure-requests-limits-services.md + - Health probes: serving/services/configure-probing.md + - Volumes: serving/services/storage.md + - Dry run: serving/dryrun.md + - Networking: + - Private Services: serving/services/private-services.md + - Ingress class: serving/services/ingress-class.md + - Certificate class: serving/services/certificate-class.md + - Custom domains: serving/services/custom-domains.md + - Custom TLS certificates: serving/services/custom-tls-certificate-domain-mapping.md + - HTTP protocols: serving/services/http-protocol.md + - Revisions and traffic: + - Revisions: serving/revisions/README.md + - Traffic splitting and tags: serving/traffic-management.md + - Gradual rollouts: serving/rolling-out-latest-revision.md - Autoscaling: - - About autoscaling: serving/autoscaling/README.md - - Supported autoscaler types: serving/autoscaling/autoscaler-types.md - - Configuring metrics: serving/autoscaling/autoscaling-metrics.md - - Configuring targets: serving/autoscaling/autoscaling-targets.md - - Configuring scale to zero: serving/autoscaling/scale-to-zero.md - - Configuring concurrency: serving/autoscaling/concurrency.md - - Configuring the requests per second (RPS) target: serving/autoscaling/rps-target.md - - Configuring scale bounds: serving/autoscaling/scale-bounds.md - - Additional autoscaling configuration for Knative Pod Autoscaler: serving/autoscaling/kpa-specific.md - - Autoscale Sample App - Go: serving/autoscaling/autoscale-go/README.md - # Serving - developer docs - - Developer Tasks: - - Services: - - Knative Services: serving/services/README.md - - Creating a Service: serving/services/creating-services.md - - Configuring private Services: serving/services/private-services.md - - Configuring ingress class: serving/services/ingress-class.md - - Configuring certificate class: serving/services/certificate-class.md - - Configuring custom domains: serving/services/custom-domains.md - - Using a custom TLS certificate for DomainMapping: serving/services/custom-tls-certificate-domain-mapping.md - # TODO: Add security section to docs? - - Configure resource requests and limits: serving/services/configure-requests-limits-services.md - - Configuring probes: serving/services/configure-probing.md - - Configuring HTTP: serving/services/http-protocol.md - - Performing Dry Run: serving/dryrun.md - - Volume Support: serving/services/storage.md - - Revisions: - - About Revisions: serving/revisions/README.md - - Garbage Collection: serving/revisions/revision-developer-config-options.md - - Traffic management: serving/traffic-management.md - - Configuring gradual rollout of traffic to Revisions: serving/rolling-out-latest-revision.md - - Tag resolution: serving/tag-resolution.md - - Deploying from private registries: serving/deploying-from-private-registry.md - - Load balancing: - - About load balancing: serving/load-balancing/README.md - - Configuring target burst capacity: serving/load-balancing/target-burst-capacity.md - - Configuring Activator capacity: serving/load-balancing/activator-capacity.md - - Secure Pod Defaults: serving/app-security/secure-pod-defaults.md - # Serving - observability + - Overview: serving/autoscaling/README.md + - Autoscaler types: serving/autoscaling/autoscaler-types.md + - Metrics: serving/autoscaling/autoscaling-metrics.md + - Targets: serving/autoscaling/autoscaling-targets.md + - Concurrency: serving/autoscaling/concurrency.md + - Requests per second (RPS): serving/autoscaling/rps-target.md + - Scale bounds: serving/autoscaling/scale-bounds.md + - Scale to zero: serving/autoscaling/scale-to-zero.md + - KPA settings: serving/autoscaling/kpa-specific.md + - Request buffering: serving/load-balancing/README.md + - Autoscale sample app: serving/autoscaling/autoscale-go/README.md - Observability: - Collecting metrics: serving/observability/metrics/collecting-metrics.md - - Metrics Reference: serving/observability/metrics/serving-metrics.md + - Metrics reference: serving/observability/metrics/serving-metrics.md - Troubleshooting: serving/troubleshooting/debugging-application-issues.md - Serving API: serving/reference/serving-api.md - Code samples: samples/serving.md @@ -96,103 +82,75 @@ nav: # Eventing ############################################################################### - Eventing: - - Knative Eventing overview: eventing/README.md - - Concepts: - - Brokers: - - About Brokers: eventing/brokers/README.md - - Broker types: - - Available Broker types: eventing/brokers/broker-types/README.md - # add default IMC broker page, page explaining broker types - - Channel based Broker: eventing/brokers/broker-types/channel-based-broker/README.md - - Apache Kafka: - - Knative Broker for Apache Kafka: eventing/brokers/broker-types/kafka-broker/README.md - - RabbitMQ Broker: eventing/brokers/broker-types/rabbitmq-broker/README.md - - Creating a Broker: eventing/brokers/create-broker.md - - Developer configuration options: eventing/brokers/broker-developer-config-options.md - - Event Mesh: eventing/concepts/event-mesh.md - - Triggers: - - Using Triggers: eventing/triggers/README.md - - Duck types: eventing/concepts/duck-typing.md - - Event sources: - - About event sources: eventing/sources/README.md - - ApiServerSource: - - About ApiServerSource: eventing/sources/apiserversource/README.md - - Creating an ApiServerSource object: eventing/sources/apiserversource/getting-started.md - - ApiServerSource reference: eventing/sources/apiserversource/reference.md - - Apache Kafka Source: eventing/sources/kafka-source/README.md - - PingSource: - - Creating a PingSource object: eventing/sources/ping-source/README.md - - PingSource reference: eventing/sources/ping-source/reference.md - - IntegrationSource: - - About IntegrationSource: eventing/sources/integration-source/README.md - - AWS DDB Streams: eventing/sources/integration-source/aws_ddbstreams.md - - AWS S3: eventing/sources/integration-source/aws_s3.md - - AWS SQS: eventing/sources/integration-source/aws_sqs.md - - Generic Timer: eventing/sources/integration-source/timer.md - - RabbitMQSource: eventing/sources/rabbitmq-source/README.md - - RedisStreamSource: - - About RedisStreamSource: eventing/sources/redis/README.md - - Creating a RedisStreamSource object: eventing/sources/redis/getting-started.md - - Channels: - - About Channels: eventing/channels/README.md - - Channel types and defaults: eventing/channels/channel-types-defaults.md - - Creating a Channel using cluster or namespace defaults: eventing/channels/create-default-channel.md - - Available Channels: eventing/channels/channels-crds.md - - Subscriptions: eventing/channels/subscriptions.md - - Event sinks: - - About sinks: eventing/sinks/README.md - - JobSink: eventing/sinks/job-sink.md - - Apache Kafka Sink: eventing/sinks/kafka-sink.md - - IntegrationSink: - - About IntegrationSink: eventing/sinks/integration-sink/README.md - - AWS S3 Sink: eventing/sinks/integration-sink/aws_s3.md - - AWS SNS Sink: eventing/sinks/integration-sink/aws_sns.md - - AWS SQS Sink: eventing/sinks/integration-sink/aws_sqs.md - - Generic Logger Sink: eventing/sinks/integration-sink/logger.md - - Flows: - - About flows: eventing/flows/README.md - - Parallel: eventing/flows/parallel.md - - Sequence: - - About Sequences: eventing/flows/sequence/README.md - - Displaying Sequence output: eventing/flows/sequence/sequence-reply-to-event-display/README.md - - Using Sequences in series: eventing/flows/sequence/sequence-reply-to-sequence/README.md - - Create additional events: eventing/flows/sequence/sequence-terminal/README.md - - Using with Broker and Trigger: eventing/flows/sequence/sequence-with-broker-trigger/README.md - - Event Transformations: - - About Event Transformations: eventing/transforms/README.md - - Event Transformations for JSON with JSONata: eventing/transforms/event-transform-jsonata.md - # about triggers docs - # - Administrator configuration options: eventing/triggers/trigger-admin-config-options.md - # - Developer configuration options: eventing/triggers/trigger-developer-config-options.md - # Eventing - developer docs - - Developer Tasks: - # BYO event source - - Custom event sources: - - Custom event sources overview: eventing/custom-event-source/README.md - - Create a custom event source: - - Creating an event source overview: eventing/custom-event-source/custom-event-source/README.md - - Using the Knative sample repository: - - Configure the sample: eventing/custom-event-source/custom-event-source/sample-repo.md - - Create a controller: eventing/custom-event-source/custom-event-source/controller.md - - Create a receive adapter: eventing/custom-event-source/custom-event-source/receive-adapter.md - - Publishing an event source to your cluster: eventing/custom-event-source/custom-event-source/publish-event-source.md - - SinkBinding: - - About SinkBinding: eventing/custom-event-source/sinkbinding/README.md - - Create a SinkBinding: eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md - - SinkBinding reference: eventing/custom-event-source/sinkbinding/reference.md - - ContainerSource: - - Create a ContainerSource: eventing/custom-event-source/containersource/README.md - - ContainerSource Reference: eventing/custom-event-source/containersource/reference.md - - Handling delivery failure: eventing/event-delivery.md - - Event registry: - - Using the Event registry: eventing/event-registry/README.md + - Overview: eventing/README.md + - Event mesh: eventing/concepts/event-mesh.md + - Brokers and routing: + - Overview: eventing/brokers/README.md + - Create a Broker: eventing/brokers/create-broker.md + - Broker types: eventing/brokers/broker-types/README.md + - Channel-based Broker: eventing/brokers/broker-types/channel-based-broker/README.md + - Kafka Broker: eventing/brokers/broker-types/kafka-broker/README.md + - RabbitMQ Broker: eventing/brokers/broker-types/rabbitmq-broker/README.md + - Broker options: eventing/brokers/broker-developer-config-options.md + - Triggers: eventing/triggers/README.md + - Delivery failures: eventing/event-delivery.md + - Event registry: eventing/event-registry/README.md - Sugar controller: eventing/sugar/README.md - - Debugging: eventing/troubleshooting/README.md - # Eventing - observability + - Sources: + - Overview: eventing/sources/README.md + - ApiServerSource: eventing/sources/apiserversource/getting-started.md + - ApiServerSource reference: eventing/sources/apiserversource/reference.md + - PingSource: eventing/sources/ping-source/README.md + - PingSource reference: eventing/sources/ping-source/reference.md + - Kafka source: eventing/sources/kafka-source/README.md + - RabbitMQ source: eventing/sources/rabbitmq-source/README.md + - Redis Streams source: eventing/sources/redis/getting-started.md + - IntegrationSource: eventing/sources/integration-source/README.md + - AWS DynamoDB Streams: eventing/sources/integration-source/aws_ddbstreams.md + - AWS S3 source: eventing/sources/integration-source/aws_s3.md + - AWS SQS source: eventing/sources/integration-source/aws_sqs.md + - Timer source: eventing/sources/integration-source/timer.md + - Sinks: + - Overview: eventing/sinks/README.md + - JobSink: eventing/sinks/job-sink.md + - Kafka sink: eventing/sinks/kafka-sink.md + - IntegrationSink: eventing/sinks/integration-sink/README.md + - AWS S3 sink: eventing/sinks/integration-sink/aws_s3.md + - AWS SNS sink: eventing/sinks/integration-sink/aws_sns.md + - AWS SQS sink: eventing/sinks/integration-sink/aws_sqs.md + - Logger sink: eventing/sinks/integration-sink/logger.md + - Channels and flows: + - Channels overview: eventing/channels/README.md + - Channel types and defaults: eventing/channels/channel-types-defaults.md + - Create a Channel: eventing/channels/create-default-channel.md + - Available Channels: eventing/channels/channels-crds.md + - Subscriptions: eventing/channels/subscriptions.md + - Flows overview: eventing/flows/README.md + - Parallel: eventing/flows/parallel.md + - Sequences: eventing/flows/sequence/README.md + - Sequence to event display: eventing/flows/sequence/sequence-reply-to-event-display/README.md + - Chained Sequences: eventing/flows/sequence/sequence-reply-to-sequence/README.md + - Sequence terminal step: eventing/flows/sequence/sequence-terminal/README.md + - Sequence with Broker and Trigger: eventing/flows/sequence/sequence-with-broker-trigger/README.md + - Event transformations: eventing/transforms/README.md + - JSONata transformations: eventing/transforms/event-transform-jsonata.md + - Build a source: + - Overview: eventing/custom-event-source/README.md + - SinkBinding overview: eventing/custom-event-source/sinkbinding/README.md + - Create a SinkBinding: eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md + - SinkBinding reference: eventing/custom-event-source/sinkbinding/reference.md + - ContainerSource: eventing/custom-event-source/containersource/README.md + - ContainerSource reference: eventing/custom-event-source/containersource/reference.md + - Custom source overview: eventing/custom-event-source/custom-event-source/README.md + - Configure sample repo: eventing/custom-event-source/custom-event-source/sample-repo.md + - Create a controller: eventing/custom-event-source/custom-event-source/controller.md + - Create a receive adapter: eventing/custom-event-source/custom-event-source/receive-adapter.md + - Publish a custom source: eventing/custom-event-source/custom-event-source/publish-event-source.md - Observability: - Collecting metrics: eventing/observability/metrics/collecting-metrics.md - - Metrics Reference: eventing/observability/metrics/eventing-metrics.md - - FAQ: eventing/faq/README.md + - Metrics reference: eventing/observability/metrics/eventing-metrics.md + - Troubleshooting: eventing/troubleshooting/README.md + - Duck types: eventing/concepts/duck-typing.md - Eventing API: eventing/reference/eventing-api.md - Code samples: samples/eventing.md ############################################################################### @@ -249,6 +207,7 @@ nav: - Config Revision Garbage Collection: serving/revisions/revision-admin-config-options.md - Configure the Defaults ConfigMap: serving/configuration/config-defaults.md - Secure Pod Defaults: serving/configuration/secure-pod-defaults.md + - Registry trust and tag resolution: serving/tag-resolution.md - Serving encryption configuration: - Overview: serving/encryption/encryption-overview.md - Configure cert-manager integration: serving/encryption/configure-certmanager-integration.md diff --git a/docs/versioned/client/README.md b/docs/versioned/client/README.md index c05df275eea..28700ce25f9 100755 --- a/docs/versioned/client/README.md +++ b/docs/versioned/client/README.md @@ -37,7 +37,7 @@ The `func` CLI enables you to create, build, and deploy Knative Functions withou ### Additional resources -- See [Installing Knative Functions](../functions/install-func.md). +- See [Develop locally — Prepare](../functions/running-functions.md#prepare). - See the [`func` documentation]({{ funcdocs() }}){target=_blank} in Github. ## Connecting CLI tools to your cluster diff --git a/docs/versioned/eventing/README.md b/docs/versioned/eventing/README.md index f92ba671a76..a3c282b5a36 100644 --- a/docs/versioned/eventing/README.md +++ b/docs/versioned/eventing/README.md @@ -3,37 +3,21 @@ audience: developer components: - eventing function: explanation +hide_prev: true +hide_next: true --- -# Eventing +# Knative Eventing --8<-- "about-eventing.md" -Examples of supported Knative Eventing use cases: +New to Eventing? Start with [Try Eventing](../getting-started/getting-started-eventing.md) to send a CloudEvent through a Broker and deliver it with a Trigger, or follow the [Bookstore tutorial](../bookstore/page-0/welcome-knative-bookstore-tutorial.md) for a multi-service app. -- Publish an event without creating a consumer. You can send events to a broker as an HTTP POST, and use binding to decouple the destination configuration from your application that produces events. +## What do you want to do? -- Consume an event without creating a publisher. You can use a trigger to consume events from a broker based on event attributes. The application receives events as an HTTP POST. - -!!! tip - Multiple event producers and sinks can be used together to create more advanced [Knative Eventing flows](flows/README.md){target=_blank} to solve complex use cases. - -## Eventing examples - -:material-file-document: [Creating and responding to Kubernetes API events](../eventing/sources/apiserversource/README.md){target=blank} - ---8<-- "YouTube_icon.svg" -[Creating an image processing pipeline](https://www.youtube.com/watch?v=DrmOpjAunlQ){target=blank} - ---8<-- "YouTube_icon.svg" -[Facilitating AI workloads at the edge in large-scale, drone-powered sustainable agriculture projects](https://www.youtube.com/watch?v=lVfJ5WEQ5_s){target=blank} - -## Next steps - -- Follow [Get started with Eventing](../getting-started/getting-started-eventing.md) - to send an event through a Broker and deliver it using a Trigger. This is the - same Eventing track linked from Get Started; it links to shared cluster setup. -- Once you know the basics, try the - [Bookstore tutorial](../bookstore/page-0/welcome-knative-bookstore-tutorial.md) - to combine the components in a larger application. -- You can install Knative Eventing by using the methods listed on the [installation page](../install/README.md). +- **Route events with Brokers and Triggers** — [Create a Broker](brokers/create-broker.md), compare [Broker types](brokers/broker-types/README.md), filter events with [Triggers](triggers/README.md), and configure retries and dead-letter sinks in [Delivery failures](event-delivery.md). +- **Connect event producers** — Choose a built-in producer in [Event sources](sources/README.md) (Kubernetes API, schedules, Kafka, RabbitMQ, Redis Streams, or Camel integrations), or bind an existing workload with [SinkBinding](custom-event-source/sinkbinding/README.md). +- **Deliver to destinations** — Send events to Knative Services, Kubernetes Services, [JobSink](sinks/job-sink.md), [Kafka](sinks/kafka-sink.md), or [IntegrationSink](sinks/integration-sink/README.md) in [Event sinks](sinks/README.md). +- **Compose pipelines and transformations** — Chain steps with [Sequences](flows/sequence/README.md), fan out with [Parallel](flows/parallel.md), reshape payloads with [Event transformations](transforms/README.md), or use [Channels and Subscriptions](channels/README.md) directly. +- **Observe and debug** — Collect metrics in [Observability](observability/metrics/collecting-metrics.md) or trace lost events in [Troubleshooting](troubleshooting/README.md). +- **Install or administer Eventing** — See [Install and Manage](../install/README.md) for installation, Broker class defaults, and cluster-wide settings. diff --git a/docs/versioned/eventing/brokers/broker-developer-config-options.md b/docs/versioned/eventing/brokers/broker-developer-config-options.md index 41e761cdede..9c3924975cf 100644 --- a/docs/versioned/eventing/brokers/broker-developer-config-options.md +++ b/docs/versioned/eventing/brokers/broker-developer-config-options.md @@ -19,14 +19,15 @@ function: reference - You can specify the number of retry attempts before sending the event to the dead-letter sink using the `retry` configuration. - `spec.delivery` is used to configure event delivery options. Event delivery options specify what happens to an event that fails to be delivered to an event sink. For more information, see the documentation on [Event delivery](../event-delivery.md). -### Advanced broker class options +### Broker class options { #advanced-broker-class-options } + When a Broker is created without a specified `eventing.knative.dev/broker.class` annotation, by default the `MTChannelBasedBroker` Broker class is used, as specified in the `config-br-defaults` ConfigMap. -In case you have multiple Broker classes installed in your cluster and want to use a non-default Broker class for a Broker, you can modify the `eventing.knative.dev/broker.class` annotation and `spec.config` for the Broker object. +If you have multiple Broker classes installed in your cluster and want to use a non-default Broker class for a **new** Broker, set the `eventing.knative.dev/broker.class` annotation and `spec.config` before applying the Broker: -1. Set the `eventing.knative.dev/broker.class` annotation. Replace `MTChannelBasedBroker` in the following example with the class type you want to use. Be aware that the Broker class annoation is immutable and thus can't be updated after the Broker got created: +1. Set the `eventing.knative.dev/broker.class` annotation to the class you want to use (for example, `Kafka` or `RabbitMQBroker`). This annotation is immutable and cannot be changed after the Broker is created; to switch classes for an existing Broker, create a new Broker with the desired class and migrate Triggers to it. -2. Configure the `spec.config` with the details of the ConfigMap that defines the required configuration for the Broker class (e.g. with some Channel configurations in case of the `MTChannelBasedBroker`): +1. Configure `spec.config` with the ConfigMap that defines the configuration for that Broker class (for example, Channel configuration for `MTChannelBasedBroker`). For further information about configuring a default Broker class cluster wide or on a per namespace basis, check the [Administrator configuration options](../configuration/broker-configuration.md#configuring-the-broker-class). diff --git a/docs/versioned/eventing/brokers/broker-types/kafka-broker/README.md b/docs/versioned/eventing/brokers/broker-types/kafka-broker/README.md index 0b4cfe6c7d4..11e0683284d 100644 --- a/docs/versioned/eventing/brokers/broker-types/kafka-broker/README.md +++ b/docs/versioned/eventing/brokers/broker-types/kafka-broker/README.md @@ -251,7 +251,7 @@ spec: !!! note When using an external topic, the Knative Kafka Broker does not own the topic and is not responsible for managing the topic. This includes the topic lifecycle or its general validity. Other restrictions for general access to the topic may apply. See the documentation about using [Access Control Lists (ACLs)](https://kafka.apache.org/documentation/#security_authz). -## Configuring the order of delivered events +## Event ordering { #configuring-the-order-of-delivered-events } When dispatching events, the Kafka broker can be configured to support different delivery ordering guarantees. @@ -280,7 +280,7 @@ The supported consumer delivery guarantees are: The `unordered` delivery is the default ordering guarantee. -## Data plane Isolation vs Shared Data plane +## Data plane isolation { #data-plane-isolation-vs-shared-data-plane } Knative Kafka Broker implementation has 2 planes: control plane and data plane. Control plane consists of controllers that talk to Kubernetes API, watch for custom objects and manage the data plane. diff --git a/docs/versioned/eventing/brokers/broker-types/rabbitmq-broker/README.md b/docs/versioned/eventing/brokers/broker-types/rabbitmq-broker/README.md index be0f3bfc590..016135127a4 100644 --- a/docs/versioned/eventing/brokers/broker-types/rabbitmq-broker/README.md +++ b/docs/versioned/eventing/brokers/broker-types/rabbitmq-broker/README.md @@ -13,9 +13,11 @@ This topic describes how to create a RabbitMQ Broker. These directions assume your cluster administrator has [installed the Knative RabbitMQ broker](../../../../install/eventing/rabbitmq-install.md). -## Create a RabbitMQBrokerConfig object +## Create a RabbitMQBrokerConfig { #create-a-rabbitmqbrokerconfig-object } -1. Create a YAML file using the following template: +Choose either an in-cluster RabbitMQ Cluster Operator instance (`name`) or an external RabbitMQ server (`connectionSecret`). Do not set both fields in the same `RabbitmqBrokerConfig`. + +=== "In-cluster (RabbitMQ Cluster Operator)" ```yaml apiVersion: eventing.knative.dev/v1alpha1 kind: RabbitmqBrokerConfig @@ -23,27 +25,28 @@ These directions assume your cluster administrator has [installed the Knative Ra name: spec: rabbitmqClusterReference: - # Configure name if a RabbitMQ Cluster Operator is being used. name: - # Configure connectionSecret if an external RabbitMQ cluster is being used. + queueType: quorum + ``` + +=== "External RabbitMQ server" + ```yaml + apiVersion: eventing.knative.dev/v1alpha1 + kind: RabbitmqBrokerConfig + metadata: + name: + spec: + rabbitmqClusterReference: connectionSecret: name: rabbitmq-secret-credentials queueType: quorum ``` - Where: - - is the name you want for your RabbitMQBrokerConfig object. - - is the name of the RabbitMQ cluster you created earlier. +Apply the YAML file: - !!! note - You cannot set `name` and `connectionSecret` at the same time, since `name` is for a RabbitMQ Cluster Operator instance running in the same cluster as the Broker, and `connectionSecret` is for an external RabbitMQ server. - -1. Apply the YAML file by running the command: - - ```bash - kubectl create -f - ``` - Where `` is the name of the file you created in the previous step. +```bash +kubectl apply -f .yaml +``` ## Create a RabbitMQBroker object diff --git a/docs/versioned/eventing/channels/subscriptions.md b/docs/versioned/eventing/channels/subscriptions.md index 94276abd61c..63f6083e261 100644 --- a/docs/versioned/eventing/channels/subscriptions.md +++ b/docs/versioned/eventing/channels/subscriptions.md @@ -24,48 +24,14 @@ For more information about Subscription objects, see ```bash kn subscription create \ - --channel : \ - --sink : \ - --sink-reply : \ - --sink-dead-letter : + --channel \ + --sink : ``` - - `--channel` specifies the source for cloud events that should be processed. - You must provide the Channel name. If you are not using the default Channel that is backed by the - Channel resource, you must prefix the Channel name with the `` for the - specified Channel type. - For example, this is `messaging.knative.dev:v1beta1:KafkaChannel` for a Kafka-backed Channel. + Optional flags: `--sink-reply :` (where reply events are sent) and `--sink-dead-letter :` (where failed events are sent). - - `--sink` specifies the target destination to which the event should be delivered. - By default, the `` is interpreted as a Knative service of this name, in the same - namespace as the Subscription. - You can specify the type of the Sink by using one of the following prefixes: - - - `ksvc`: A Knative service. - - `svc`: A Kubernetes Service. - - `channel`: A Channel that should be used as the destination. You can only reference default - Channel types here. - - `broker`: An Eventing Broker. - - `--sink-reply` is an optional argument you can use to specify where the Sink reply is sent. - It uses the same naming conventions for specifying the Sink as the `--sink` flag. - - `--sink-dead-letter` is an optional argument you can use to specify where to send the - CloudEvent in case of a failure. It uses the same naming conventions for specifying the Sink - as the `--sink` flag. - - - `ksvc`: A Knative service. - - `svc`: A Kubernetes Service. - - `channel`: A Channel that should be used as destination. Only default Channel types can be referenced here. - - `broker`: An Eventing Broker. - - `--sink-reply` and `--sink-dead-letter` are optional arguments. They can be used to specify where the Sink reply is sent, and where to send the CloudEvent in case of a failure, respectively. Both use the same naming conventions for specifying the Sink as the `--sink` flag. - - - This example command creates a Subscription named `mysubscription` that routes events from a Channel - named `mychannel` to a Knative service named `myservice`. - - - !!! note - The Sink prefix is optional. You can also specify the service for `--sink` as just - `--sink ` and omit the `ksvc` prefix. + - `--channel` specifies the source Channel. If you are not using the default Channel backed by the `Channel` resource, prefix the name with `:` (for example, `messaging.knative.dev:v1beta1:KafkaChannel:mychannel`). + - `--sink` specifies the target destination (defaults to a Knative Service in the same namespace if no prefix is given). Supported prefixes: `ksvc` (Knative Service), `svc` (Kubernetes Service), `channel` (default Channel), or `broker` (Eventing Broker). === "YAML" @@ -224,7 +190,7 @@ You can delete a Subscription by using the `kn` or `kubectl` CLI tools. === "kubectl" ```bash - kubectl subscription delete + kubectl delete subscription ``` ## Next steps diff --git a/docs/versioned/eventing/custom-event-source/containersource/README.md b/docs/versioned/eventing/custom-event-source/containersource/README.md index 092d364a3b5..dae03728940 100644 --- a/docs/versioned/eventing/custom-event-source/containersource/README.md +++ b/docs/versioned/eventing/custom-event-source/containersource/README.md @@ -20,7 +20,7 @@ container image, and a ContainerSource that uses your image URI. Before you can create a ContainerSource object, you must have [Knative Eventing](../../../install/yaml-install/eventing/install-eventing-with-yaml.md) installed on your cluster. -## Develop, build and publish a container image +## Build and publish an image { #develop-build-and-publish-a-container-image } You can develop a container image by using any language, and can build and publish your image by using any tools you like. The following are some basic guidelines: diff --git a/docs/versioned/eventing/custom-event-source/custom-event-source/receive-adapter.md b/docs/versioned/eventing/custom-event-source/custom-event-source/receive-adapter.md index 279304f1a5e..0e39b798bbc 100644 --- a/docs/versioned/eventing/custom-event-source/custom-event-source/receive-adapter.md +++ b/docs/versioned/eventing/custom-event-source/custom-event-source/receive-adapter.md @@ -73,7 +73,7 @@ new adapter with passed variables via the `EnvConfigAccessor`. The created adapt } ``` -## Managing the Receive Adapter in the Controller +## Manage the receive adapter { #managing-the-receive-adapter-in-the-controller } 1. Update the `ObservedGeneration` and initialize the `Status` conditions, as defined in the `samplesource_lifecycle.go` and `samplesource_types.go` files: diff --git a/docs/versioned/eventing/custom-event-source/sinkbinding/README.md b/docs/versioned/eventing/custom-event-source/sinkbinding/README.md index e7844f7e9d0..13ca8caa22d 100644 --- a/docs/versioned/eventing/custom-event-source/sinkbinding/README.md +++ b/docs/versioned/eventing/custom-event-source/sinkbinding/README.md @@ -17,7 +17,7 @@ A _subject_ is a Kubernetes resource that embeds a PodSpec template and produces A _sink_ is an addressable Kubernetes object that can receive events. The SinkBinding object injects environment variables into the PodTemplateSpec of the -sink. Because of this, the application code does not need to interact +subject. Because of this, the application code does not need to interact directly with the Kubernetes API to locate the event destination. These environment variables are as follows: diff --git a/docs/versioned/eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md b/docs/versioned/eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md index 31cfc5d367e..cc0236bbd75 100644 --- a/docs/versioned/eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md +++ b/docs/versioned/eventing/custom-event-source/sinkbinding/create-a-sinkbinding.md @@ -25,7 +25,7 @@ Before you can create a SinkBinding object: - You must have Knative Eventing installed on your cluster. - Optional: If you want to use `kn` commands with SinkBinding, install the `kn` CLI. -## Optional: Choose SinkBinding namespace selection behavior +## Namespace selection { #optional-choose-sinkbinding-namespace-selection-behavior } The SinkBinding object operates in one of two modes: `exclusion` or `inclusion`. @@ -118,7 +118,7 @@ create a Knative service. 1. Apply the YAML file by running the command: ```bash - kubectl apply -f .yaml + kubectl apply -f .yaml -n ``` Where `` is the name of the file you created in the previous step. @@ -177,7 +177,7 @@ any extra overrides given by `CE_OVERRIDES`. 1. Apply the YAML file by running the command: ```bash - kubectl apply -f .yaml + kubectl apply -f .yaml -n ``` Where `` is the name of the file you created in the previous step. @@ -204,7 +204,7 @@ Create a `SinkBinding` object that directs events from your subject to the sink. - `Job:batch/v1:app=heartbeat-cron` matches all jobs in namespace with label `app=heartbeat-cron`. - `Deployment:apps/v1:myapp` matches a deployment called `myapp` in the namespace. - `Service:serving.knative.dev/v1:hello` matches the service called `hello`. - - `` is the sink to connect. For example `http://event-display.svc.cluster.local`. + - `` is the sink to connect (for example `ksvc:event-display`, or a full URI such as `http://event-display..svc.cluster.local`). - Optional: `` in the form `key=value`. Cloud Event overrides control the output format and modifications of the event sent to the sink and are applied before sending the event. @@ -214,10 +214,10 @@ Create a `SinkBinding` object that directs events from your subject to the sink. For example: ```bash - $ kn source binding create bind-heartbeat \ + kn source binding create bind-heartbeat \ --namespace sinkbinding-example \ --subject "Job:batch/v1:app=heartbeat-cron" \ - --sink http://event-display.svc.cluster.local \ + --sink ksvc:event-display \ --ce-override "sink=bound" ``` @@ -258,7 +258,7 @@ Create a `SinkBinding` object that directs events from your subject to the sink. 1. Apply the YAML file by running the command: ```bash - kubectl apply -f .yaml + kubectl apply -f .yaml -n ``` Where `` is the name of the file you created in the previous step. @@ -268,16 +268,12 @@ Create a `SinkBinding` object that directs events from your subject to the sink. service logs for your sink: ```bash - kubectl logs -l -c --since=10m + kubectl logs -n -l serving.knative.dev/service= -c user-container --since=10m ``` - Where: - - - `` is the name of your sink. - - `` is the name of the container your sink is running in. For example: ```bash - $ kubectl logs -l serving.knative.dev/service=event-display -c user-container --since=10m + kubectl logs -n sinkbinding-example -l serving.knative.dev/service=event-display -c user-container --since=10m ``` 2. From the output, observe the lines showing the request headers and body of the event message, @@ -304,12 +300,14 @@ sent by the source to the display function. For example: } ``` -## Delete a SinkBinding +## Clean up { #delete-a-sinkbinding } -To delete the SinkBinding object and all of the related resources in the namespace, -delete the namespace by running: +To remove the SinkBinding and example resources without affecting other workloads in the namespace: ```bash -kubectl delete namespace +kubectl delete sinkbinding -n +kubectl delete cronjob heartbeat-cron -n +kubectl delete kservice event-display -n ``` -Where `` is the name of the namespace that contains the SinkBinding object. + +If you created a dedicated disposable namespace specifically for this example, you can remove everything at once with `kubectl delete namespace `. diff --git a/docs/versioned/eventing/event-delivery.md b/docs/versioned/eventing/event-delivery.md index 14cb9bcc9aa..b98d9f842b2 100644 --- a/docs/versioned/eventing/event-delivery.md +++ b/docs/versioned/eventing/event-delivery.md @@ -9,9 +9,18 @@ function: how-to You can configure event delivery parameters for Knative Eventing components that are applied in cases where an event fails to be delivered -## Configuring Subscription event delivery +## Delivery parameters -You can configure how events are delivered for each Subscription by adding a `delivery` spec to the `Subscription` object, as shown in the following example: +Delivery parameters can be set on a `Broker` (`spec.delivery`), a `Trigger` (`spec.delivery`, which overrides the Broker's delivery spec for that Trigger), a `Channel` (`spec.delivery`), or a `Subscription` (`spec.delivery`). + +- `deadLetterSink`: Destination (any Addressable resource such as a Knative Service, Kubernetes Service, or URI) that receives events after all delivery attempts fail. Make sure the dead-letter sink is ready before enabling it; if delivery to the dead-letter sink also fails, the event is dropped and logged. +- `retry`: Number of retry attempts after the initial delivery attempt fails (total attempts = `retry + 1`). +- `backoffPolicy`: Delay strategy between retries — `linear` (increases linearly by `backoffDelay * attempt`) or `exponential` (doubles each attempt: `backoffDelay * 2^attempt`). +- `backoffDelay`: Base delay in ISO 8601 duration format (for example, `PT1S` for 1 second). + +## Subscription delivery { #configuring-subscription-event-delivery } + +Add `spec.delivery` to a `Subscription`: ```yaml apiVersion: messaging.knative.dev/v1 @@ -26,21 +35,14 @@ spec: apiVersion: serving.knative.dev/v1 kind: Service name: example-sink - backoffDelay: - backoffPolicy: - retry: + backoffDelay: PT1S + backoffPolicy: exponential + retry: 5 ``` -Where +## Broker delivery { #configuring-broker-event-delivery } -- The `deadLetterSink` spec contains configuration settings to enable using a dead letter sink. This tells the Subscription what happens to events that cannot be delivered to the subscriber. When this is configured, events that fail to be delivered are sent to the dead letter sink destination. The destination can be a Knative Service or a URI. In the example, the destination is a `Service` object, or Knative Service, named `example-sink`. -- The `backoffDelay` delivery parameter specifies the time delay before an event delivery retry is attempted after a failure. The duration of the `backoffDelay` parameter is specified using the ISO 8601 format. For example, `PT1S` specifies a 1 second delay. -- The `backoffPolicy` delivery parameter can be used to specify the retry back off policy. The policy can be specified as either `linear` or `exponential`. When using the `linear` back off policy, the back off delay is the time interval specified between retries. When using the `exponential` back off policy, the back off delay is equal to `backoffDelay*2^`. -- `retry` specifies the number of times that event delivery is retried before the event is sent to the dead letter sink. - -## Configuring Broker event delivery - -You can configure how events are delivered for each Broker by adding a `delivery` spec, as shown in the following example: +Add `spec.delivery` to a `Broker` (or override it per `Trigger`): ```yaml apiVersion: eventing.knative.dev/v1 @@ -54,17 +56,16 @@ spec: apiVersion: serving.knative.dev/v1 kind: Service name: example-sink - backoffDelay: - backoffPolicy: - retry: + backoffDelay: PT1S + backoffPolicy: exponential + retry: 5 ``` -Where +### Verify delivery failure handling + +1. Apply the Broker, Trigger, Channel, or Subscription with `spec.delivery` and confirm both the delivery owner and the dead-letter sink report `READY=True` (for example, `kubectl get broker,trigger,channel,subscription,ksvc -n `). -- The `deadLetterSink` spec contains configuration settings to enable using a dead letter sink. This tells the Subscription what happens to events that cannot be delivered to the subscriber. When this is configured, events that fail to be delivered are sent to the dead letter sink destination. The destination can be any Addressable object that conforms to the Knative Eventing sink contract, such as a Knative Service, a Kubernetes Service, or a URI. In the example, the destination is a `Service` object, or Knative Service, named `example-sink`. -- The `backoffDelay` delivery parameter specifies the time delay before an event delivery retry is attempted after a failure. The duration of the `backoffDelay` parameter is specified using the ISO 8601 format. For example, `PT1S` specifies a 1 second delay. -- The `backoffPolicy` delivery parameter can be used to specify the retry back off policy. The policy can be specified as either `linear` or `exponential`. When using the `linear` back off policy, the back off delay is the time interval specified between retries. This is a linearly increasing delay, which means that the back off delay increases by the given interval for each retry. When using the `exponential` back off policy, the back off delay increases by a multiplier of the given interval for each retry. -- `retry` specifies the number of times that event delivery is retried before the event is sent to the dead letter sink. The initial delivery attempt is not included in the retry count, so the total number of delivery attempts is equal to the `retry` value +1. +1. Send a CloudEvent with a known `Ce-Id` **through the configured Broker or Channel** to a subscriber that returns HTTP `500`, then check the dead-letter sink logs to confirm the failed event arrived with the same `Ce-Id` (and, where the backing Channel implementation supports them, the error extension attributes `knativeerrordest`, `knativeerrorcode`, and `knativeerrordata`). ### Broker support @@ -81,10 +82,10 @@ The following table summarizes which delivery parameters are supported for each `deadLetterSink` must be a GCP Pub/Sub topic URI. `googlecloud` Broker only supports the `exponential` back off policy. -## Configuring Channel event delivery +## Dead-letter error attributes { #configuring-channel-event-delivery } Failed events may, depending on the specific Channel implementation in use, be -enhanced with extension attributes prior to forwarding to the`deadLetterSink`. +enhanced with extension attributes prior to forwarding to the `deadLetterSink`. These extension attributes are as follows: - **knativeerrordest** diff --git a/docs/versioned/eventing/event-registry/README.md b/docs/versioned/eventing/event-registry/README.md index 63f36a5ded4..5b38f72cde0 100644 --- a/docs/versioned/eventing/event-registry/README.md +++ b/docs/versioned/eventing/event-registry/README.md @@ -139,21 +139,22 @@ metadata: namespace: default spec: bootstrapServers: - - my-cluster-kafka-bootstrap.kafka:9092 + - my-cluster-kafka-bootstrap.kafka:9092 topics: - - knative-demo - - news + - knative-demo + - news sink: - apiVersion: eventing.knative.dev/v1 - kind: Broker - name: default + ref: + apiVersion: eventing.knative.dev/v1 + kind: Broker + name: default ``` The `topics` field in the above example is used to generate the EventType `source` field. -After running `kubectl apply` using the above YAML, the KafkaSource `kafka-source-sample` +After running `kubectl apply` using the above YAML, the KafkaSource `kafka-sample` is instantiated, and two EventTypes are added to the registry because there are -two topics. +two topics. Note that `EventType` readiness (`Ready=True`) confirms the referenced Broker or Channel exists, not that events have already been emitted. ## Discover events using the registry diff --git a/docs/versioned/eventing/faq/README.md b/docs/versioned/eventing/faq/README.md deleted file mode 100644 index d942bd4efa1..00000000000 --- a/docs/versioned/eventing/faq/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -audience: developer -components: - - eventing -function: reference ---- - -# Eventing FAQs - -## What is a Sugar Controller? - -The Sugar Controller is an optional controller which will automatically create and clean up brokers based on the creation/deletion of namespaces and triggers. -For more information on how to enable and configure the sugar controller, read the [sugar controller documentation](../sugar/README.md). diff --git a/docs/versioned/eventing/features/sender-identity.md b/docs/versioned/eventing/features/sender-identity.md index 5c21d2e954e..57c74e26e53 100644 --- a/docs/versioned/eventing/features/sender-identity.md +++ b/docs/versioned/eventing/features/sender-identity.md @@ -39,7 +39,7 @@ OIDC authentication is currently supported for the following components: - [InMemoryChannel](../channels/channels-crds.md) - [KafkaChannel](../channels/channels-crds.md) - Sources: - - [ApiServerSource](../sources/apiserversource/README.md) + - [ApiServerSource](../sources/apiserversource/getting-started.md) - [PingSource](../sources/ping-source/README.md) - [KafkaSource](../sources/kafka-source/README.md) - [SinkBinding](../custom-event-source/sinkbinding/README.md) diff --git a/docs/versioned/eventing/sinks/README.md b/docs/versioned/eventing/sinks/README.md index 31537fa2031..1912f2b92a8 100644 --- a/docs/versioned/eventing/sinks/README.md +++ b/docs/versioned/eventing/sinks/README.md @@ -91,7 +91,7 @@ To use a Kubernetes custom resource (CR) as a sink for events, you must: - watch ``` -## Filtering events sent to sinks by using Triggers +## Filter events with Triggers { #filtering-events-sent-to-sinks-by-using-triggers } You can connect a Trigger to a sink, so that events are filtered before they are sent to the sink. A sink that is connected to a Trigger is configured as a `subscriber` in the Trigger resource spec. @@ -116,7 +116,7 @@ Where; - `` is the name of the Trigger being connected to the sink. - `` is the name of a KafkaSink object. -## Specifying sinks using the kn CLI --sink flag +## Use the `kn` `--sink` flag { #specifying-sinks-using-the-kn-cli---sink-flag } When you create an event-producing CR by using the Knative (`kn`) CLI, you can specify a sink where events are sent to from that resource, by using the `--sink` flag. diff --git a/docs/versioned/eventing/sinks/kafka-sink.md b/docs/versioned/eventing/sinks/kafka-sink.md index 2d759d2859e..a5ae79de35f 100644 --- a/docs/versioned/eventing/sinks/kafka-sink.md +++ b/docs/versioned/eventing/sinks/kafka-sink.md @@ -198,7 +198,7 @@ in particular, [Producer configurations](https://kafka.apache.org/documentation/ -## Enable debug logging for data plane components +## Debug logging { #enable-debug-logging-for-data-plane-components } To enable debug logging for data plane components change the logging level to `DEBUG` in the `kafka-config-logging` ConfigMap. diff --git a/docs/versioned/eventing/sources/README.md b/docs/versioned/eventing/sources/README.md index 37983fb52f7..10fe4df0718 100644 --- a/docs/versioned/eventing/sources/README.md +++ b/docs/versioned/eventing/sources/README.md @@ -39,7 +39,7 @@ All Sources are part of the `sources` category. | [Amazon DynamoDB](integration-source/aws_ddbstreams.md) | Alpha | Knative | Receive event notifications from an Amazon DynamoDB Streams. | | [Amazon S3](integration-source/aws_s3.md) | Alpha | Knative | Receive event notifications from an Amazon S3 Bucket. | | [Amazon SQS](integration-source/aws_sqs.md) | Alpha | Knative | Receive event notifications from an Amazon SQS queue. | -| [APIServerSource](apiserversource/README.md) | Stable | Knative | Brings Kubernetes API server events into Knative. The APIServerSource fires a new event each time a Kubernetes resource is created, updated or deleted. | +| [APIServerSource](apiserversource/getting-started.md) | Stable | Knative | Brings Kubernetes API server events into Knative. The APIServerSource fires a new event each time a Kubernetes resource is created, updated or deleted. | | [Apache Kafka](kafka-source/README.md) | Stable | Knative | Brings [Apache Kafka](https://kafka.apache.org/) messages into Knative. The KafkaSource reads events from an Apache Kafka Cluster, and passes these events to a sink so that they can be consumed. See the [Kafka Source](kafka-source/README.md) example for more details. | | [CephSource](https://github.com/knative-extensions/eventing-ceph) | Beta | Knative | The Ceph source converts bucket notifications from [Ceph format](https://docs.ceph.com/docs/master/radosgw/notifications/#events) into CloudEvents format, and inject them into Knative. Conversion logic follow the one described for [AWS S3](https://github.com/cloudevents/spec/blob/master/adapters/aws-s3.md) bucket notifications. | | [ContainerSource](../custom-event-source/containersource/README.md) | Stable | Knative | The ContainerSource instantiates container image(s) that can generate events until the ContainerSource is deleted. This may be used, for example, to poll an FTP server for new files or generate events at a set time interval. Given a `spec.template` with at least a container image specified, the ContainerSource keeps a Pod running with the specified image(s). `K_SINK` (destination address) and `KE_CE_OVERRIDES` (JSON CloudEvents attributes) environment variables are injected into the running image(s). It is used by multiple other Sources as underlying infrastructure. Refer to the [Container Source](../custom-event-source/containersource/README.md) example for more details. | diff --git a/docs/versioned/eventing/sources/apiserversource/README.md b/docs/versioned/eventing/sources/apiserversource/README.md deleted file mode 100644 index 1f2e6fd8465..00000000000 --- a/docs/versioned/eventing/sources/apiserversource/README.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -audience: developer -components: - - eventing -function: explanation ---- - -# ApiServerSource - -![stage](https://img.shields.io/badge/Stage-stable-green?style=flat-square) -![version](https://img.shields.io/badge/API_Version-v1-green?style=flat-square) - -The API server source is a Knative Eventing Kubernetes custom resource that listens for events emitted by the -Kubernetes API server (eg. pod creation, deployment updates, etc...) and forwards them as CloudEvents to a sink. - -The API server source is part of the core Knative Eventing component, and is provided by default when Knative Eventing is installed. Multiple instances of an ApiServerSource object can be created by users. diff --git a/docs/versioned/eventing/sources/apiserversource/getting-started.md b/docs/versioned/eventing/sources/apiserversource/getting-started.md index 19ed26b93a1..baf836d1864 100644 --- a/docs/versioned/eventing/sources/apiserversource/getting-started.md +++ b/docs/versioned/eventing/sources/apiserversource/getting-started.md @@ -5,26 +5,23 @@ components: function: how to --- -# Creating an ApiServerSource object +# ApiServerSource +![stage](https://img.shields.io/badge/Stage-stable-green?style=flat-square) ![version](https://img.shields.io/badge/API_Version-v1-green?style=flat-square) -This topic describes how to create an ApiServerSource object. +`ApiServerSource` is a core Knative Eventing source that watches Kubernetes API server events (such as pod creation or deployment updates) and forwards them as CloudEvents to a sink. -## Before you begin +## Prerequisites { #before-you-begin } -Before you can create an ApiServerSource object: +- [Knative Eventing](../../../install/yaml-install/eventing/install-eventing-with-yaml.md) installed on your cluster. +- Optional: the [`kn` CLI](../../../client/install-kn.md) if you prefer `kn` commands. -- You must have [Knative Eventing](../../../install/yaml-install/eventing/install-eventing-with-yaml.md) -installed on your cluster. -- You must install the [`kubectl` CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -tool. -- Optional: If you want to use the `kn` commands, install the [`kn`](../../../client/configure-kn.md) tool. +## Create an ApiServerSource { #create-an-apiserversource-object } -## Create an ApiServerSource object +Use a single namespace (``, for example `apiserversource-example` or `default`) consistently across all steps below. -1. Optional: Create a namespace for the API server source instance by running the -command: +1. Optional: Create a dedicated namespace: ```bash kubectl create namespace @@ -193,14 +190,14 @@ command: --mode "Resource" \ --resource "Event:v1" \ --service-account \ - --sink + --sink svc:event-display ``` Where: - `` is the name of the source that you want to create. - - `` is the name of the namespace that you created in step 1 earlier. - - `` is the name of the ServiceAccount that you created in step 2 earlier. - - `` is the name of your sink, for example, `http://event-display.pingsource-example.svc.cluster.local`. + - `` is the namespace you chose in step 1. + - `` is the name of the ServiceAccount you created in step 2. + - `--sink` uses `svc:event-display` to target the Kubernetes Service created above (or pass a full URI such as `http://event-display..svc.cluster.local`). For a list of available options, see the [Knative client documentation](https://github.com/knative/client/blob/main/docs/cmd/kn_source_apiserver_create.md#kn-source-apiserver-create). @@ -323,13 +320,16 @@ command: } ``` -## Delete the ApiServerSource object +## Clean up { #delete-the-apiserversource-object } -To remove the ApiServerSource object and all of the related resources: +To remove the resources you created: -- Delete the namespace by running the command: +```bash +kubectl delete apiserversource -n +kubectl delete deployment,service event-display -n +kubectl delete rolebinding -n +kubectl delete role -n +kubectl delete serviceaccount -n +``` - ```bash - kubectl delete namespace - ``` - Where `` is the name of the namespace that you created in step 1 earlier. +If you created a dedicated disposable namespace specifically for this example, you can remove everything at once with `kubectl delete namespace `. diff --git a/docs/versioned/eventing/sources/kafka-source/README.md b/docs/versioned/eventing/sources/kafka-source/README.md index 8a657f14c46..9b4dc816040 100644 --- a/docs/versioned/eventing/sources/kafka-source/README.md +++ b/docs/versioned/eventing/sources/kafka-source/README.md @@ -290,7 +290,7 @@ The `KafkaSource` implements the `Delivery` Specificiation, allowing you to conf The `delivery` API is discussed in the [Handling Delivery Failure](../../event-delivery.md) chapter. -## Optional: Specify the key deserializer +## Key deserializer { #optional-specify-the-key-deserializer } When `KafkaSource` receives a message from Kafka, it dumps the key in the Event extension called `Key` and dumps Kafka message headers in the extensions starting with `kafkaheader`. @@ -325,7 +325,7 @@ sink: name: event-display ``` -## Optional: Specify the initial offset +## Initial offset { #optional-specify-the-initial-offset } By default the `KafkaSource` starts consuming from the latest offset in each partition. If you want to consume from the earliest offset, set the initialOffset field to `earliest`, for example: @@ -354,7 +354,7 @@ sink: validation error. This field is honored only if there are no committed offsets for that consumer group. -## Connecting to a TLS-enabled Kafka Broker +## TLS-enabled Kafka Broker { #connecting-to-a-tls-enabled-kafka-broker } The KafkaSource supports TLS and SASL authentication methods. To enable TLS authentication, you must have the following files: diff --git a/docs/versioned/eventing/sources/rabbitmq-source/README.md b/docs/versioned/eventing/sources/rabbitmq-source/README.md index b4a24a4d5e5..97cd82adb7a 100644 --- a/docs/versioned/eventing/sources/rabbitmq-source/README.md +++ b/docs/versioned/eventing/sources/rabbitmq-source/README.md @@ -45,10 +45,11 @@ For more information about configuring the `RabbitmqCluster` CRD, see the [Rabbi {% include "event-display.md" %} -## Create a RabbitMQSource object +## Create a RabbitMQSource { #create-a-rabbitmqsource-object } -1. Create a YAML file using the following template: +Choose either an in-cluster RabbitMQ Cluster Operator instance (`name`) or an external RabbitMQ server (`connectionSecret`). Do not set both fields in the same `RabbitmqSource`. +=== "In-cluster (RabbitMQ Cluster Operator)" ```yaml apiVersion: sources.knative.dev/v1alpha1 kind: RabbitmqSource @@ -56,9 +57,30 @@ For more information about configuring the `RabbitmqCluster` CRD, see the [Rabbi name: spec: rabbitmqClusterReference: - # Configure name if a RabbitMQ Cluster Operator is being used. name: - # Configure connectionSecret if an external RabbitMQ cluster is being used. + rabbitmqResourcesConfig: + parallelism: 10 + exchangeName: "eventing-rabbitmq-source" + queueName: "eventing-rabbitmq-source" + delivery: + retry: 5 + backoffPolicy: "linear" + backoffDelay: "PT1S" + sink: + ref: + apiVersion: serving.knative.dev/v1 + kind: Service + name: event-display + ``` + +=== "External RabbitMQ server" + ```yaml + apiVersion: sources.knative.dev/v1alpha1 + kind: RabbitmqSource + metadata: + name: + spec: + rabbitmqClusterReference: connectionSecret: name: rabbitmq-secret-credentials rabbitmqResourcesConfig: @@ -75,6 +97,12 @@ For more information about configuring the `RabbitmqCluster` CRD, see the [Rabbi kind: Service name: event-display ``` + +Apply the YAML file: + +```bash +kubectl apply -f .yaml +``` Where: - `` is the name you want for your RabbitMQSource object. diff --git a/docs/versioned/eventing/sources/redis/README.md b/docs/versioned/eventing/sources/redis/README.md deleted file mode 100644 index f306bc1dc68..00000000000 --- a/docs/versioned/eventing/sources/redis/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -audience: developer -components: - - eventing -function: explanation ---- - -# RedisStreamSource - -![stage](https://img.shields.io/badge/Stage-alpha-green?style=flat-square) -![version](https://img.shields.io/badge/API_Version-v1alpha1-red?style=flat-square) - -The RedisStreamSource reads messages from [Redis Streams](https://redis.io/docs/data-types/streams/) and sends them as CloudEvents to the referenced Sink. diff --git a/docs/versioned/eventing/sources/redis/getting-started.md b/docs/versioned/eventing/sources/redis/getting-started.md index a065726d56c..bd3d98c5ec6 100644 --- a/docs/versioned/eventing/sources/redis/getting-started.md +++ b/docs/versioned/eventing/sources/redis/getting-started.md @@ -5,13 +5,15 @@ components: function: how-to --- + + # Creating a RedisStreamSource ![version](https://img.shields.io/badge/API_Version-v1alpha1-red?style=flat-square) This topic describes how to create a `RedisStreamSource` object. -## Install the RedisStreamSource add-on +## Install the add-on { #install-the-redisstreamsource-add-on } `RedisStreamSource` is a Knative Eventing add-on. @@ -69,7 +71,7 @@ Where: Where `` is the name of the file you created in the previous step. -## Verify the RedisStreamSource object +## Verify { #verify-the-redisstreamsource-object } 1. View the logs for the `event-display` event consumer by running the command: @@ -98,7 +100,7 @@ Where: ] ``` -## Delete the RedisStreamSource object +## Delete { #delete-the-redisstreamsource-object } * Delete the `RedisStreamSource` object: diff --git a/docs/versioned/eventing/sugar/README.md b/docs/versioned/eventing/sugar/README.md index 8ceb34e212c..0fd32095c6b 100644 --- a/docs/versioned/eventing/sugar/README.md +++ b/docs/versioned/eventing/sugar/README.md @@ -5,6 +5,8 @@ components: function: how-to --- + + # Knative Eventing Sugar Controller Knative Eventing Sugar Controller will react to configured labels @@ -13,65 +15,40 @@ cluster operators and developers to focus on creating fewer resources, and the underlying eventing infrastructure is created on-demand, and cleaned up when no longer needed. -## Installing - -The Sugar Controller is `disabled` by default and can be enabled by configuring `config-sugar` ConfigMap. -See below for a simple example and [Configure Sugar Controller](../configuration/sugar-configuration.md) for more details. - -## Automatic Broker Creation +## Prerequisites { #installing } -One way to create a Broker is to manually apply a resource to a cluster using -the default settings: +The Sugar Controller is `disabled` by default. A cluster administrator must enable it by configuring the `config-sugar` ConfigMap in `knative-eventing`. See [Configure Sugar Controller](../configuration/sugar-configuration.md) for administrator setup. -1. Copy the following YAML into a file: - - ```yaml - apiVersion: eventing.knative.dev/v1 - kind: Broker - metadata: - name: default - namespace: default - ``` - -1. Apply the YAML file by running the command: - - ```bash - kubectl apply -f .yaml - ``` - Where `` is the name of the file you created in the previous step. - -There might be cases where automated Broker creation is desirable, such as on -namespace creation, or on Trigger creation. The Sugar controller enables those -use-cases. The following sample configuration of the `sugar-config` ConfigMap -enables Sugar Controller for select Namespaces & all Triggers. +Example `config-sugar` ConfigMap enabling automatic Broker creation for labeled namespaces and all Triggers: ```yaml apiVersion: v1 kind: ConfigMap metadata: -name: config-sugar -namespace: knative-eventing -labels: + name: config-sugar + namespace: knative-eventing + labels: eventing.knative.dev/release: devel data: - # Specify a label selector to selectively apply sugaring to certain namespaces + # Selectively apply sugaring to namespaces matching this selector namespace-selector: | matchExpressions: - key: "my.custom.injection.key" operator: "In" values: ["enabled"] - # Use an empty object to enable for all triggers + # Use an empty object to enable for all Triggers trigger-selector: | {} ``` -- When a Namespace is created with label `my.custom.injection.key: enabled` , the Sugar controller will create a Broker named "default" in that - namespace. -- When a Trigger is created, the Sugar controller will create a Broker named "default" in the - Trigger's namespace. +## Automatic Broker creation { #automatic-broker-creation } -When a Broker is deleted and but the referenced label selectors are in use, the -Sugar Controller will automatically recreate a default Broker. +Once a cluster administrator has enabled the Sugar Controller with the selectors above: + +- Labeling a Namespace with `my.custom.injection.key: enabled` creates a Broker named `default` in that namespace. +- Creating a Trigger referencing `default` creates a Broker named `default` in the Trigger's namespace. + +If the `default` Broker is deleted while the matching selector still applies, the Sugar Controller recreates it. If a `default` Broker already exists, the Sugar Controller leaves it untouched and does not take ownership of it. ### Namespace Examples @@ -106,7 +83,7 @@ Controller will do nothing. ### Trigger Example -Create a "default" Broker in the Trigger's Namespace when creating a Trigger: +Assuming the `hello` namespace and an `event-display` Service already exist, create a Trigger to automatically provision a `default` Broker in `hello`: ```bash kubectl apply -f - << EOF @@ -125,6 +102,10 @@ spec: EOF ``` -This will make a Broker called "default" in the Namespace "hello", and attempt to send events to the "event-display" service. +Verify that both the automatically created `default` Broker and the Trigger report `READY=True`: + +```bash +kubectl get broker,trigger -n hello +``` If the Broker named "default" already exists in the Namespace, the Sugar Controller will do nothing and the Trigger will not own the existing Broker. diff --git a/docs/versioned/eventing/transforms/event-transform-jsonata.md b/docs/versioned/eventing/transforms/event-transform-jsonata.md index 1e02e2c8e9b..43675805ecd 100644 --- a/docs/versioned/eventing/transforms/event-transform-jsonata.md +++ b/docs/versioned/eventing/transforms/event-transform-jsonata.md @@ -41,13 +41,14 @@ spec: ## CloudEvent Structure -The input to the JSONata expression is the entire CloudEvent, including all its attributes and data. Your expression must produce a valid CloudEvent with at least these required fields: +The input to the JSONata expression is the entire CloudEvent, including all its attributes and `data` (if present). Your expression must produce a valid CloudEvent with these required fields: -- `specversion`: Should be set to "1.0" +- `specversion`: Set to `"1.0"` - `id`: A unique identifier for the event - `type`: The event type - `source`: The event source -- `data`: The event payload + +`data` is optional in the CloudEvents specification and holds the event payload when present. ## Common Transformation Patterns @@ -80,15 +81,15 @@ To extract fields from the data and promote them to CloudEvent attributes: "time": time, "userid": data.user.id, "region": data.region, - "data": $ + "data": data } ``` -The `$` symbol in JSONata represents the entire input object, so `data: $` preserves the entire original event data. +Use `"data": data` to preserve the original event payload, or `"data": $` if you intentionally want to embed the entire input CloudEvent envelope inside the new event's `data` field. ### Restructuring Event Data -To completely reshape the event data: +The following standalone JSONata illustration assumes a bare JSON `order` input (for an actual CloudEvent input, reference `data.order.*`): ```jsonata { @@ -299,7 +300,7 @@ spec: name: processor-service jsonata: expression: | - # Request transformation + /* Request transformation */ { "specversion": "1.0", "id": id, @@ -311,7 +312,7 @@ spec: reply: jsonata: expression: | - # Reply transformation + /* Reply transformation */ { "specversion": "1.0", "id": id, diff --git a/docs/versioned/eventing/troubleshooting/README.md b/docs/versioned/eventing/troubleshooting/README.md index 0442606f8d7..480efb91a0e 100644 --- a/docs/versioned/eventing/troubleshooting/README.md +++ b/docs/versioned/eventing/troubleshooting/README.md @@ -7,28 +7,28 @@ function: how-to # Debugging Knative Eventing -This is an evolving document on how to debug a non-working Knative Eventing -setup. +Use this guide to trace missing events in your own Knative Eventing setup or walk through the optional self-contained debugging example below. -## Audience +## Quick checklist { #quick-checklist-for-your-own-resources } -This document is intended for people that are familiar with the object model of -[Knative Eventing](../README.md). You don't need to be an expert, but do need to -know roughly how things fit together. +Start from the consumer and work backward toward the producer in your namespace (``): -## Prerequisites +1. Check readiness and addresses across the event path: -1. Setup [Knative Eventing and an Eventing-contrib resource](../README.md). + ```bash + kubectl get broker,trigger,channel,subscription,apiserversource,pingsource,ksvc -n + ``` -## Example + Confirm every resource reports `READY=True` and that Brokers/Channels have a populated `URL` (`status.address.url`). -This guide uses an example consisting of an event source that sends events to a -function. +1. Inspect any resource with `READY=False` using `kubectl describe -n ` and read the `Conditions` messages. +1. Check event delivery logs on the subscriber pod and on the Broker ingress/filter or Channel dispatcher pods in `knative-eventing`. -![src -> chan -> sub -> svc -> fn](ExampleModel.png) +## Optional lab example { #example } + +If you want a self-contained setup to practice the commands below, apply [example.yaml](example.yaml), which creates an `ApiServerSource` -> `Channel` -> `Subscription` -> `Service` -> `Deployment` pipeline in the `knative-debug` namespace: -See [example.yaml](example.yaml) for the entire YAML. For any commands in this -guide to work, you must apply [example.yaml](example.yaml): +![src -> chan -> sub -> svc -> fn](ExampleModel.png) ```bash kubectl apply --filename example.yaml @@ -137,7 +137,7 @@ This should return a single Pod, which if you inspect is the one generated by #### `chan` `chan` uses the -[`in-memory-channel`](https://github.com/knative/eventing/tree/{{ branch }}/config/channels/in-memory-channel). +[`in-memory-channel`](https://github.com/knative/eventing/tree/main/config/channels/in-memory-channel). This is a very basic channel and has few failure modes that will be exhibited in `chan`'s `status`. @@ -157,32 +157,28 @@ If `status` is completely missing, it implies that something is wrong with the Next verify that `chan` is addressable: ```bash -kubectl --namespace knative-debug get channel.messaging.knative.dev chan -o jsonpath='{.status.address.hostname}' +kubectl --namespace knative-debug get channel.messaging.knative.dev chan -o jsonpath='{.status.address.url}' ``` -This should return a URI, likely ending in '.cluster.local'. If it doesn't, then -it implies that something went wrong during reconciliation. See -[Channel Controller](#channel-controller). +This should return a cluster-local URL (typically ending in `.svc.cluster.local`). If it doesn't, +something went wrong during reconciliation. See [Channel Controller](#channel-controller). -We will verify that the two resources that the `chan` creates exist and are -`Ready`. +We will verify that the Kubernetes `Service` created for `chan` exists: #### `Service` -`chan` creates a K8s `Service`. +`chan` creates a Kubernetes `Service` backed by the `in-memory-channel` dispatcher: ```bash kubectl --namespace knative-debug get service -l messaging.knative.dev/role=in-memory-channel ``` -It's spec is completely unimportant, as Istio will ignore it. It just needs to -exist so that `src` can send events to it. If it doesn't exist, it implies that -something went wrong during `chan` reconciliation. See +If it doesn't exist, something went wrong during `chan` reconciliation. See [Channel Controller](#channel-controller). #### `src` -`src` is a [`ApiServerSource`](../../eventing/sources/apiserversource/README.md). +`src` is an [`ApiServerSource`](../../eventing/sources/apiserversource/getting-started.md). First we will verify that `src` is writing to `chan`. diff --git a/docs/versioned/functions/README.md b/docs/versioned/functions/README.md index 70f9fc91d63..7bdb8d08fa5 100644 --- a/docs/versioned/functions/README.md +++ b/docs/versioned/functions/README.md @@ -3,26 +3,31 @@ audience: developer components: - functions function: explanation +hide_prev: true +hide_next: true --- -# Knative Functions overview +# Knative Functions --8<-- "about-functions.md" -## Function templates +## Start here ---8<-- "functions-templates-intro.md" +New to Knative Functions? Follow [Try Functions](../getting-started/about-knative-functions.md) +to create, edit, and test a Go function locally — no Kubernetes cluster or +registry account required. -## Language packs +## Choose a task -Functions can be written in any language supported by the available [language packs](https://github.com/knative/func/blob/main/docs/language-packs/language-pack-contract.md){target=_blank}. - +- **[Develop locally](running-functions.md):** install `func`, create a project, + run it locally, and send HTTP or CloudEvents test requests. +- **[Build an image](building-functions.md):** build a container image locally + without running or deploying it. +- **[Deploy a function](deploying-functions.md):** deploy from your machine or + build and deploy remotely on a cluster with Tekton. +- **[Connect events](subscribing-functions.md):** subscribe a function to a + Knative Broker with Triggers, or consume Apache Kafka topics via sidecar. +- **[Templates and runtimes](language-packs.md):** choose a language and + HTTP/CloudEvents template, or use custom language-pack repositories. -## Getting started with functions - -Follow [Get started with Functions](../getting-started/about-knative-functions.md) -to create, change, and test a Go function locally. This is the same Functions -track linked from Get Started. Cluster deployment is optional and links to the -shared learning-cluster setup. - -For an existing project, use the how-to guides in this section. +For the full CLI reference, see the [`func` documentation]({{ funcdocs() }}){target=_blank}. diff --git a/docs/versioned/functions/building-functions.md b/docs/versioned/functions/building-functions.md index 7bca01c18f9..ad1269179e1 100644 --- a/docs/versioned/functions/building-functions.md +++ b/docs/versioned/functions/building-functions.md @@ -3,136 +3,81 @@ audience: developer components: - functions function: how-to +hide_prev: true +hide_next: true --- -# Building functions +# Build an image -Build a container image from an existing function project. The local procedure -builds only: it does not run, publish, or deploy the function. The optional -on-cluster workflow below builds **and deploys**, so choose it only when you want -that result. +`func build` turns a function project into a container image. It does not push +anything to a registry by default (add `--push` to push the image), and it never +deploys. For standard deployments, skip this separate build step: +[`func deploy`](deploying-functions.md) builds, pushes, and deploys in one command. -## Local builds +## Requirements -### Prerequisites +- An initialized function project containing `func.yaml` and source code. + [Create a project](running-functions.md#create-a-project) if needed. +- A running Docker-compatible container engine, such as + [Docker](https://docs.docker.com/get-started/get-docker/) or + [Podman](https://github.com/knative/func/blob/main/docs/building-functions/podman.md){target=_blank}, + for containerized builders (`pack` or `s2i`). +- Run commands from inside the function project directory (or use `--path`). -- You have an initialized function project containing `func.yaml` and its source. - [Create a project](creating-functions.md) if needed. -- Docker is running for the container-based buildpacks builder used here. -- Run these commands from that project directory, not its parent directory. + -### Procedure +## Build -Set an explicit local image name so the build does not need a registry prompt: +Pass your registry: the registry host and your account namespace, for example +`ghcr.io/alice` or `docker.io/alice`: === "func" ```bash - func build --builder pack \ - --image localhost/my-function:latest + func build --registry ``` === "kn func" ```bash - kn func build --builder pack \ - --image localhost/my-function:latest + kn func build --registry ``` -`my-function` is an example image name; substitute yours consistently if desired. -`localhost` here is a local tag, not a registry server you must create. Wait for -building to complete, then check the image in Docker: +`func` names the image `/:latest` and saves the registry +in `func.yaml`, so later builds and deploys need no registry flag. You can also +set the registry with `FUNC_REGISTRY`. The image stays in your container engine's +local image store until you push it. If you previously set `--image`, see +[Set the image name yourself](#set-the-image-name-yourself) to return to registry-based naming. -```bash -docker image ls localhost/my-function:latest -``` - -A row with the tag `latest` and an image ID identifies the built image. This does -not mean it was pushed or started. For publishing, see the -[deployment guide](deploying-functions.md#procedure), which explains registry -prefixes and full image destinations. [Try Functions](../getting-started/about-knative-functions.md#run-and-test) -shows how to run and test an image as a separate step. For other builders, image -naming options, and flags, see the [func build reference](https://github.com/knative/func/blob/main/docs/reference/func_build.md). - -## On-cluster Builds - -This alternative uses a remote pipeline and deploys the resulting function. -It avoids a local container build, but requires a configured cluster and registry -credentials. The source can come from Git **or** direct upload; Git is not required -for the direct-upload branch. - -### Prerequisites - -- Your kubeconfig selects a cluster with Knative Serving installed. -- Tekton Pipelines and the function build pipeline are configured according to the - [on-cluster build setup guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md). -- The pipeline can push to your chosen registry, and the cluster can pull the image. - Complete the registry/credential setup in that guide rather than assuming local - Docker login alone configures every remote pipeline. -- You have an initialized local function project and are in its directory. - -### Procedure - -Choose the source branch below. Replace `REGISTRY-USER` with your Docker Hub -account namespace in the image name. For Git, separately replace `GIT-OWNER` and -`GIT-REPO` with the repository owner and name; the Git owner need not match your -registry account. The explicit image destination avoids carrying over a local-only -tag from an earlier build. - -#### Git-backed source - -The function project must be committed in a Git repository the pipeline can read. -For a private repository, your platform administrator must provision pipeline -access before you use this branch; the linked function-build setup guide does -not provide a private-Git authentication recipe. The [Tekton authentication guide](https://tekton.dev/docs/pipelines/auth/) -is background for that platform setup. If you cannot arrange repository access, -use direct upload instead. - -These commands assume the project is at the repository root. For a subdirectory, -set `build.source.dir` in your project's `func.yaml` to its relative path, following -the configuration example in the [on-cluster build guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md). -For example, `dir: functions/my-function` selects that directory within the Git repository. - -=== "func" +## Verify the image - ```bash - func deploy --remote \ - --image docker.io/REGISTRY-USER/my-function:latest \ - --git-url https://github.com/GIT-OWNER/GIT-REPO - ``` - -=== "kn func" +Confirm the image exists (with Podman, use `podman image ls`): - ```bash - kn func deploy --remote \ - --image docker.io/REGISTRY-USER/my-function:latest \ - --git-url https://github.com/GIT-OWNER/GIT-REPO - ``` +```bash +docker image ls / +``` -#### Direct-upload source +A row with tag `latest` and an image ID confirms the build succeeded. -Use this branch to upload the current local project. No Git repository is required. -Passing an empty Git URL explicitly clears a previously configured Git source. -If you previously set `build.source.dir` for a Git subdirectory, remove that `dir` -entry from `build.source` too so the upload uses the current local project root: + -=== "func" +## Other builders - ```bash - func deploy --remote \ - --image docker.io/REGISTRY-USER/my-function:latest \ - --git-url="" - ``` +`func build` supports `--builder pack` (Cloud Native Buildpacks, the default), +`--builder s2i` (Source-to-Image), and `--builder host`, which builds with your +local toolchain and needs no container engine. The `host` builder currently +supports Go and Python functions. It writes the image to `.func/build/oci` +in the project, not to the container engine, so `docker image ls` does not list it. -=== "kn func" +For remote on-cluster builds with Tekton, see +[Deploy a function — Build and deploy remotely](deploying-functions.md#build-and-deploy-remotely). +For all flags and builder options, see the +[`func build` reference](https://github.com/knative/func/blob/main/docs/reference/func_build.md){target=_blank}. - ```bash - kn func deploy --remote \ - --image docker.io/REGISTRY-USER/my-function:latest \ - --git-url="" - ``` +## Set the image name yourself -Wait for the pipeline and deployment to finish. Verify the **deployed** function -using `func invoke --target remote` (or `kn func invoke --target remote`) and -check your function's expected response. A finished image build alone does not -prove deployment or invocation succeeded. +To choose the full image name instead of `/:latest`, +pass `--image`, for example `--image ghcr.io/alice/my-image:v1`. `func` saves it +in the `image:` line in `func.yaml`, where it takes precedence over `--registry` +and `FUNC_REGISTRY` on later builds and deploys. To return to registry-based +naming, delete the `image:` line from `func.yaml`. diff --git a/docs/versioned/functions/creating-functions.md b/docs/versioned/functions/creating-functions.md deleted file mode 100644 index c34be4b9261..00000000000 --- a/docs/versioned/functions/creating-functions.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -audience: developer -components: - - functions -function: how-to ---- - -# Creating functions - ---8<-- "create-a-function.md" diff --git a/docs/versioned/functions/deploying-functions.md b/docs/versioned/functions/deploying-functions.md index 62b578d60db..4e42bd8758f 100644 --- a/docs/versioned/functions/deploying-functions.md +++ b/docs/versioned/functions/deploying-functions.md @@ -3,36 +3,143 @@ audience: developer components: - functions function: how-to +hide_prev: true +hide_next: true --- -# Deploying functions +# Deploy a function ---8<-- "deploy-func-intro.md" +Build, push, and deploy a function project to Kubernetes as a Knative Service +(or as a raw Kubernetes Deployment). For a guided first deployment, see +[Try Functions — Deploy to Knative](../getting-started/about-knative-functions.md#deploy-to-knative-optional). -## Prerequisites +## Requirements -- You have a Kubernetes cluster with Knative Serving installed, and your kubeconfig - selects the intended cluster and namespace. For a disposable environment, - [set up a learning cluster](../getting-started/quickstart-install.md) and check - its context before returning here. Local Functions development alone does not - create a cluster. +- An initialized function project containing `func.yaml` + ([create a project](running-functions.md#create-a-project) if needed). +- A Kubernetes cluster with Knative Serving installed, with your `kubectl` + context selecting the target cluster and namespace. +- Push access to a container registry that your cluster can pull from (use a + public repository or configure image pull secrets for private registries). +- For local builds: a running [Docker](https://docs.docker.com/get-started/get-docker/) + engine. For remote builds: Tekton Pipelines configured on the cluster. -- You have a Docker daemon running on your local machine for the container builder. - Quickstart uses an existing container engine; it does not install one. +## Deploy from your machine -- You have access to a container registry and are able to push images to this registry. Note that some image registries set newly pushed images to private by default. If you are deploying a function for the first time, you may need to ensure that your images are set to public. +Run `func deploy` from inside the project directory and pass your registry: the +registry host and your account namespace, for example `ghcr.io/alice` or +`docker.io/alice`. There is no need to run `func build` first. If you previously +passed `--image` (an exact image name), `func.yaml` keeps that name in an `image:` +line, which takes precedence over `--registry` until you delete the line. -## Procedure +=== "func" -For a first deployment, follow the [worked deployment tutorial](../getting-started/about-knative-functions.md#deploy-to-knative-optional), -which covers cluster setup, registry login, and the full image name. This is also -the next step if you are coming from the local Functions track. + ```bash + func deploy --registry + ``` -In the commands below, `` means the registry **and your account namespace**. -For example, `docker.io/alice` means Alice's Docker Hub namespace, and -`ghcr.io/alice` means her GitHub Container Registry namespace. Substitute your own -account; do not type the angle brackets. The CLI uses that prefix with the -function's project name to construct the image name. The worked tutorial instead -uses `--image` to set the complete destination explicitly. +=== "kn func" ---8<-- "proc-deploying-function.md" + ```bash + kn func deploy --registry + ``` + +`func` builds the image, pushes it to `/:latest`, and +creates or updates a Knative Service with the project name. + +- **Namespace:** By default, `func deploy` uses the previously deployed + namespace recorded in the project, or your current `kubectl` namespace on + first deploy. Pass `-n ` to target a specific namespace. +- **Private registries:** Set `FUNC_USERNAME` and `FUNC_PASSWORD` environment + variables for registry push credentials (avoid passing `--password` on the + command line), and ensure the target cluster namespace has pull credentials. +- **Raw Kubernetes deployer:** Add `--deployer raw` to deploy as a standard + Kubernetes Deployment and Service instead of a Knative Service. + +## Build and deploy remotely + +Use `--remote` to run the build and deployment on the cluster with Tekton +Pipelines instead of a local Docker engine. Configure Tekton and pipeline RBAC +first using the +[on-cluster build guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md){target=_blank}. + +The following commands use the source flags introduced in `func` v1.24.0. +Before v1.24.0, `--source`, `--revision`, and `--source-dir` were named +`--git-url`, `--git-branch`, and `--git-dir`, respectively. + +Choose one source method (replace `REGISTRY-USER` with your registry account +namespace): + +=== "Git-backed source" + + Commit your project to a Git repository the cluster pipeline can read. For + private repositories, have your platform administrator provision pipeline + Git access first (see the + [Tekton authentication guide](https://tekton.dev/docs/pipelines/auth/){target=_blank}). + If the project is in a subdirectory, add `--source-dir `. + To select a branch, tag, or commit, add `--revision `. + + ```bash + func deploy --remote \ + --registry docker.io/REGISTRY-USER \ + --source https://github.com/GIT-OWNER/GIT-REPO + ``` + + With an explicit `--source`, `func` deploys the function by reference from + the repository and does not write to the local `func.yaml`. Do not combine + `--source` with `--image`; use `--registry` instead. Re-run the same command + with `--source` for subsequent Git-backed deployments. + +=== "Direct upload (no Git)" + + Upload the current local project directory directly. Passing `--source=""` + and `--source-dir=""` clears any previously configured Git repository and + subdirectory: + + ```bash + func deploy --remote \ + --registry docker.io/REGISTRY-USER \ + --source="" --source-dir="" + ``` + +(`kn func deploy` accepts the same flags.) + +## Verify + +Invoke the deployed function with an explicit `--target remote` so you do not +accidentally hit a locally running instance: + +=== "func" + + ```bash + func invoke --target remote + ``` + +=== "kn func" + + ```bash + kn func invoke --target remote + ``` + +Confirm the response body matches your function's expected output. You can also +check status on the cluster: + +- **Knative deployer (default):** `kn service describe -n ` +- **Raw deployer (`--deployer raw`):** `kubectl get deployment/ service/ -n ` + +## Update and remove + +- **Update:** + - Local builds and direct-upload remote builds: edit your code and re-run + `func deploy` (or `func deploy --remote --source="" --source-dir=""`). + - Git-backed remote builds: commit and push your changes to the Git + repository first, then re-run the same `func deploy --remote --source ...` + command, including any `--revision` and `--source-dir` flags. + - With the default Knative deployer, each deploy rolls out a new Revision; + with `--deployer raw`, it updates the Kubernetes Deployment. +- **Remove:** Run `func delete` from inside the project directory (works for + both Knative and raw deployers). You can also delete directly with + `kn service delete -n ` (Knative deployer) or + `kubectl delete deployment/ service/ -n ` (raw + deployer). Deleting the workload does not delete the pushed image from your + container registry. diff --git a/docs/versioned/functions/install-func.md b/docs/versioned/functions/install-func.md deleted file mode 100644 index ad5aca03307..00000000000 --- a/docs/versioned/functions/install-func.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -audience: developer -components: - - functions -function: how-to ---- - -# Installing Knative Functions - ---8<-- "install-functions-intro.md" - -## Installing the `func` CLI - ---8<-- "install-func-CLI.md" - -## Installing the `kn func` CLI plugin - ---8<-- "install-kn-func-plugin.md" diff --git a/docs/versioned/functions/invoking-functions.md b/docs/versioned/functions/invoking-functions.md deleted file mode 100644 index da8d92b9300..00000000000 --- a/docs/versioned/functions/invoking-functions.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -audience: developer -components: - - functions -function: how-to ---- - -# Invoking functions - -You can use the `func invoke` command to send a test request to invoke a -function either locally or on your Knative cluster. - -This command can be used to test that a function is working and able to receive HTTP requests and CloudEvents correctly. - -If your function is running locally, `func invoke` sends a test request to the local instance. - -You can use the `func invoke` command to send test data to your function with the `--data` flag, as well as other options to simulate different types of requests. See the [func invoke](https://github.com/knative/func/blob/main/docs/reference/func_invoke.md){target=_blank} documentation for more information. diff --git a/docs/versioned/functions/kafka-functions.md b/docs/versioned/functions/kafka-functions.md deleted file mode 100644 index 66cbcbef7be..00000000000 --- a/docs/versioned/functions/kafka-functions.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -audience: developer -components: - - functions -function: explanation ---- - -# Kafka functions - -A function can consume messages from an Apache Kafka topic. When a function declares a `run.kafka` configuration, `func` deploys a language-agnostic runtime sidecar alongside it. The sidecar consumes the topic and delivers each record to the function as a CloudEvent over HTTP, so the function stays a plain CloudEvents handler in any language, with no Kafka client code of its own. - -The full guide lives in the `func` repository, covering concepts, a getting-started walkthrough, delivery and retries, deployment and scaling, idempotency, local development, and troubleshooting: - -- [Kafka functions guide](https://github.com/knative/func/blob/main/docs/kafka-functions/README.md){target=_blank} -- [run.kafka configuration reference](https://github.com/knative/func/blob/main/docs/reference/func_yaml.md#runkafka){target=_blank} diff --git a/docs/versioned/functions/language-packs.md b/docs/versioned/functions/language-packs.md index 0322039ed87..431011aee5f 100644 --- a/docs/versioned/functions/language-packs.md +++ b/docs/versioned/functions/language-packs.md @@ -3,19 +3,84 @@ audience: developer components: - functions function: how-to +hide_prev: true +hide_next: true --- -# Language packs +# Templates and runtimes -Language packs can be used to extend Knative Functions to support additional runtimes, function signatures, operating systems, and installed tooling for functions. Language Packs are distributed through Git repositories or as a directory on a disc. +Knative Functions includes built-in language runtimes and templates, and lets +you pull custom templates from Git repositories via language packs. -For more information see the [language pack](https://github.com/knative/func/blob/main/docs/language-packs/language-pack-contract.md){target=_blank} documentation. +## Choose a runtime -## Using external Git repositories +Pass `-l ` to `func create`. Built-in runtimes: -When creating a new function, a Git repository can be specified as the source -for the template files. +| Runtime | `-l` value | +| --- | --- | +| Go | `go` | +| Node.js | `node` | +| TypeScript | `typescript` | +| Python | `python` | +| Quarkus (Java) | `quarkus` | +| Spring Boot (Java) | `springboot` | +| Rust | `rust` | -## Installing language packs locally +## Choose HTTP or CloudEvents -Language packs can be installed locally by using the [`func repository`](https://github.com/knative/func/blob/main/docs/reference/func_repository.md){target=_blank} command. +Pass `-t