diff --git a/config/redirects.yml b/config/redirects.yml index a9c66224e45..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 @@ -169,7 +169,7 @@ plugins: versioned/install/collecting-metrics/index.md: versioned/serving/observability/metrics/collecting-metrics.md versioned/install/eventing/eventing-installation-files.md: versioned/install/yaml-install/eventing/eventing-installation-files.md versioned/install/eventing/install-eventing-with-yaml.md: versioned/install/yaml-install/eventing/install-eventing-with-yaml.md - versioned/install/getting-started-knative-app/index.md: versioned/getting-started/README.md + versioned/install/getting-started-knative-app/index.md: versioned/README.md versioned/install/install-extensions.md: versioned/install/README.md versioned/install/installation-files.md: versioned/install/README.md versioned/install/prerequisites.md: versioned/install/README.md @@ -181,12 +181,12 @@ 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 versioned/serving/feature-flags.md: versioned/serving/configuration/feature-flags.md - versioned/serving/getting-started-knative-app.md: versioned/getting-started/README.md + versioned/serving/getting-started-knative-app.md: versioned/README.md versioned/serving/installing-cert-manager.md: versioned/install/installing-cert-manager.md versioned/serving/metrics.md: versioned/serving/observability/metrics/serving-metrics.md versioned/serving/samples/README.md: versioned/samples/serving.md @@ -227,3 +227,27 @@ plugins: versioned/eventing/brokers/create-mtbroker.md: versioned/eventing/brokers/create-broker.md versioned/eventing/brokers/broker-admin-config-options.md: versioned/eventing/configuration/broker-configuration.md versioned/eventing/event-mesh.md: versioned/eventing/concepts/event-mesh.md + versioned/getting-started/README.md: versioned/README.md + versioned/getting-started/tutorial.md: versioned/README.md + versioned/getting-started/first-autoscale.md: versioned/getting-started/first-service.md#watch-autoscaling + versioned/getting-started/first-traffic-split.md: versioned/getting-started/first-service.md#split-traffic + versioned/getting-started/install-func.md: versioned/getting-started/about-knative-functions.md#prepare + versioned/getting-started/create-a-function.md: versioned/getting-started/about-knative-functions.md#create-and-change + versioned/getting-started/build-run-deploy-func.md: versioned/getting-started/about-knative-functions.md#run-and-test + versioned/getting-started/first-broker.md: versioned/getting-started/getting-started-eventing.md#prepare + versioned/getting-started/first-source.md: versioned/getting-started/getting-started-eventing.md#connect-the-player + versioned/getting-started/first-trigger.md: versioned/getting-started/getting-started-eventing.md#filter-events-optional + 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/about-functions.md b/docs/snippets/about-functions.md index 620e20e9964..3ac67b05f77 100644 --- a/docs/snippets/about-functions.md +++ b/docs/snippets/about-functions.md @@ -6,6 +6,6 @@ Knative Functions provides a simple programming model for using functions on Kna Knative Functions enables you to easily create, build, and deploy [stateless](https://www.techtarget.com/whatis/definition/stateless-app){target=_blank}, [event-driven](https://en.wikipedia.org/wiki/Event-driven_programming){target=_blank} functions as Knative Services by using the `func` CLI. -When you build or run a function, an [Open Container Initiative (OCI) format](https://opencontainers.org/about/overview/){target=_blank} container image is generated automatically for you, and is stored in a container registry. Each time you update your code and then run or deploy it, the container image is also updated. +Functions can be packaged as [Open Container Initiative (OCI) images](https://opencontainers.org/about/overview/){target=_blank} without writing a Dockerfile. A local container build does not publish an image to a registry. Deployment builds and pushes an image so the cluster can pull it. Supported host builders can also run functions locally without a container. You can create functions and manage function workflows by using the `func` CLI, or by using the `kn func` plugin for the Knative CLI. diff --git a/docs/snippets/install-func-CLI.md b/docs/snippets/install-func-CLI.md index db5b386b987..ebd4598e9f9 100644 --- a/docs/snippets/install-func-CLI.md +++ b/docs/snippets/install-func-CLI.md @@ -72,20 +72,3 @@ ```bash func version ``` - -=== "Container image" - - Run `func` from a container image. For example: - - ```bash - docker run --rm -it ghcr.io/knative/func/func create -l node -t http myfunc - ``` - - Links to images are available here: - - - [Latest release](https://gcr.io/knative-releases/knative.dev/client/cmd/kn){target=_blank} - - !!! note - Running `func` from a container image does not place the binary on a permanent path. This procedure must be repeated each time you want to use `func`. - - diff --git a/docs/snippets/install-kn.md b/docs/snippets/install-kn.md index a481a78c3a1..969fb79e562 100644 --- a/docs/snippets/install-kn.md +++ b/docs/snippets/install-kn.md @@ -10,6 +10,9 @@ The Knative CLI (`kn`) provides a quick and easy interface for creating Knative The `kn` CLI also simplifies completion of otherwise complex procedures such as autoscaling and traffic splitting. +Install `kn` on your local machine so you can run it directly and use plugins +such as `quickstart`. + === "Using Homebrew" Do one of the following: @@ -73,18 +76,3 @@ The `kn` CLI also simplifies completion of otherwise complex procedures such as ```bash kn version ``` - -=== "Using a container image" - - Links to images are available here: - - - [Latest release](https://gcr.io/knative-releases/knative.dev/client/cmd/kn){target=_blank} - - You can run `kn` from a container image. For example: - - ```bash - docker run --rm -v "$HOME/.kube/config:/root/.kube/config" gcr.io/knative-releases/knative.dev/client/cmd/kn:latest service list - ``` - - !!! note - Running `kn` from a container image does not place the binary on a permanent path. This procedure must be repeated each time you want to use `kn`. diff --git a/docs/snippets/proc-deploying-function.md b/docs/snippets/proc-deploying-function.md index 74943a0b0e6..b91cf4ef548 100644 --- a/docs/snippets/proc-deploying-function.md +++ b/docs/snippets/proc-deploying-function.md @@ -56,21 +56,25 @@ The `deploy` command uses the function project name as the Knative Service name. **Note:** Using environment variables is more secure than the `--password` flag because command-line arguments are visible to all users on the system via `ps`. -You can verify that your function has been successfully deployed by using the `invoke` command and observing the output: +Verify the deployed function with an explicit `remote` target, even if a local +function is also running. The response should contain your function's expected +output; deployment readiness alone does not prove you called the remote instance: === "func" ```bash - func invoke + func invoke --target remote ``` === "kn func" ```bash - kn func invoke + kn func invoke --target remote ``` -!!! Success "Expected output" +The response format varies by template. For example: + +!!! Success "Example response" ```{ .bash .no-copy } Received response POST / HTTP/1.1 hello.default.127.0.0.1.sslip.io 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/stylesheets/extra.css b/docs/stylesheets/extra.css index b9bb6c53e73..0de39b7cc4b 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -16,6 +16,12 @@ --site-nav-bg: #14385d; --site-nav-text: #d4e3f4; --site-nav-focus: #9bd5ff; + --knative-functions-color: #7a357d; + --knative-functions-background: #faf5fb; + --knative-serving-color: #125cb3; + --knative-serving-background: #f2f7fd; + --knative-eventing-color: #287867; + --knative-eventing-background: #f1f8f6; } /* Deep-navy canvas for elastic overscroll; regular page content stays white. */ @@ -406,6 +412,154 @@ body:not(:has(#__search:checked)) .md-header .md-search__icon[for='__search'] { overflow-wrap: anywhere; } +/* The docs front door reuses the splash page's component palette. */ +.md-typeset .knative-docs-home { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 1rem; + margin-block: 1.5rem; +} + +.knative-docs-panel { + display: flex; + flex-direction: column; + min-width: 0; + padding-block: 1rem 0.25rem; + border-top: 1px solid #e4e7ec; +} + +.knative-docs-panel--try { + display: block; + grid-column: 1 / -1; + padding: 0 0 0.5rem; + border: 0; +} + +.md-typeset .knative-docs-home h2 { + margin: 0 0 0.6rem; + font-size: 1.05rem; + line-height: 1.4; +} + +.md-typeset .knative-docs-panel--try > h2 { + font-size: 1.25rem; +} + +.knative-docs-tracks { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 1rem; + margin-block: 1.15rem 0.85rem; +} + +.knative-docs-track { + position: relative; + display: flex; + flex-direction: column; + min-width: 0; + padding: 1.15rem; + border: 1px solid transparent; + border-radius: 0.6rem; + background: var(--component-background); +} + +.knative-docs-track--serving { + --component-color: var(--knative-serving-color); + --component-background: var(--knative-serving-background); +} + +.knative-docs-track--functions { + --component-color: var(--knative-functions-color); + --component-background: var(--knative-functions-background); +} + +.knative-docs-track--eventing { + --component-color: var(--knative-eventing-color); + --component-background: var(--knative-eventing-background); +} + +.md-typeset .knative-docs-track h3 { + margin: 0 0 0.55rem; + color: var(--component-color); + font-size: 1.05rem; +} + +.md-typeset .knative-docs-track .headerlink { + display: none; +} + +.md-typeset .knative-docs-track p { + margin: 0; + line-height: 1.6; +} + +.md-typeset .knative-docs-track__link { + color: var(--component-color); + font-weight: 600; +} + +/* A single descriptive link makes the whole track card clickable. */ +.knative-docs-track__link::after { + position: absolute; + inset: 0; + border-radius: 0.6rem; + content: ""; +} + +@media (hover: hover) { + .knative-docs-track:hover { + border-color: var(--component-color); + } +} + +.knative-docs-track:has(:focus-visible) { + outline: 2px solid var(--component-color); + outline-offset: 2px; +} + +.md-typeset .knative-docs-panel > :last-child, +.md-typeset .knative-docs-track > :last-child { + margin-bottom: 0; +} + +.md-typeset .knative-docs-panel > ul { + margin: 0; + padding-top: 0.35rem; + list-style: none; +} + +.md-typeset .knative-docs-panel > ul > li { + margin: 0; + padding-block: 0.25rem; +} + +.md-typeset .knative-docs-panel > ul > li > a { + display: inline-block; +} + +.md-typeset .knative-docs-reference { + margin-block: 1.5rem; + padding-top: 1rem; + border-top: 1px solid #e4e7ec; +} + +.md-typeset .knative-docs-reference ul { + margin: 0; + list-style: none; +} + +.md-typeset .knative-docs-reference li { + margin: 0; + padding-block: 0.25rem; +} + +@media screen and (max-width: 47.5em) { + .md-typeset .knative-docs-home, + .knative-docs-tracks { + grid-template-columns: minmax(0, 1fr); + } +} + /* Ink/link colors differ by over 3:1; reserve persistent underlines for utilities. */ .md-typeset blockquote { color: var(--md-default-fg-color); diff --git a/docs/versioned/.nav.yml b/docs/versioned/.nav.yml index b1a9efc1e61..c066a1415d9 100644 --- a/docs/versioned/.nav.yml +++ b/docs/versioned/.nav.yml @@ -1,235 +1,168 @@ nav: -############################################################################### - # Concepts -############################################################################### - - Overview: README.md ############################################################################### # Getting started ############################################################################### - - Tutorials: - - Explore Knative: getting-started/tutorial.md - - Quickstart: - - Tutorial introduction: getting-started/README.md - - Install Knative using quickstart: getting-started/quickstart-install.md - - Knative Functions: - - Getting Started: getting-started/about-knative-functions.md - - Installing Knative Functions: getting-started/install-func.md - - Creating a function: getting-started/create-a-function.md - - Building, running, or deploying a function: getting-started/build-run-deploy-func.md - - Knative Serving: - - Deploying a Knative Service: getting-started/first-service.md - - Autoscaling: getting-started/first-autoscale.md - - Traffic splitting: getting-started/first-traffic-split.md - - Knative Eventing: - - Getting Started: getting-started/getting-started-eventing.md - - Sources, Brokers, and Triggers: getting-started/first-broker.md - - Using a Knative Service as a source: getting-started/first-source.md - - Using Triggers and sinks: getting-started/first-trigger.md - - What's Next?: getting-started/next-steps.md - - Clean Up: getting-started/clean-up.md - - "E2E tutorial: Knative Bookstore": - - Overview: bookstore/page-0/welcome-knative-bookstore-tutorial.md - - Disclaimer: bookstore/disclaimer/README.md - - Environment Setup: bookstore/page-0.5/environment-setup.md - - 1 - Send Comments to Broker: bookstore/page-1/send-review-comment-to-broker.md - - 2 - Create Sentiment Service: bookstore/page-2/sentiment-analysis-service-for-bookstore-reviews.md - - 3 - Create Bad Word Service: bookstore/page-3/create-bad-word-filter-service.md - - 4 - Create Sequence: bookstore/page-4/create-sequence-to-streamline-ML-workflows.md - - 5 - Create DB service: bookstore/page-5/deploy-database-service.md - - 6 - Advanced event filtering: bookstore/page-6/advanced-event-filtering.md - - 7 - Connect Slack via Camel-K: bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md - - 8 - Extra Challenges: bookstore/extra-challenge/README.md + - Get Started: + - README.md + - Component tutorials: + - Set up a cluster: getting-started/quickstart-install.md + - Try Serving: getting-started/first-service.md + - Try Functions: getting-started/about-knative-functions.md + - Try Eventing: getting-started/getting-started-eventing.md + - Next steps and cleanup: getting-started/next-steps.md + - Bookstore tutorial: + - Overview: bookstore/page-0/welcome-knative-bookstore-tutorial.md + - Disclaimer: bookstore/disclaimer/disclaimer.md + - Set up your environment: bookstore/page-0.5/environment-setup.md + - 1 - Send review comments: bookstore/page-1/send-review-comment-to-broker.md + - 2 - Analyze sentiment: bookstore/page-2/sentiment-analysis-service-for-bookstore-reviews.md + - 3 - Filter bad words: bookstore/page-3/create-bad-word-filter-service.md + - 4 - Connect a Sequence: bookstore/page-4/create-sequence-to-streamline-ML-workflows.md + - 5 - Deploy the database: bookstore/page-5/deploy-database-service.md + - 6 - Filter events: bookstore/page-6/advanced-event-filtering.md + - 7 - Connect Slack: bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md + - 8 - Extra challenges: bookstore/extra-challenge/extra-challenges.md + - Technical overview: overview.md ############################################################################### # Functions ############################################################################### - Functions: - - Knative Functions overview: functions/README.md - - Installing Knative Functions: functions/install-func.md - - Creating functions: functions/creating-functions.md - - Building functions: functions/building-functions.md - - Running functions: functions/running-functions.md - - Subscribing functions: functions/subscribing-functions.md - - Deploying functions: functions/deploying-functions.md - - Invoking functions: functions/invoking-functions.md - - Kafka functions: functions/kafka-functions.md - - Language packs: functions/language-packs.md + - Overview: functions/README.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 - # Serving - Application Security - - Application security: - - 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 - # Serving - troubleshooting - - Troubleshooting: - - Debugging application issues: serving/troubleshooting/debugging-application-issues.md - # Serving reference docs - - Reference: - - Serving API: serving/reference/serving-api.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 ############################################################################### # 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 - # Eventing reference docs - - Reference: - - Eventing API: eventing/reference/eventing-api.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 ############################################################################### - # CLI + # Install and Manage ############################################################################### - - CLI tools: - - CLI tools: client/README.md - - Installing the Knative CLI: client/install-kn.md - - Customizing kn: client/configure-kn.md - - kn plugins: client/kn-plugins.md -############################################################################### - # Administration -############################################################################### - - Administration: + - Install and Manage: - Overview: admin/admin-overview.md + - CLI tools: + - CLI tools: client/README.md + - Installing the Knative CLI: client/install-kn.md + - Customizing kn: client/configure-kn.md + - kn plugins: client/kn-plugins.md - Installing Knative: - Overview: install/README.md # YAML Installation @@ -274,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 @@ -327,11 +261,4 @@ nav: - Uninstalling Knative: install/uninstall.md # Troubleshooting - Troubleshooting Knative: install/troubleshooting.md -############################################################################### - # Code samples -############################################################################### - - Code samples: - - Code sample overview: samples/README.md - - Serving code samples: samples/serving.md - - Eventing code samples: samples/eventing.md diff --git a/docs/versioned/README.md b/docs/versioned/README.md index ee2487b9182..c0ccfe48a1e 100644 --- a/docs/versioned/README.md +++ b/docs/versioned/README.md @@ -1,269 +1,78 @@ --- +title: Get started with Knative audience: developer components: - eventing - functions - serving -function: explanation +hide_next: true +hide: + - toc --- -# Knative Technical Overview + -This comprehensive overview explains what Knative is, what problems it solves, and how its components work together. Whether you're evaluating Knative for your use case or need background information to understand the rest of the documentation, this section provides the conceptual foundation you need. +# Get started with Knative -## What is Knative? +Knative extends Kubernetes to build, deploy, and manage serverless workloads. +Its three components — **Serving**, **Functions**, and **Eventing** — can be +used independently or together. -Knative is a Kubernetes-based platform that provides a complete set of middleware components for building, deploying, and managing modern [serverless](https://en.wikipedia.org/wiki/Serverless_computing){target=_blank} workloads. Knative extends Kubernetes to provide higher-level abstractions that simplify the development and operation of cloud-native applications. + -### Problems Knative Solves +
-Knative addresses several key challenges in modern application development and deployment: +
-**Application Deployment Complexity**: Traditional Kubernetes requires deep knowledge of pods, services, deployments, and ingress resources. These constructs provide a lot of flexibility and complexity that most applications don't need. Knative provides simpler abstractions that handle these details automatically. +### [Try Serving →](getting-started/first-service.md){ .knative-docs-track__link } { #try-serving } -**Serverless Operations**: Manual scaling, cold starts, and traffic routing are complex to implement. Knative provides automatic scaling from zero to thousands of instances, intelligent traffic routing, and efficient resource utilization. +Deploy a container, observe autoscaling, and split traffic. Recommended first. -**Event-Driven Architecture**: Building reliable event-driven systems requires complex infrastructure for event ingestion, routing, and delivery. Building event routing and delivery into your application limits your choice of event delivery and architecture; Knative provides standardized event processing capabilities across multiple event implementations using CloudEvents for delivery and Kubernetes for configuration. +
-**Developer Experience**: Moving from code to running applications involves multiple steps and tools. Knative Functions provide a streamlined and standardized developer experience for building and deploying stateless functions as standard containers. Build and test locally without Kubernetes, and avoid managing build details like Dockerfiles and Kubernetes resources until you need them. +
-**Platform Lock-in**: Cloud-specific serverless solutions create vendor lock-in. Knative runs on any Kubernetes cluster, providing portability across cloud providers and on-premises environments. +### [Try Functions →](getting-started/about-knative-functions.md){ .knative-docs-track__link } { #try-functions } -## Background Knowledge +Create, change, and test a Go function locally. -While you didn't need any specific programming experience to get started with Knative, you'll pick up the following concepts along the way. Knative will manage a lot of these in the background, so you can dive in deep when you're ready to learn. +
-- **Basic Kubernetes knowledge**: Understanding of pods, services, and deployments -- **Container concepts**: How to build and manage container images -- **HTTP/REST APIs**: Understanding of web service fundamentals -- **Basic YAML**: Ability to read and write Kubernetes resource definitions +
-For event-driven features, familiarity with: -- **Event-driven patterns**: Basic understanding of producers, consumers, and message routing -- **CloudEvents specification**: Helpful but not required (Knative handles the details) +### [Try Eventing →](getting-started/getting-started-eventing.md){ .knative-docs-track__link } { #try-eventing } -## Architecture Overview +Send an event through a Broker and observe delivery. -Knative consists of three main components that work together to provide a complete serverless platform: +
-[![Knative High-Level Architecture: Functions, Serving, and Eventing. Functions creates containers and defines event triggers, Serving runs containers, and Eventing routes events based on triggers.](../images/home-images/knative_flowchart_graphic.svg){draggable=false}](../images/home-images/knative_flowchart_graphic.svg){.diagram-link} +
-**Knative Serving**: An HTTP-triggered autoscaling container runtime that manages the complete lifecycle of stateless HTTP services, including deployment, routing, and automatic scaling. +## Why Knative? -**Knative Eventing**: A CloudEvents-over-HTTP asynchronous routing layer that provides infrastructure for consuming and producing events, enabling loose coupling between event producers and consumers. +- **Simpler application deployment:** Define a Knative Service instead of wiring + Deployments, Services, Ingress, and autoscalers by hand. +- **Scale to zero and back:** Automatically scale pods from zero to match demand + and split traffic across immutable Revisions. +- **Loosely coupled events:** Route CloudEvents over HTTP between producers and + consumers without hard-coding endpoints into application code. +- **Code-to-container workflow:** Build, run, and test stateless functions + locally without writing Dockerfiles or Kubernetes manifests first. +- **Portable across Kubernetes:** Run on any Kubernetes cluster — cloud or + on-premises — without vendor lock-in. -**Knative Functions**: A developer-focused function framework that leverages Serving and Eventing components to provide a simplified experience for building and deploying stateless functions. +## When to use Knative -These components can be used independently or together, allowing you to adopt Knative incrementally based on your needs. +Knative is a strong fit for stateless HTTP APIs, event-driven pipelines, +microservices, AI/ML inference (directly or with +[KServe](https://kserve.github.io)), and on-demand development +environments. Consider alternatives if your workloads require sub-100ms cold +starts, persistent in-process state, or long-running stateful processes. -## Knative Serving +
---8<-- "about-serving.md" +- [Technical overview](overview.md) — Serving, Eventing, and Functions internals and Kubernetes ecosystem integration. +- [Install and Manage](admin/admin-overview.md) — install and operate Knative on your own cluster. +- [Next steps and cleanup](getting-started/next-steps.md) — continue after a tutorial or clean up. -### Key Serving Features - -**Automatic Scaling**: Services automatically scale from zero to handle incoming traffic and scale back down when idle, optimizing resource usage and costs. - -**Traffic Management**: Built-in support for blue-green deployments, canary releases, and traffic splitting between different revisions of your application. - -**Networking**: Automatic ingress configuration with support for custom domains, TLS termination, and integration with service mesh technologies. - -**Kubernetes Native**: Knative builds on the Kubernetes Pod abstraction, making it easy to access functionality like service accounts, accelerator access, and container sandboxing. - -**Configuration Management**: Clean separation between application code and configuration, following twelve-factor app principles. - -### Request Flow in Serving - -![Knative Serving data flow: requests arrive at an HTTP router, then travel to either the activator or a pod with a queue-proxy and the user application. The Knative autoscaler collects metrics from the activator and the queue-proxy to determine how many pods to run.](./serving/images/request-flow.png){draggable=false} - -When a request is made to a Knative Service: - -1. **Ingress Layer**: The request enters through the configured networking layer (Kourier, Istio, or Contour) -2. **Routing Decision**: Based on current traffic patterns and scaling state, requests are routed either to the Activator or directly to application pods -3. **Scaling**: If no pods are running (scale-to-zero), the Activator queues the request and signals the Autoscaler to create pods -4. **Queue-Proxy**: All requests pass through the Queue-Proxy sidecar, which enforces concurrency limits and collects metrics -5. **Application**: The request reaches your application container - -For detailed information, see the [request flow documentation](serving/request-flow.md). - -### GPU Resources and LLM Inference - -Knative Serving can leverage Kubernetes pod capabilities to access specialized hardware resources like GPUs, making it an excellent platform for AI/ML inference workloads: - -**GPU Resource Access**: Since Knative Services are implemented as Kubernetes pods, you can request GPU resources using standard Kubernetes resource specifications. This enables running inference models that require GPU acceleration while benefiting from Knative's automatic scaling and traffic management. - -**LLM Inference Support**: Knative Serving provides an ideal foundation for Large Language Model (LLM) inference services, offering: - -- **Automatic scaling** from zero to multiple GPU-enabled pods based on request demand -- **Traffic splitting** for A/B testing different model versions or configurations -- **Resource efficiency** by scaling down expensive GPU resources when not in use -- **Standard HTTP interfaces** for model serving and inference endpoints - -**KServe Integration**: For production LLM deployments, consider using [KServe](https://kserve.github.io), a Kubernetes-native model serving platform built on Knative Serving. KServe provides: - -- Standardized inference protocols and multi-framework support -- Advanced features like model ensembling, explainability, and drift detection -- Optimized serving runtimes for popular ML frameworks (TensorFlow, PyTorch, ONNX, etc.) -- Built-in support for autoscaling GPU workloads and batching requests - -Whether using Knative Serving directly for custom inference services or through KServe for standardized model serving, you get the benefits of Kubernetes-native resource management combined with serverless operational characteristics. - -## Knative Eventing - ---8<-- "about-eventing.md" - -### Key Eventing Concepts - -**Event Sources**: Components that generate events from external systems (databases, message queues, cloud services, etc.) and send them into the Knative event mesh. - -**Brokers**: Event routers that receive events from sources and forward them to interested consumers based on CloudEvent attributes. - -**Triggers**: Configuration objects that define which events should be delivered to which consumers, using filtering based on event metadata. - -**Sinks**: Event consumers that receive and process events. These can be Knative Services, Kubernetes Services, or external endpoints. - -**Channels**: Lower-level primitives for point-to-point event delivery between producers and consumers. - -### Event Flow in Eventing - -![Two event sources named 1 and 2 deliver events to a broker. One trigger attached to the broker delivers type 1 events to one sink (endpoint), and another trigger selects type 2 events to deliver to a different sink.](https://user-images.githubusercontent.com/16281246/116248768-1fe56080-a73a-11eb-9a85-8bdccb82d16c.png){draggable=false} - -A typical event flow involves: - -1. **Event Generation**: An event source detects a change or condition and creates a CloudEvent -2. **Event Ingestion**: The event is sent to a Broker via HTTP POST -3. **Event Routing**: The Broker evaluates Triggers to determine which consumers should receive the event -4. **Event Delivery**: The event is delivered to matching consumers as HTTP requests -5. **Event Processing**: Consumers process the event and optionally produce response events - -### Eventing Use Cases - -- **Data Pipeline Processing**: Transform and route data through multiple processing stages -- **Integration Patterns**: Connect disparate systems using event-driven communication -- **Workflow Orchestration**: Coordinate complex business processes across multiple services -- **Real-time Analytics**: Process streaming data for monitoring and alerting - -## Knative Functions - ---8<-- "about-functions.md" - -### Functions Development Model - -Knative Functions provide a simplified programming model that abstracts away infrastructure concerns: - -**Function Signature**: Functions follow a simple signature pattern leveraging standard libraries (such as HTTP and CloudEvents) to prevent lock-in. - -**Built-in Templates**: Language-specific templates provide starting points for common function patterns and integrate with popular frameworks. - -**Local Development**: Functions can be built, run, and tested locally before deployment to Kubernetes. - -**Automatic Containerization**: The `func` CLI automatically builds container images from your function code without requiring Dockerfile expertise. - -**Easy Deployment**: Function containers can be run anywhere you can run an HTTP application. `func` can also deploy your container to Knative Serving, where you can manage it with the `kn` CLI or standard Kubernetes YAML. - -### Supported Languages and Runtimes - -Functions support multiple programming languages through language packs: - -- **Node.js**: Using popular frameworks like Express -- **Python**: With Flask and FastAPI support -- **Go**: Native Go HTTP handlers -- **Java**: Using Spring Boot and Quarkus -- **TypeScript**: Full TypeScript support with Node.js - -You can also build your own language packs to customize the output container to your own specifications. - -### Function Deployment and Lifecycle - - -``` mermaid -flowchart TD - init>"`func init - to create a function`"] - git@{ shape: lin-cyl, label: "fa:fa-git-alt local repo" } - laptop@{ shape: win-pane, label: "Local Development fa:fa-docker" } - oci@{ shape: procs, label: "Container Registry" } - cluster@{ label: "fa:fa-dharmachakra Knative Serving" } - -init --> git -git -- develop and test locally--> laptop -laptop --> git -git -- "`func push -push container to registry`" --> oci -.-> cluster -git -- deploy container and triggers --> cluster -``` - -1. **Development**: Write your function using language-specific templates -2. **Building**: The `func` CLI creates an optimized container image -3. **Deployment**: Functions are deployed as Knative Services with automatic scaling -4. **Invocation**: Functions can be triggered by HTTP requests or CloudEvents -5. **Management**: Update, delete, and monitor functions using familiar Kubernetes tools - -## System Integration and Interoperability - -### How Components Work Together - -While each Knative component can be used independently, they're designed to work seamlessly together: - -**Functions + Serving**: Functions are deployed as Knative Services, inheriting all serving capabilities like autoscaling and traffic management. - -**Functions + Eventing**: Functions can be triggered by CloudEvents, enabling event-driven function execution and microservice orchestration. - -**Serving + Eventing**: Services can act as event sources or sinks, participating in complex event-driven workflows. - -### Integration with Kubernetes Ecosystem - -Knative integrates with standard Kubernetes resources and third-party tools: - -**Kubernetes-native resources**: Serving and Eventing are implemented as Kubernetes custom resources, meaning that you can use the same policy and IAM tools you use for Kubernetes. - -**Builds on Kubernetes**: Serving creates Pods (so you can use GPUs, service accounts, and other Kubernetes features), and Eventing can easily deliver events to Kubernetes services as well as Serving functions. - -**Networking**: Integrates with cert-manager for certificate management, and with Gateway API for ingress. Integrates with Istio, Envoy, and other service mesh technologies for advanced traffic management and security. - -**Monitoring**: Using [OpenTelemetry](https://opentelemetry.io/), integrates with Prometheus, Grafana, Jaeger, and many other observability tools for metrics and monitoring. - -**CI/CD**: Compatible with GitOps workflows, Tekton Pipelines, and other continuous deployment tools. - -## Use Cases and When to Choose Knative - -### Ideal Use Cases - -**API Development**: Rapidly develop and deploy REST APIs with built-in scaling and traffic management. - -**Event-Driven Applications**: Process events from various sources with reliable delivery and error handling. - -**Inference Services**: Use Knative directly, or integrate with [KServe](https://kserve.github.io) to easily manage AI inference models. - -**Microservices Architecture**: Build and deploy loosely coupled services with automatic scaling and service discovery. - -**Integration Workflows**: Connect legacy systems and SaaS applications using event-driven patterns. - -**Edge Computing**: Deploy lightweight functions and services closer to users or data sources. - -**Development Environments**: Automatically scale down development environments when not in use; start them up again when requests arrive. - -### Evaluation Criteria - -Choose Knative when you need: - -- **Kubernetes-native serverless** with no vendor lock-in -- **Automatic scaling** including scale-to-zero capabilities -- **Event-driven architecture** with standardized event processing -- **Developer productivity** improvements for cloud-native applications -- **Cost optimization** through efficient resource utilization -- **Flexibility** to use components independently based on your needs - -Consider alternatives when: - -- You need extremely low cold-start latency (sub-100ms) -- Your workloads require persistent state or long-running processes - -## Next Steps - -- **Installation**: Get started with [Knative installation](install/README.md) -- **Quick Start**: Try the [Knative Quickstart](getting-started/README.md) for hands-on experience -- **Serving Guide**: Learn more about [Knative Serving](serving/README.md) -- **Eventing Guide**: Explore [Knative Eventing](eventing/README.md) capabilities -- **Functions Guide**: Build your first [Knative Function](functions/README.md) -- **Examples**: Browse [sample applications](samples/README.md) and use cases +
diff --git a/docs/versioned/bookstore/disclaimer/README.md b/docs/versioned/bookstore/disclaimer/disclaimer.md similarity index 100% rename from docs/versioned/bookstore/disclaimer/README.md rename to docs/versioned/bookstore/disclaimer/disclaimer.md diff --git a/docs/versioned/bookstore/extra-challenge/README.md b/docs/versioned/bookstore/extra-challenge/extra-challenges.md similarity index 99% rename from docs/versioned/bookstore/extra-challenge/README.md rename to docs/versioned/bookstore/extra-challenge/extra-challenges.md index 606fe155f6c..1fda6d0d12c 100644 --- a/docs/versioned/bookstore/extra-challenge/README.md +++ b/docs/versioned/bookstore/extra-challenge/extra-challenges.md @@ -5,6 +5,7 @@ components: - serving - functions function: tutorial +hide_next: true --- # **Extra Challenges** diff --git a/docs/versioned/bookstore/page-0.5/environment-setup.md b/docs/versioned/bookstore/page-0.5/environment-setup.md index e7cd8f4b6f1..80355c060bb 100644 --- a/docs/versioned/bookstore/page-0.5/environment-setup.md +++ b/docs/versioned/bookstore/page-0.5/environment-setup.md @@ -8,262 +8,160 @@ function: tutorial # Environment Setup -![Image](images/image20.png) +Deploy the Bookstore frontend and Book Review backend using the provided images. +This is a larger application than the introductory tracks. Read the +[Bookstore introduction](../page-0/welcome-knative-bookstore-tutorial.md) and +[disclaimer](../disclaimer/disclaimer.md) before beginning. -In this page, we will be discussing how to set up your environment, and make sure to run up the UI front end and the Book Review Service’s node server. +## What does the final deliverable for this section look like? -## **What does the final deliverable for this section look like?** +- Your disposable Kubernetes cluster has Knative Serving and Eventing ready. +- The frontend and backend run in the same namespace. +- You can open the application from your browser using local port-forwarding. -- You have a running Kubernetes (k8s) cluster on your local machine, with Knative installed. -- You have your front end application deployed as Kubernetes deployment -- You have your Node.js application deployed as Kubernetes deployment +Reuse your Quickstart learning cluster if you kept it. You do not need another +cluster, a cloud account, or a LoadBalancer helper for the access method on this page. -We will be fulfilling each requirement with the order above. +## Clone the Repository -## **Clone the Repository** -![Next Step Image](images/image22.png) +From a directory where you keep projects, clone the repository and enter the +sample's working directory: -```sh +```bash git clone https://github.com/knative/docs.git +cd docs/code-samples/eventing/bookstore-sample-app/start ``` -???+ bug "Troubleshooting" - Having issue with cloning your repo? Check [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/troubleshooting-cloning-errors){:target="_blank"} for help. -!!! warning +If you already cloned the repository, use its existing copy and change to that +same `code-samples/eventing/bookstore-sample-app/start` directory instead. - **IMPORTANT**: Please take some time to read the [Disclaimer](../disclaimer/README.md){:target="_blank"} before moving to the next page. +## File Structure +The sample has two sibling directories: -## **File Structure** +- `start`: the working directory for these lessons, containing the frontend, + backend, and starter configuration. +- `solution`: completed examples to consult when you are stuck. -![Image](images/image21.png) +When later lessons say to return to `start`, they mean this directory **inside +the cloned repository**, not a filesystem directory named `/start`. Run the +commands below from the `start` directory. -The code for the sample app is in `docs/code-samples/eventing/bookstore-sample-app` +## Shortcut -Under `bookstore-sample-app` folder, there are 2 folders: +These instructions use the manual steps and local port-forwarding below. +The optional `setup.sh` script instead reinstalls Knative components and waits +for real LoadBalancer addresses. Do not use it for this port-forwarding route +or run it over an existing Quickstart installation. -* **/solution**: this folder contains all the yaml files, and the code you needed. Check it when you got stuck. +## Instructions -* **/start**: this folder contains the necessary files for you to get started. Save there all the configuration files yourself following the tutorial! +### Task 1: Set Up a Running Kubernetes Cluster with Knative Installed -![Image](images/image16.png) +If needed, [create a learning cluster](../../getting-started/quickstart-install.md), +then return here. Otherwise keep your existing cluster. Follow the shared guide's +[context and namespace checks](../../getting-started/quickstart-install.md#create-and-verify) +so commands use the disposable cluster and its `default` namespace. -!!! tip - Kuack suggests you to start from **/start**, write all the configuration files as you go over the tutorial, and check solutions when you got stuck. +Check the Knative components: -![Image](images/image1.png) - -Always `cd` back to the root directory, which is `/start`, before running any commands. - -All the commands in the tutorial are written **assuming you are in the `/start` directory**. - - -## **Shortcut** - -![Image](images/image10.png) - -Running `docs/code-samples/eventing/bookstore-sample-app/start/setup.sh` will automatically complete all tasks in this section. - -!!! warning - - However, if you are not familiar with the process, we recommend reviewing the steps below. - -## **Instructions** - -### **Task 1: Set Up a Running Kubernetes Cluster with Knative Installed** - -![Image](images/image13.png) - -We recommend using [KinD (Kubernetes in Docker)](https://kind.sigs.k8s.io/docs/user/quick-start/) to run a Kubernetes cluster locally. - -In order to access Kubernetes services KinD provides a standalone binary in your host and connects to your cluster and provisions new Load Balancer containers for your Services. It requires privileges to open ports on the system and to connect to the container runtime. - -See instructions here: https://kind.sigs.k8s.io/docs/user/loadbalancer/ - -!!! tip - - We recommend you using `kn quickstart` plugin to install Knative. - -Please follow the instructions [here](https://knative.dev/docs/install/){:target="_blank"} to spin up your cluster with Knative installed! - -???+ success "Verify" - - You should see the pods in the `knative-eventing` and `knative-serving` namespaces running before proceeding. - - ``` - NAMESPACE NAME READY STATUS RESTARTS AGE - knative-eventing eventing-controller-645c4bcd55-fln6l 1/1 Running 0 17m - knative-eventing eventing-webhook-7fd9cb958f-ft9vj 1/1 Running 0 17m - knative-eventing imc-controller-6b9fbb6487-kwvbz 1/1 Running 0 17m - knative-eventing imc-dispatcher-6c4b5856d-hh7wq 1/1 Running 0 17m - knative-eventing job-sink-5cc89b5d95-fhlt5 1/1 Running 0 17m - knative-eventing mt-broker-controller-568d6b9c59-qk8dj 1/1 Running 0 17m - knative-eventing mt-broker-filter-db66554c4-sxxzr 1/1 Running 0 17m - knative-eventing mt-broker-ingress-774547844d-bbbdw 1/1 Running 0 17m - knative-serving activator-7bcd47489b-ljmt6 1/1 Running 0 17m - knative-serving autoscaler-65cf6767c4-v7rfn 1/1 Running 0 17m - knative-serving controller-964dcf97b-9qwsv 1/1 Running 0 17m - knative-serving net-kourier-controller-854b568d4f-6xhl5 1/1 Running 0 17m - knative-serving webhook-658b566b8-sxbdz 1/1 Running 0 17m - kourier-system 3scale-kourier-gateway-54fb555bd7-v2l8q 1/1 Running 0 17m - kube-system coredns-66bc5c9577-fhnxr 1/1 Running 0 18m - kube-system coredns-66bc5c9577-x299f 1/1 Running 0 18m - kube-system etcd-kind-control-plane 1/1 Running 0 18m - kube-system kindnet-gpq75 1/1 Running 0 18m - kube-system kube-apiserver-kind-control-plane 1/1 Running 0 18m - kube-system kube-controller-manager-kind-control-plane 1/1 Running 0 18m - kube-system kube-proxy-v2kdx 1/1 Running 0 18m - kube-system kube-scheduler-kind-control-plane 1/1 Running 0 18m - local-path-storage local-path-provisioner-7b8c8ddbd6-m5n2m 1/1 Running 0 18m - ``` - -### **Task 2: Running the Bookstore Web App** - -![Image](images/image12.png) +```bash +kubectl get pods -n knative-serving +kubectl get pods -n knative-eventing +``` -The Next.js frontend app is located in the `docs/code-samples/eventing/bookstore-sample-app/start/frontend` folder. +Check that the Serving and Eventing pods are ready before deploying the Bookstore +application. If these components are missing or not ready, resolve the installation +first. -#### **Deploy the Frontend App** +We will use `kubectl port-forward` to open a temporary connection from your +computer to a Service. It works with this tutorial's existing cluster and avoids +adapting another provider's sample cluster or relying on container IP addresses. +The forwarding command must stay running in its terminal while you use the app. -You can either [build the image locally](https://docs.docker.com/get-started/02_our_app/){:target="_blank"} or use our pre-built image. If you are using the pre-built image, you can proceed to the next step. +### Task 2: Running the Bookstore Web App -When ready, run the following command to deploy the frontend app: +The frontend and backend use ordinary Kubernetes Deployments and Services, +not the Knative Service resource used in the Serving track. -```shell -kubectl apply -f frontend/config/100-front-end-deployment.yaml -``` +#### Deploy the Frontend App -This will create the Deployment and expose it with a Service of type LoadBalancer to receive external traffic: +Use the pre-built image referenced by the starter configuration: -``` -deployment.apps/bookstore-frontend created -service/bookstore-frontend-svc created +```bash +kubectl apply -f frontend/config/ +kubectl rollout status deployment/bookstore-frontend ``` -???+ success "Verify" - Run the following command to check if the pod is running: - - ```shell - kubectl get pods - ``` - - You will see that your front end pod is running. - - ``` - NAME READY STATUS RESTARTS AGE - bookstore-frontend-7b879ffb78-9bln6 1/1 Running 0 4m37s - ``` +The rollout command waits for the frontend to become available. If it reports +an error, resolve it before opening the browser. #### Access the frontend workload -Follow the respective `minikube` or `kind` instructions to access Kubernetes Services locally from your machine. +In a dedicated terminal, using the same cluster context and namespace, run: -Check the running Kubernetes Services: - -```shell -kubectl get services +```bash +kubectl port-forward service/bookstore-frontend-svc 18080:80 ``` -And you will see the following console output: -``` -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -bookstore-frontend-svc LoadBalancer 10.99.187.173 172.18.0.6 80:31600/TCP 27m -kubernetes ClusterIP 10.96.0.1 443/TCP 39m -``` - -!!! note - If the `EXTERNAL-IP` for your frontend service is ``, then there you'll need to check that - your `minikube tunnel` or KinD `cloud-provider-kind` is working properly. - -???+ success "Verify" - Access the UI page using the `bookstore-frontend-svc` `EXTERNAL-IP` address. The UI page should appear! +Leave it running and open **http://127.0.0.1:18080** in your browser. `18080` is +on your computer; `80` is the Service's port inside the cluster. - ![Image](images/image19.png) +The UI should appear. Its backend connection may be unavailable until you complete +Task 3. If port `18080` is already in use, choose another free local port and use +that port in the browser URL; do not stop an unrelated application. -### **Task 3: Running the Book Review Service** +The manifest uses a LoadBalancer Service, but its `EXTERNAL-IP` may remain +`` on a local cluster. That is not a blocker for this port-forwarding +route. Use the localhost URL above, not a Docker/container IP or an example IP. -![Image](images/image6.png) +### Task 3: Running the Book Review Service -The Node.js server is located in the `node-server` folder. +Keep the frontend's port-forward running. Use another terminal for deployment, +and change back to the sample's `start` directory if necessary. -#### **Deploy the Book Review Service: Node.js Server** +#### Deploy the Book Review Service: Node.js Server -You can either [build the image locally](https://docs.docker.com/get-started/02_our_app/){:target="_blank"} or use our pre-built image. If you are using the pre-built image, you can proceed to the next step. - -When ready, run the following command to deploy the Node.js server: - -```shell -kubectl apply -f node-server/config/100-deployment.yaml -``` - -This command will pull the image and deploy it to your cluster as a Deployment. It will also expose it as a LoadBalancer to receive external traffic. - -``` -deployment.apps/node-server created -service/node-server-svc created +```bash +kubectl apply -f node-server/config/ +kubectl rollout status deployment/node-server ``` -???+ success "Verify" - - Run the following command to check if the pod is running: - - ```shell - kubectl get pods - ``` - - You will see that your Node.js server (node-server) pod is running. - ``` - NAME READY STATUS RESTARTS AGE - bookstore-frontend-7b879ffb78-9bln6 1/1 Running 0 39m - node-server-68bf98cdf4-skjmh 1/1 Running 0 38m - ``` - +This starts the backend. The frontend reaches it using the internal +`node-server-svc` Service address; no public backend address is needed for the +frontend to communicate with it. #### Access the node server backend -Follow the respective `minikube` or `kind` instructions to access Kubernetes Services locally from your machine. - -Check the running Kubernetes Services: +To check the backend directly, open another terminal and run: -```shell -kubectl get services -``` -And you will see the following console output: +```bash +kubectl port-forward service/node-server-svc 18081:80 ``` -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -bookstore-frontend-svc LoadBalancer 10.99.187.173 172.18.0.6 80:31600/TCP 73m -kubernetes ClusterIP 10.96.0.1 443/TCP 85m -node-server-svc LoadBalancer 10.101.90.35 172.18.0.8 80:31792/TCP 73m -``` - -!!! note - If the `EXTERNAL-IP` for your frontend service is ``, then there you'll need to check that - your `minikube tunnel` or KinD `cloud-provider-kind` is working properly. - -???+ success "Verify" - Access the node server page using the `node-server-svc` `EXTERNAL-IP` address. The UI page should appear! - - And in your front end page, you should see the status turns green and say "Connected to node server". - - ![Image](images/image18.png) - -## **Troubleshooting** -If you encounter any issues during the setup process, refer to the troubleshooting section in the documentation or check the logs of your Kubernetes pods for more details. -???+ bug "Troubleshooting" - To check the logs, use the following command: +Open **http://127.0.0.1:18081** to confirm that the backend responds. Then refresh +the frontend at **http://127.0.0.1:18080** and check its backend-connection status. +Do not enter the backend's localhost URL into cluster configuration; these +localhost addresses are only for your browser. - ```shell - kubectl logs - ``` +The backend check's port-forward can be stopped with ++ctrl+c++ afterward. +Keep the frontend's port-forward running for the following lessons. Neither +++ctrl+c++ nor closing a forwarding terminal deletes the application's resources. - Replace `` with the name of the pod you want to check. +## Troubleshooting -Secondly, ensure your KinD & minikube tunnels are running in order to access the websites. +- Check the cluster context and namespace before investigating the application. +- `kubectl get pods` shows whether the frontend and backend pods are ready. +- Inspect the relevant application logs with `kubectl logs deployment/bookstore-frontend` + or `kubectl logs deployment/node-server`. +- If the browser loses access, check that the corresponding port-forward terminal + is still running and that you are using its local port in the URL. +- If a command fails, [get help](../../getting-started/next-steps.md#get-help) + with its error rather than reinstalling Knative or creating another cluster. -## **Next Step** -![Image](images/image5.png) +## Next Step -You have successfully set up the cluster with Knative installed, and running your front end app and node server. You are all set to start learning. Your journey begins from here. +The frontend and backend are running. Continue using the sample's `start` +directory and keep the frontend port-forward open: -[Go to Lesson 1 - Send Review Comment to Broker :fontawesome-solid-paper-plane:](../page-1/send-review-comment-to-broker.md){ .md-button .md-button--primary } +[Go to Lesson 1: Send Review Comments to the Broker](../page-1/send-review-comment-to-broker.md){ .md-button .md-button--primary } diff --git a/docs/versioned/bookstore/page-0/welcome-knative-bookstore-tutorial.md b/docs/versioned/bookstore/page-0/welcome-knative-bookstore-tutorial.md index 32baa4ab100..2c60a3c4afa 100644 --- a/docs/versioned/bookstore/page-0/welcome-knative-bookstore-tutorial.md +++ b/docs/versioned/bookstore/page-0/welcome-knative-bookstore-tutorial.md @@ -5,24 +5,24 @@ components: - functions - serving function: tutorial +hide_prev: true --- -# Welcome: Knative Bookstore Tutorial + -![Welcome Image](images/1.png) - -**Welcome to Knative's End-to-End Sample Application Tutorial!** - -- Are you completely new to Knative and unsure where to start? -- Are you considering converting your application to an event-driven architecture but don't know how? -- Are you curious to see what Knative can do in real life? -- Are you new to the cloud computing world and looking to get started with open source? +# Knative Bookstore tutorial -!!! success "You found the right place" +Build a larger sample application that combines Functions, Serving, and Eventing. +The lessons follow reviews through an event-processing workflow and add the web +application, processing services, and database around it. - If any of these resonate with you, you've found the perfect starting point. +If you are new to Knative, begin with the independent [Get Started tracks](../../README.md) +first. Bookstore is a follow-on application exercise, not another universal +introduction, a migration guide, or a production bookstore. You can reuse your +learning cluster; the [environment setup](../page-0.5/environment-setup.md) describes +the extra application resources. -In this tutorial, we will construct an online bookstore application. This interactive guide, suitable for beginners and experienced engineers alike, will take you through the steps of building, deploying, and monitoring an application using Knative's powerful features. For those familiar with the process, concise graphics are available to streamline your learning experience. +![Welcome Image](images/1.png) ## **What are we building?** @@ -36,21 +36,16 @@ As the bookstore owner, you'll receive notifications via Slack each time if a co ![Learning Goal Image](images/3.png) -You will learn Event-Driven Architecture (EDA) and how it contrasts with traditional application designs that use microservices and REST APIs. You'll learn: - -- **The Fundamentals of EDA**: Explore the core principles of event-driven architecture and how it enhances responsiveness and scalability in applications. -- **Comparative Insights**: Understand the differences between EDA and traditional architectures, highlighting the benefits and use cases of each. -- **Practical Application**: Discover how to transition your existing applications to an event-driven model, utilizing the powerful features of Knative Eventing. +Follow a concrete event-driven application from its producer to its consumers: -![Knative Framework](images/4.png) +- Send review comments to a Broker and route them using Triggers. +- Connect processing functions in a Sequence to analyze and filter reviews. +- Store processed reviews and display them in the web application. +- Explore an external notification integration in the later Slack/Camel K lesson. -Knative is a powerful framework that operates on top of Kubernetes. This tutorial will guide you through: - -- **Setting Up Your Cluster**: You'll start by spinning up your own Kubernetes cluster, which is the foundation for deploying and managing containers. -- **Exploring Knative**: Gain hands-on experience with key Knative concepts and components. -- **Some example use cases of Knative**. - -By the end of this tutorial, you will not only understand these concepts but also feel comfortable implementing them, empowering you to build robust, scalable event-driven applications with Knative. +Reuse a ready learning cluster or create one through the shared setup guide. +The application adds its own frontend, backend, processing services, and database; +the introductory tracks do not create those resources for you. ## **Bookstore Architecture** @@ -80,7 +75,8 @@ There are 2 Machine learning workflows that can conduct sentiment analysis on us ### Book Store Broker -It acts as the central brain of our event-driven architecture. It connects all the microservices together, receives the event, and makes sure all the events are safely delivered to the correct destination. +It receives review events and routes them to the consumers selected by its Triggers. +This learning example does not establish production durability or delivery guarantees. ### Bad Word Broker @@ -91,7 +87,7 @@ It acts as the bridge between the book store Broker and the Slack Sink, so we ca We will be building the sample app in this order: -0. [**Environment Setup**](../page-0.5/environment-setup.md){:target="_blank"}: Set up the environment for the tutorial. This includes installing the cluster, the frontend and the backend. +0. [**Environment Setup**](../page-0.5/environment-setup.md): Reuse or create a learning cluster, then deploy the frontend and backend and open the local browser connection. 1. [**Send comments to the Broker**](../page-1/send-review-comment-to-broker.md){:target="_blank"}: Pass reviews from the frontend to event-display via the Broker. This involves learning about Broker, SinkBinding and CloudEvents event types. @@ -107,30 +103,39 @@ We will be building the sample app in this order: 7. [**Connect with External Services/API**](../page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md){:target="_blank"}: Learn how to connect your application with external services and APIs using Knative Eventing and Apache Camel K integrations. -8. [**Extra Challenges**](../extra-challenge/README.md){:target="_blank"}: Additional challenges to test your understanding of the concepts learned in the tutorial. +8. [**Extra Challenges**](../extra-challenge/extra-challenges.md){:target="_blank"}: Additional challenges to test your understanding of the concepts learned in the tutorial. ## **How to properly learn?** -### Preview the Final Bookstore: 1-Minute Demo Video + -To help you visualize what you'll be creating, we've prepared a brief demo video. This two-minute preview showcases the final bookstore application, providing a clearer understanding of what you can expect to build. +### Preview the final application + +Watch the demo to see the application you will build. ???+ bug "Video not working above?" If the video is not working, you can watch it [here](https://www.youtube.com/watch?v=5D8pTcQSacw&ab_channel=Knative){:target="_blank"}. -### Step-by-Step Guidance for Beginners + + +### Follow the application sequence ![Beginner Guide](images/9.png) -This tutorial is meticulously structured to be beginner-friendly, featuring detailed, step-by-step instructions for building the sample app. Simply follow the sequence we've laid out: each section builds upon the previous, guiding you through the construction of the application. Should you encounter any hurdles, the Knative community is a fantastic resource for support. Don't hesitate to ask questions and seek advice. Check the [Help](#help) section below! +Unlike the independent Get Started tracks, these lessons build on one application. +Follow them in order and keep the frontend's port-forward running while you use +the browser UI. See [Help](#help) if a step fails rather than creating another +cluster or restarting from an unrelated introductory tutorial. ### Accelerated Learning Path for Advanced Users ![Advanced Users Guide](images/10.png) -If you find the tutorial too basic, or if it covers familiar territory, feel free to adjust your learning approach. Each section of the tutorial is accompanied by concise graphics that summarize key concepts. Advanced learners can choose to focus on these graphics to grasp the essentials faster, streamlining the learning experience without sacrificing depth or understanding. +If you already know the components, use the diagrams to orient yourself. Before +jumping to a later lesson, check that the resources created by its earlier steps +already exist; the later lessons are not independent setup paths. ## **Help** diff --git a/docs/versioned/bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md b/docs/versioned/bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md index f0a47892d8b..36b06588a76 100644 --- a/docs/versioned/bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md +++ b/docs/versioned/bookstore/page-7/slack-sink-learning-knative-eventing-and-apache-camel-K-integration.md @@ -439,4 +439,4 @@ Congratulations on successfully completing the bookstore sample app tutorial! If We've prepared additional challenges that build on top of the existing bookstore app for you to tackle. Some solutions are provided, while others are left open to encourage you to explore your own solutions. -[Go to Extra Challenges :fontawesome-solid-paper-plane:](../extra-challenge/README.md){ .md-button .md-button--primary } +[Go to Extra Challenges :fontawesome-solid-paper-plane:](../extra-challenge/extra-challenges.md){ .md-button .md-button--primary } diff --git a/docs/versioned/client/README.md b/docs/versioned/client/README.md index 1c37f3fb51e..28700ce25f9 100755 --- a/docs/versioned/client/README.md +++ b/docs/versioned/client/README.md @@ -22,7 +22,9 @@ See [Install and Set Up `kubectl`](https://kubernetes.io/docs/tasks/tools/instal `kn` provides a quick and easy interface for creating Knative resources such as services and event sources, without the need to create or modify YAML files directly. `kn` also simplifies completion of otherwise complex procedures such as autoscaling and traffic splitting. !!! note - `kn` cannot be used to install Knative components such as Serving or Eventing. + The core `kn` commands manage resources on an existing Knative installation. + The optional `quickstart` plugin creates a local learning cluster and installs + Serving and Eventing for you. ### Additional resources @@ -35,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 @@ -50,11 +52,10 @@ Using the `kn` CLI, you can specify the following options to connect to the clus - `--context`: use this option to specify the name of a context from the existing `kubeconfig` file. Use one of the contexts from the output of `kubectl config get-contexts`. -You can also specify a config file in the following ways: - -- Setting the environment variable `$KUBECONFIG`, and point it to the kubeconfig file. - -- Using the `kn` CLI `--config` option, for example, `kn service list --config path/to/config.yaml`. The default config is at `~/.config/kn/config.yaml`. +The `kn` CLI's `--config` option is different: it selects the +[kn configuration file](configure-kn.md), such as `~/.config/kn/config.yaml`. +It does not select Kubernetes cluster credentials. Use `--kubeconfig` or +`KUBECONFIG` for that. For more information about `kubeconfig` files, see [Organizing Cluster Access Using kubeconfig Files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/){target=_blank}. diff --git a/docs/versioned/client/install-kn.md b/docs/versioned/client/install-kn.md index 31a97b480c2..0eedf9814fb 100644 --- a/docs/versioned/client/install-kn.md +++ b/docs/versioned/client/install-kn.md @@ -13,7 +13,10 @@ There are three CLI tools available for managing Knative: - Kubernetes CLI - `kubectl` - Knative CLI - `kn` -- Knative Operator CLI - `kn` +- Knative Functions CLI - `func` + +The Knative Operator CLI is an optional `kn operator` plugin for platform +administration; it is not required for the introductory tutorials. The `kn` CLI makes Knative operations easier, but all functionality is available in `kubectl` CLI provided you want to primarily use YAML representations of resources. @@ -26,7 +29,7 @@ Install the [Kubernetes CLI (`kubectl`)](https://kubernetes.io/docs/tasks/tools/ ### Install kn using the nightly-built binary !!! warning - Nightly container images include features which may not be included in the latest Knative release and are not considered to be stable. + Nightly binaries include features which may not be included in the latest Knative release and are not considered to be stable. Nightly-built executable binaries are available for users who want to install the latest pre-release build of `kn`. @@ -56,7 +59,7 @@ Before you install the Knative Operator CLI Plugin, first install the Knative CL === "Linux" - 1. Download the binary `kn-operator-linux-amd64` for your system from the [release page](https://github.com/knative-extensions/kn-plugin-operator/releases/tag/knative-v1.7.1). + 1. Download the binary `kn-operator-linux-amd64` for your system from the [release page](https://github.com/knative-extensions/kn-plugin-operator/releases/latest). 1. Rename the binary to `kn-operator`: diff --git a/docs/versioned/eventing/README.md b/docs/versioned/eventing/README.md index a0eaf2324f4..a3c282b5a36 100644 --- a/docs/versioned/eventing/README.md +++ b/docs/versioned/eventing/README.md @@ -3,31 +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 - -- 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/brokers/create-broker.md b/docs/versioned/eventing/brokers/create-broker.md index a409c75c636..50de1f8a87e 100644 --- a/docs/versioned/eventing/brokers/create-broker.md +++ b/docs/versioned/eventing/brokers/create-broker.md @@ -25,7 +25,9 @@ You can create a Broker by using the `kn` CLI or by applying YAML files using `k This will create a new Broker of your default Broker class and default Broker configuration (both defined in the `config-br-defaults` ConfigMap). !!! note - If you choose not to specify a namespace, the Broker will be created in the current namespace. + If you omit the namespace, the Broker is created in the current namespace. + Omit the namespace flag in both verification commands too, or explicitly + use that same namespace. !!! note If you have multiple Broker classes installed in your cluster, you can specify the Broker class via the `--class` parameter, e.g.: @@ -34,21 +36,25 @@ You can create a Broker by using the `kn` CLI or by applying YAML files using `k kn broker create -n --class MTChannelBasedBroker ``` - 1. Optional: Verify that the Broker was created by listing existing Brokers: + 1. Verify the Broker in the same namespace used for creation: ```bash - kn broker list + kn broker list -n ``` + Find `` and check that `READY` is `True`. If it is `False`, + wait and repeat the check, or inspect its condition messages below. + 1. Optional: You can also verify the Broker exists by describing the Broker you have created: ```bash - kn broker describe + kn broker describe -n ``` === "kubectl" - The YAML in the following example creates a Broker named `default`. + Supply the Broker name and namespace in this YAML template, then use those + same values in the verification command. 1. Create a Broker by creating a YAML file using the following template: 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/triggers/README.md b/docs/versioned/eventing/triggers/README.md index d019995f8c9..4230814ad8a 100644 --- a/docs/versioned/eventing/triggers/README.md +++ b/docs/versioned/eventing/triggers/README.md @@ -11,8 +11,23 @@ A trigger represents a desire to subscribe to events from a specific broker. The `subscriber` value must be a [Destination](https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#Destination). +## Prerequisites + +- Knative Eventing is installed and you have a ready Broker in the namespace + selected by your `kubectl` context. [Create a Broker](../brokers/create-broker.md) + if needed. +- An event consumer is already running and ready. Use the correct reference kind + and API version for a Knative Service or an ordinary Kubernetes Service. +- Replace the example names with your resources. Here `default` is a **Broker + name**, not an instruction to create a Broker or select a namespace. The + Quickstart tutorial's Broker is named `example-broker`, so substitute that name + if you are reusing it. Replace `my-service` with your consumer's name too. + ## Example Triggers +Choose the subscriber form that matches your consumer; these are alternatives, +not two steps to apply to the same Trigger. + The following trigger receives all the events from the `default` broker and delivers them to the Knative Serving service `my-service`: @@ -67,6 +82,29 @@ delivers them to the custom path `/my-custom-path` for the Kubernetes service `m ``` Where `` is the name of the file you created in the previous step. +## Verify the subscription + +After applying your chosen example, check the Trigger, substituting its name if +it differs from `my-service-trigger`: + +```bash +kubectl get trigger my-service-trigger +``` + +Its `READY` condition should be `True`. If not, inspect the reported conditions: + +```bash +kubectl describe trigger my-service-trigger +``` + +Check the named Broker and consumer before changing the Trigger. To verify +end-to-end delivery, send a known CloudEvent from your producer to that Broker +and confirm its Event ID and data at your consumer. A ready Trigger means its +subscription is configured; it does not prove an event has been delivered. + +For a guided example with a sender and observable consumer, see +[Get started with Eventing](../../getting-started/getting-started-eventing.md). + ## Trigger filtering Various forms of filtering based on any number of CloudEvents attributes and extensions @@ -83,7 +121,7 @@ do not support filtering on the `data` field of CloudEvents. This example filters events from the `default` broker that are of type `dev.knative.foo.bar` and have the extension `myextension` which ends -with `-extensions. +with `-value`. 1. Create a YAML file using the following example: @@ -97,7 +135,7 @@ with `-extensions. filters: - exact: type: dev.knative.foo.bar - suffix: + - suffix: myextension: -value subscriber: ref: @@ -279,8 +317,8 @@ metadata: spec: broker: default filters: - exact: - type: dev.knative.a + - exact: + type: dev.knative.a filter: attributes: type: dev.knative.b @@ -312,9 +350,9 @@ spec: attributes: type: dev.knative.foo.bar myextension: my-extension-value - subscriber: - ref: - apiVersion: serving.knative.dev/v1 - kind: Service - name: my-service + subscriber: + ref: + apiVersion: serving.knative.dev/v1 + kind: Service + name: my-service ``` 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 dd869dba76b..7bdb8d08fa5 100644 --- a/docs/versioned/functions/README.md +++ b/docs/versioned/functions/README.md @@ -3,21 +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 - -Before you can use Knative Functions, you must have access to a Knative development environment. To set up a development environment, you can follow the [Knative Quickstart tutorial](../getting-started/README.md){target=_blank}. +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 75076b249fa..f6caf1138a7 100644 --- a/docs/versioned/functions/building-functions.md +++ b/docs/versioned/functions/building-functions.md @@ -3,50 +3,67 @@ audience: developer components: - functions function: how-to +hide_prev: true +hide_next: true --- -# Building functions +# Build an image ---8<-- "build-func-intro.md" +Build an OCI container image from an existing function project without running, +pushing, or deploying it. If you want to build **and deploy** in one step +(locally or on a cluster with Tekton), see [Deploy a function](deploying-functions.md). -## Local builds +## Requirements -You can build a container image for your function locally without deploying it to a cluster, by using the `build` command. +- An initialized function project containing `func.yaml` and source code. + [Create a project](running-functions.md#create-a-project) if needed. +- A running [Docker](https://docs.docker.com/get-started/get-docker/) engine + for containerized builders (`pack` or `s2i`). +- Run commands from inside the function project directory. -### Prerequisites + -- You have a Docker daemon on your local machine. This is already provided if you have used the Quickstart installation. +## Build -### Procedure +Pass an explicit local image name so the build does not prompt for a registry: ---8<-- "proc-building-function.md" +=== "func" -## On-cluster Builds + ```bash + func build --builder pack \ + --image localhost/my-function:latest + ``` -If you do not have a local Docker daemon running, or you are using a CI/CD pipeline, you might want to build your function on the cluster instead of using a local build. You can create an on-cluster build by using the `func deploy --remote` command. +=== "kn func" -!!! note - If you're doing a direct-upload deployment (i.e. the source code is on your local machine instead of a git repo), you can create an on-cluster build without the need of specifying the Git URL, but if you already specified a Git URL before, you'll need to specify the flag as empty, using the command `func deploy --remote --git-url=""` + ```bash + kn func build --builder pack \ + --image localhost/my-function:latest + ``` -### Prerequisites +`localhost/my-function:latest` is a local tag — nothing is pushed to a registry +or deployed to a cluster. To prepare an image for a registry, pass +`--registry ` (for example `ghcr.io/alice` or `docker.io/alice`) or +set `FUNC_REGISTRY`. -- The function must exist in a Git repository. -- You must configure your cluster to use Tekton Pipelines. See the [on-cluster build](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md){target=_blank} documentation. +## Verify the image -### Procedure +Confirm the image exists in Docker: -When running the command for the first time, you must specify the Git URL for the function: +```bash +docker image ls localhost/my-function:latest +``` -=== "func" +A row with tag `latest` and an image ID confirms the build succeeded. This does +not push or start the container. - ```{ .console } - func deploy --remote --registry --git-url -p hello - ``` - -=== "kn func" + - ```{ .console } - kn func deploy --remote --registry --git-url -p hello - ``` +## Other builders -After you have specified the Git URL for your function once, you can omit it in subsequent commands. +`func build` supports `--builder pack` (Cloud Native Buildpacks), `--builder s2i` +(Source-to-Image), and `--builder host` (host-native builds for supported +languages). 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}. 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 cb11900a3ef..587caa08dde 100644 --- a/docs/versioned/functions/deploying-functions.md +++ b/docs/versioned/functions/deploying-functions.md @@ -3,18 +3,135 @@ 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 Docker daemon on your local machine. This is already provided if you have used the Quickstart installation. +- 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 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. +## Deploy from your machine -## Procedure +Run `func deploy` from inside the project directory. Pass `--registry ` +where `` is the registry and your account namespace (for example +`ghcr.io/alice` or `docker.io/alice`), or pass `--image ` to +override a previous local-only `localhost/...` image tag: ---8<-- "proc-deploying-function.md" +=== "func" + + ```bash + func deploy --registry + ``` + +=== "kn func" + + ```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}. + +Choose one source method and pass an explicit `--image` destination (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, set `build.source.dir` in `func.yaml` + as shown in the on-cluster build guide. + + ```bash + func deploy --remote \ + --image docker.io/REGISTRY-USER/my-function:latest \ + --git-url https://github.com/GIT-OWNER/GIT-REPO + ``` + + (Some CLI versions accept `--source` / `--source-dir` instead of `--git-url`; + check `func deploy --help` for your installed CLI.) + +=== "Direct upload (no Git)" + + Upload the current local project directory directly. Passing `--git-url=""` + clears any previously configured Git URL (also remove `build.source.dir` + from `func.yaml` if previously set): + + ```bash + func deploy --remote \ + --image docker.io/REGISTRY-USER/my-function:latest \ + --git-url="" + ``` + +(`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 --git-url=""`). + - Git-backed remote builds: commit and push your changes to the configured + Git branch first, then re-run `func deploy --remote`. + - 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