diff --git a/README.md b/README.md index 85b9fc3c..b3e2cd5c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Knative Tutorial - Introduction to Knative - ![Knative Tutorial](https://github.com/redhat-developer-demos/knative-tutorial/workflows/Knative%20Tutorial/badge.svg) [![Knative Serving v0.19](https://img.shields.io/badge/Knative%20Serving-v0.19-blue)](https://knative.dev/docs/serving/) - [![Knative Eventing v0.19](https://img.shields.io/badge/Knative%20Eventing-v0.19-blue)](https://knative.dev/docs/eventing/) - [![Strimzi Kafka](https://img.shields.io/badge/Strimzi%20Kafka-v0.20.0-blue)](https://strimzi.io) - [![Apache Camel K](https://img.shields.io/badge/Apache%20Camel--K-v1.3.1-blue)](https://camel.apache.org/camel-k/latest/) - [![OpenShift Serverless](https://img.shields.io/badge/OpenShift%20Serverless-v1.13-blue)](https://www.openshift.com/learn/topics/serverless) + ![Knative Tutorial](https://github.com/redhat-developer-demos/knative-tutorial/workflows/Knative%20Tutorial/badge.svg) [![Knative Serving v1.1.0](https://img.shields.io/badge/Knative%20Serving-v1.1.0-blue)](https://knative.dev/docs/serving/) + [![Knative Eventing v1.1.0](https://img.shields.io/badge/Knative%20Eventing-v1.1.0-blue)](https://knative.dev/docs/eventing/) + [![Strimzi Kafka](https://img.shields.io/badge/Strimzi%20Kafka-v0.26.1-blue)](https://strimzi.io) + [![Apache Camel K](https://img.shields.io/badge/Apache%20Camel--K-v1.8.0-blue)](https://camel.apache.org/camel-k/latest/) + [![OpenShift Serverless](https://img.shields.io/badge/OpenShift%20Serverless-v1.19.0-blue)](https://www.openshift.com/learn/topics/serverless) ## Documentation @@ -20,7 +20,7 @@ ## Devlopment Site -If you like to try the latest development updates,check the [staging site](https://redhat-developer-docs.github.io/knative-tutorial-staging). + If you like to try the latest development updates,check the [staging site](https://redhat-developer-docs.github.io/knative-tutorial-staging). ## Contributing diff --git a/advanced/camel-k/eip/fruit-processor-kamelet.yaml b/advanced/camel-k/eip/fruit-processor-kamelet.yaml new file mode 100644 index 00000000..90040632 --- /dev/null +++ b/advanced/camel-k/eip/fruit-processor-kamelet.yaml @@ -0,0 +1,83 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: fruits-processor + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "main-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA1MDAgNTAwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MDAgNTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8ZyBpZD0iWE1MSURfMV8iPg0KCTxwYXRoIGlkPSJYTUxJRF85XyIgZD0iTTMxNC44LDI2OS43Yy0xNC4yLDAtMjcsNi4zLTM1LjcsMTYuMkwyNTYuOCwyNzBjMi40LTYuNSwzLjctMTMuNiwzLjctMjAuOWMwLTcuMi0xLjMtMTQuMS0zLjYtMjAuNg0KCQlsMjIuMy0xNS43YzguNyw5LjksMjEuNCwxNi4xLDM1LjYsMTYuMWMyNi4yLDAsNDcuNi0yMS4zLDQ3LjYtNDcuNnMtMjEuMy00Ny42LTQ3LjYtNDcuNnMtNDcuNiwyMS4zLTQ3LjYsNDcuNg0KCQljMCw0LjcsMC43LDkuMiwyLDEzLjVsLTIyLjMsMTUuN2MtOS4zLTExLjYtMjIuOC0xOS42LTM4LjEtMjIuMXYtMjYuOWMyMS42LTQuNSwzNy44LTIzLjcsMzcuOC00Ni42YzAtMjYuMi0yMS4zLTQ3LjYtNDcuNi00Ny42DQoJCWMtMjYuMiwwLTQ3LjYsMjEuMy00Ny42LDQ3LjZjMCwyMi42LDE1LjgsNDEuNSwzNi45LDQ2LjN2MjcuM2MtMjguOCw1LjEtNTAuOCwzMC4yLTUwLjgsNjAuNWMwLDMwLjQsMjIuMiw1NS43LDUxLjIsNjAuNXYyOC44DQoJCWMtMjEuMyw0LjctMzcuNCwyMy43LTM3LjQsNDYuNGMwLDI2LjIsMjEuMyw0Ny42LDQ3LjYsNDcuNmMyNi4yLDAsNDcuNi0yMS4zLDQ3LjYtNDcuNmMwLTIyLjctMTYtNDEuOC0zNy40LTQ2LjR2LTI4LjgNCgkJYzE1LTIuNSwyOC4yLTEwLjQsMzcuNC0yMS44bDIyLjUsMTUuOWMtMS4yLDQuMy0xLjksOC43LTEuOSwxMy40YzAsMjYuMiwyMS4zLDQ3LjYsNDcuNiw0Ny42czQ3LjYtMjEuMyw0Ny42LTQ3LjYNCgkJQzM2Mi40LDI5MSwzNDEuMSwyNjkuNywzMTQuOCwyNjkuN3ogTTMxNC44LDE1OC40YzEyLjcsMCwyMy4xLDEwLjQsMjMuMSwyMy4xYzAsMTIuNy0xMC4zLDIzLjEtMjMuMSwyMy4xcy0yMy4xLTEwLjQtMjMuMS0yMy4xDQoJCUMyOTEuOCwxNjguOCwzMDIuMSwxNTguNCwzMTQuOCwxNTguNHogTTE3NiwxMTUuMWMwLTEyLjcsMTAuMy0yMy4xLDIzLjEtMjMuMWMxMi43LDAsMjMuMSwxMC40LDIzLjEsMjMuMQ0KCQljMCwxMi43LTEwLjMsMjMuMS0yMy4xLDIzLjFDMTg2LjMsMTM4LjIsMTc2LDEyNy44LDE3NiwxMTUuMXogTTIyMi4xLDM4NC45YzAsMTIuNy0xMC4zLDIzLjEtMjMuMSwyMy4xDQoJCWMtMTIuNywwLTIzLjEtMTAuNC0yMy4xLTIzLjFjMC0xMi43LDEwLjMtMjMuMSwyMy4xLTIzLjFDMjExLjgsMzYxLjgsMjIyLjEsMzcyLjIsMjIyLjEsMzg0Ljl6IE0xOTkuMSwyODEuMw0KCQljLTE3LjcsMC0zMi4yLTE0LjQtMzIuMi0zMi4yYzAtMTcuNywxNC40LTMyLjIsMzIuMi0zMi4yYzE3LjcsMCwzMi4yLDE0LjQsMzIuMiwzMi4yQzIzMS4yLDI2Ni45LDIxNi44LDI4MS4zLDE5OS4xLDI4MS4zeg0KCQkgTTMxNC44LDM0MC4zYy0xMi43LDAtMjMuMS0xMC40LTIzLjEtMjMuMWMwLTEyLjcsMTAuMy0yMy4xLDIzLjEtMjMuMXMyMy4xLDEwLjQsMjMuMSwyMy4xQzMzNy45LDMzMCwzMjcuNSwzNDAuMywzMTQuOCwzNDAuM3oiLz4NCjwvZz4NCjwvc3ZnPg0K" + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "Kafka" + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Kafka Not Secured Source" + description: |- + Receive data from Kafka topics on an insecure broker. + required: + - topic + - brokers + type: object + properties: + topic: + title: Topic Names + description: Comma separated list of Kafka topic names + type: string + brokers: + title: Brokers + description: Comma separated list of Kafka Broker URLs + type: string + dependencies: + - "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT" + - "camel:kafka" + - "camel:kamelet" + - "camel:jackson" + - "camel:core" + - "camel:log" + flow: + from: + uri: "kafka:fruits?brokers=my-cluster-kafka-bootstrap.kafka:9092" + steps: + - log: + message: "Received Body ${body}" + - unmarshal: + json: {} + - choice: + when: + - simple: "${body[nutritions][sugar]} <= 5" + steps: + - remove-headers: "*" + - marshal: + json: {} + - set-header: + name: ce-type + constant: low-sugar + - set-header: + name: fruit-sugar-level + constant: low + - to: "log:low?showAll=true&multiline=true" + - simple: "${body[nutritions][sugar]} > 5 || ${body[nutritions][sugar]} <= 10" + steps: + - remove-headers: "*" + - marshal: + json: {} + - set-header: + name: ce-type + constant: medium-sugar + - set-header: + name: fruit-sugar-level + constant: medium + - to: "log:medium?showAll=true&multiline=true" + otherwise: + steps: + - remove-headers: "*" + - marshal: + json: {} + - set-header: + name: ce-type + constant: high-sugar + - set-header: + name: fruit-sugar-level + constant: high + - to: "log:high?showAll=true&multiline=true" \ No newline at end of file diff --git a/advanced/camel-k/eip/fruit-processor-to-knative.yaml b/advanced/camel-k/eip/fruit-processor-to-knative.yaml new file mode 100644 index 00000000..0b3dbad2 --- /dev/null +++ b/advanced/camel-k/eip/fruit-processor-to-knative.yaml @@ -0,0 +1,18 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: fruits-processor-to-knative +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: fruits-processor + properties: + topic: "fruits" + brokers: "my-cluster-kafka-bootstrap.kafka:9092" + sink: + ref: + kind: Broker + apiVersion: eventing.knative.dev/v1 + name: default \ No newline at end of file diff --git a/advanced/camel-k/eip/fruits-processor-to-knative.yaml b/advanced/camel-k/eip/fruits-processor-to-knative.yaml new file mode 100644 index 00000000..53996c7c --- /dev/null +++ b/advanced/camel-k/eip/fruits-processor-to-knative.yaml @@ -0,0 +1,18 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: fruits-processor-to-knative +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: fruits-processor + properties: + topic: "fruits" + brokers: "my-cluster-kafka-bootstrap.kafka:9092" + sink: + ref: + kind: Broker + apiVersion: eventing.knative.dev/v1 + name: default \ No newline at end of file diff --git a/advanced/camel-k/eip/fruits-producer.yaml b/advanced/camel-k/eip/fruits-producer.yaml index 0b590201..e4d7c8be 100644 --- a/advanced/camel-k/eip/fruits-producer.yaml +++ b/advanced/camel-k/eip/fruits-producer.yaml @@ -1,10 +1,12 @@ - from: - uri: "knative:endpoint/fruits-producer" + uri: timer:tick + parameters: + period: 5000 steps: - set-header: name: CamelHttpMethod constant: GET - - to: "http:fruityvice-proxy:8080/api/fruit/all?bridgeEndpoint=true" + - to: "https://www.fruityvice.com/api/fruit/all" - split: jsonpath: "$.[*]" - marshal: diff --git a/advanced/camel-k/get-started/timed-greeter-binding.yaml b/advanced/camel-k/get-started/timed-greeter-binding.yaml new file mode 100644 index 00000000..9e2941da --- /dev/null +++ b/advanced/camel-k/get-started/timed-greeter-binding.yaml @@ -0,0 +1,15 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: timed-greeter-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: timed-greeter + properties: + period: 5000 + message: Welcome to Apache Camel K + sink: + uri: http://event-display-knativetutorial..com \ No newline at end of file diff --git a/advanced/camel-k/get-started/timed-greeter-kamelet.yaml b/advanced/camel-k/get-started/timed-greeter-kamelet.yaml new file mode 100644 index 00000000..844b66f7 --- /dev/null +++ b/advanced/camel-k/get-started/timed-greeter-kamelet.yaml @@ -0,0 +1,45 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: timed-greeter +spec: + definition: + title: Timed Greeter Source + description: Produces periodic events with a custom payload. + required: + - message + type: object + properties: + period: + title: Period + description: The interval between two events in milliseconds + type: integer + default: 1000 + message: + title: Message + description: The message to generate + type: string + example: hello world + contentType: + title: Content Type + description: The content type of the message being generated + type: string + default: text/plain + dependencies: + - "camel:core" + - "camel:timer" + - "camel:kamelet" + template: + from: + uri: timer:tick + parameters: + period: 10000 + steps: + - set-body: + constant: "{{message}}" + - set-header: + name: "Content-Type" + constant: "{{contentType}}" + - transform: + simple: "${body.toUpperCase()}" + - to: "kamelet:sink" \ No newline at end of file diff --git a/bin/install-istio.sh b/bin/install-istio.sh deleted file mode 100755 index 77fe34f2..00000000 --- a/bin/install-istio.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash - -set -eu -set -o pipefail - -# Turn colors in this script off by setting the NO_COLOR variable in your -# environment to any value: -# -# $ NO_COLOR=1 test.sh -NO_COLOR=${NO_COLOR:-""} -if [ -z "$NO_COLOR" ]; then - header=$'\e[1;33m' - reset=$'\e[0m' -else - header='' - reset='' -fi - -istio_version=1.3.6 - -function header_text { - echo "$header$*$reset" -} - -header_text "Using Istio Version: ${istio_version}" - -header_text "Downloading Istio" - -pushd /tmp > /dev/null - -export ISTIO_VERSION="${istio_version}" - -curl -L https://git.io/getLatestIstio | sh - - -pushd istio-${ISTIO_VERSION} > /dev/null - -header_text "Creating Istio Custom Resource Definintions(CRD)" - -for i in install/kubernetes/helm/istio-init/files/crd*yaml; -do - kubectl apply -f $i; -done - -header_text "Creating istio-system namespace" - -cat < ./istio-lean.yaml - -helm template --namespace=istio-system \ - --set gateways.custom-gateway.autoscaleMin=1 \ - --set gateways.custom-gateway.autoscaleMax=2 \ - --set gateways.custom-gateway.cpu.targetAverageUtilization=60 \ - --set gateways.custom-gateway.labels.app='cluster-local-gateway' \ - --set gateways.custom-gateway.labels.istio='cluster-local-gateway' \ - --set gateways.custom-gateway.type='ClusterIP' \ - --set gateways.istio-ingressgateway.enabled=false \ - --set gateways.istio-egressgateway.enabled=false \ - --set gateways.istio-ilbgateway.enabled=false \ - install/kubernetes/helm/istio \ - -f install/kubernetes/helm/istio/example-values/values-istio-gateways.yaml \ - | sed -e "s/custom-gateway/cluster-local-gateway/g" -e "s/customgateway/clusterlocalgateway/g" \ - > ./istio-local-gateway.yaml - -kubectl apply -f istio-lean.yaml &&\ -kubectl apply -f istio-local-gateway.yaml - -header_text "Waiting for Istio to become ready" -sleep 5; while echo && kubectl get pods -n istio-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done - -header_text "Istio successfully installed" - -kubectl get pods -n istio-system - -popd > /dev/null -popd > /dev/null \ No newline at end of file diff --git a/bin/kafka-consumer.sh b/bin/kafka-consumer.sh index c23e4035..4d248777 100755 --- a/bin/kafka-consumer.sh +++ b/bin/kafka-consumer.sh @@ -8,7 +8,7 @@ KAFKA_CLUSTER_NS=${2:-'kafka'} KAFKA_CLUSTER_NAME=${3:-'my-cluster'} kubectl -n $KAFKA_CLUSTER_NS run kafka-consumer -ti \ - --image=strimzi/kafka:0.15.0-kafka-2.3.1 \ + --image=quay.io/strimzi/kafka:0.26.1-kafka-3.0.0 \ --rm=true --restart=Never \ -- bin/kafka-console-consumer.sh \ --bootstrap-server $KAFKA_CLUSTER_NAME-$KAFKA_CLUSTER_NS-bootstrap:9092 \ diff --git a/bin/kafka-producer.sh b/bin/kafka-producer.sh index 070bee11..daa6a4f0 100755 --- a/bin/kafka-producer.sh +++ b/bin/kafka-producer.sh @@ -9,7 +9,7 @@ KAFKA_CLUSTER_NAME=${3:-'my-cluster'} kubectl -n $KAFKA_CLUSTER_NS run kafka-producer -ti \ - --image=strimzi/kafka:0.15.0-kafka-2.3.1 \ + --image=quay.io/strimzi/kafka:0.26.1-kafka-3.0.0 \ --rm=true --restart=Never \ -- bin/kafka-console-producer.sh\ --broker-list $KAFKA_CLUSTER_NAME-$KAFKA_CLUSTER_NS-bootstrap:9092 \ diff --git a/bin/start-minikube.sh b/bin/start-minikube.sh index b5644cc1..8a0c0e84 100755 --- a/bin/start-minikube.sh +++ b/bin/start-minikube.sh @@ -14,14 +14,14 @@ then --memory="$MEMORY" \ --driver=hyperkit \ --cpus="$CPUS" \ - --kubernetes-version=v1.19.0 \ + --kubernetes-version=v1.23.0 \ --disk-size=50g \ --insecure-registry='10.0.0.0/24' else minikube start -p "$PROFILE_NAME" \ --memory="$MEMORY" \ --cpus="$CPUS" \ - --kubernetes-version=v1.19.0 \ + --kubernetes-version=v1.23.0 \ --disk-size=50g \ --insecure-registry='10.0.0.0/24' fi diff --git a/bin/start-minkube-setup.sh b/bin/start-minkube-setup.sh deleted file mode 100755 index 89ccc11d..00000000 --- a/bin/start-minkube-setup.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -set -eu -set -o pipefail - -CPUS=${CPUS:-6} -KNATIVE_VERSION=${KNATIVE_VERSION:-v0.17.0} -KNATIVE_SERVING_VERSION=${KNATIVE_SERVING_VERSION:-v0.17.0} -MEMORY=${MEMORY:-8192} -PROFILE_NAME=${PROFILE_NAME:-boson-quickstarts} - -minikube start -p "$PROFILE_NAME" \ - --memory="$MEMORY" \ - --cpus="$CPUS" \ - --disk-size=50g \ - --insecure-registry='10.0.0.0/24' - -minikube profile "$PROFILE_NAME" - -minikube addons enable registry -minikube addons enable registry-aliases - -################################### -# Ingress -################################### - -kubectl apply -f https://projectcontour.io/quickstart/contour.yaml - -kubectl rollout status ds envoy -n projectcontour -kubectl rollout status deploy contour -n projectcontour - -###################################### -## Knative CRD -###################################### - -kubectl apply \ - --filename "https://github.com/knative/serving/releases/download/$KNATIVE_SERVING_VERSION/serving-crds.yaml" - -###################################### -## Knative Serving -###################################### - -kubectl apply \ - --filename "https://github.com/knative/serving/releases/download/$KNATIVE_SERVING_VERSION/serving-crds.yaml" - -kubectl apply \ - --filename \ - "https://github.com/knative/serving/releases/download/$KNATIVE_SERVING_VERSION/serving-core.yaml" - -kubectl rollout status deploy controller -n knative-serving -kubectl rollout status deploy activator -n knative-serving -kubectl rollout status deploy autoscaler -n knative-serving -kubectl rollout status deploy webhook -n knative-serving - -kubectl apply \ - --filename \ - "https://github.com/knative/net-kourier/releases/download/$KNATIVE_VERSION/kourier.yaml" - -kubectl rollout status deploy 3scale-kourier-control -n knative-serving -kubectl rollout status deploy 3scale-kourier-gateway -n kourier-system - -kubectl patch configmap/config-network \ - -n knative-serving \ - --type merge \ - -p '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' - -cat < + - to: "https://www.fruityvice.com/api/fruit/all"#<1> - split: - jsonpath: "$.[*]" # <2> + jsonpath: "$.[*]"#<2> - marshal: json: {} - log: message: "${body}" - - to: "kafka:fruits?brokers=my-cluster-kafka-bootstrap.kafka:9092" # <3> + - to: "kafka:fruits?brokers=my-cluster-kafka-bootstrap.kafka:9092"#<3> + ---- -<1> Call the external REST API http://fruityvice.com to get the list of fruits to simulate the data streaming -<2> Apply the Camel Split EIP to split the JSON array to individual records +<1> Poll every 5 seconds from the REST API http://fruityvice.com. +<2> Call the external REST API http://fruityvice.com to get the list of fruits to simulate the data streaming <3> Send the processed data i.e. the individual fruit record as JSON to Apache Kafka Topic Run the following command to deploy the `fruit-producer` integration: @@ -152,7 +139,6 @@ A successful deploy will show the following pods: ---- NAME READY STATUS AGE camel-k-operator-5d74595cdf-4v9qz 1/1 Running 4h4m -fruityvice-proxy-76d6ff5f7f-rlrqh 1/1 Running 4m1 *_fruits-producer-nfngm-deployment-759c797c44-d6r52 2/2 Running 70s_* ---- @@ -169,15 +155,6 @@ fruits-producer http://fruits-producer.{tutorial-namespace}.{minikube-nip-io} [[kamel-cbr-fp-verify]] === Verify Fruit Producer -Run the `$TUTORIAL_HOME/bin/call.sh` with the parameter `fruits-producer`. - -[.console-input] -[#kamel-cbr-call-fp] -[source,bash,subs="+quotes,+attributes,+macros"] ----- -$TUTORIAL_HOME/bin/call.sh fruits-producer '' ----- - Open a new terminal and run the start Kafka consumer using the script `$TUTORIAL_HOME/bin/kafka-consumer.sh` with parameter `fruits`: [.console-input] @@ -203,90 +180,149 @@ Since the fruits API returns a static set of fruit data consistently, you can ca [[camel-k-cbr-data-processor]] == Deploy Data Processor -Let us now deploy a CamelSource called `fruits-processor`, that can handle and process the streaming data from the Kafka topic `fruits`. The `fruits-processor` CamelSource applies the *Content Based Router* EIP to process the data. The following listing describes the `fruits-processor` CamelSource: +Let us now deploy a Kamelet called `fruits-processor`, that can handle and process the streaming data from the Kafka topic `fruits`. +The `fruits-processor` Kamelet applies the *Content Based Router* EIP to process the data: -.CamelSource fruits-processor +.Kamelet fruits-processor [source,yaml] ---- -apiVersion: sources.eventing.knative.dev/v1alpha1 -kind: CamelSource +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet metadata: name: fruits-processor + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "main-SNAPSHOT" + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "Kafka" + labels: + camel.apache.org/kamelet.type: "source" spec: - source: - integration: - dependencies: - - camel:log - - camel:kafka - - camel:jackson - - camel:bean - flow: - from: - uri: "kafka:fruits?brokers=my-cluster-kafka-bootstrap.kafka:9092" #<1> - steps: - - log: - message: "Received Body ${body}" - - unmarshal: - json: {} #<2> - - choice: #<3> - when: - - simple: "${body[nutritions][sugar]} <= 5" - steps: - - remove-headers: "*" - - marshal: - json: {} - - set-header: #<4> - name: ce-type - constant: low-sugar - - set-header: - name: fruit-sugar-level - constant: low - - to: "log:low?showAll=true&multiline=true" - - simple: "${body[nutritions][sugar]} > 5 && ${body[nutritions][sugar]} <= 10" - steps: - - remove-headers: "*" - - marshal: - json: {} - - set-header: - name: ce-type - constant: medium-sugar - - set-header: - name: fruit-sugar-level - constant: medium - - to: "log:medium?showAll=true&multiline=true" - otherwise: + definition: + title: "Kafka Not Secured Source" + description: |- + Receive data from Kafka topics on an insecure broker. + required: + - topic + - brokers + type: object + properties: + topic: + title: Topic Names + description: Comma separated list of Kafka topic names + type: string + brokers: + title: Brokers + description: Comma separated list of Kafka Broker URLs + type: string + dependencies: + - "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT" + - "camel:kafka" + - "camel:kamelet" + - "camel:jackson" + - "camel:core" + - "camel:log" + flow: + from: + uri: "kafka:fruits?brokers=my-cluster-kafka-bootstrap.kafka:9092"#<1> + steps: + - log: + message: "Received Body ${body}" + - unmarshal: + json: {}#<2> + - choice: #<3> + when: + - simple: "${body[nutritions][sugar]} <= 5" + steps: + - remove-headers: "*" + - marshal: + json: {} + - set-header: #<4> + name: ce-type + constant: low-sugar + - set-header: + name: fruit-sugar-level + constant: low + - to: "log:low?showAll=true&multiline=true" + - simple: "${body[nutritions][sugar]} > 5 || ${body[nutritions][sugar]} <= 10" steps: - remove-headers: "*" - marshal: json: {} - set-header: name: ce-type - constant: high-sugar + constant: medium-sugar - set-header: name: fruit-sugar-level - constant: high - - to: "log:high?showAll=true&multiline=true" - sink: #<5> - ref: - apiVersion: eventing.knative.dev/v1alpha1 - kind: Broker - name: default + constant: medium + - to: "log:medium?showAll=true&multiline=true" + otherwise: + steps: + - remove-headers: "*" + - marshal: + json: {} + - set-header: + name: ce-type + constant: high-sugar + - set-header: + name: fruit-sugar-level + constant: high + - to: "log:high?showAll=true&multiline=true" ---- <1> The Camel route connects to Apache Kafka broker and the topic `fruits`. <2> Once the data is received it is transformed into a JSON payload. <3> The `Content Based Router` pattern using the https://camel.apache.org/manual/latest/choice-eip.html[Choice EIP]. In the data processing you classify the fruits as low (sugar pass:[<=] 5), medium(sugar between 5 to 10) and high(sugar > 10) based on the sugar level present in their nutritions data. <4> Based on the data classification you will be setting the https://cloudevents.io[CloudEvents] `type` header to be `low-high`, `medium-sugar` and `high-sugar`. This header is used as one of the filter attributes in the Knative Eventing Trigger. -<5> The last step is to send the processed data to the Knative Eventing Broker named `default`. + +Let's deploy the Kamelet using the following command: [.console-input] [#kamel-deploy-data-processor] [source,bash,subs="+quotes,+attributes,+macros"] ---- -kubectl apply -n {tutorial-namespace} -f eip/fruits-processor.yaml +kubectl apply -n {tutorial-namespace} -f eip/fruits-processor-kamelet.yaml ---- -As the Camel-K controller takes few minutes to deploy the CamelSource, you can watch the pods of the `{tutorial-namespace}` namespace for its status: +The last step is to send the processed data to the Knative Eventing Broker named `default`. +We can do that by using a `KameletBinding`: + +.KameletBinding fruits-processor +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: fruits-processor-to-knative +spec: + source: + ref: #<1> + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: fruits-processor + properties: + topic: "fruits" + brokers: "my-cluster-kafka-bootstrap.kafka:9092" + sink: #<2> + ref: + kind: Broker + apiVersion: eventing.knative.dev/v1 + name: default +---- + +<1> Kubernetes reference to the previously created Kamelet. +<2> Sink the input to the default broker. + +Let's deploy the KameletBinding using: + +[.console-input] +[#kamel-deploy-data-binding] +[source,bash,subs="+quotes,+attributes,+macros"] +---- +kubectl apply -n {tutorial-namespace} -f eip/fruits-processor-to-knative.yaml +---- + +As the Camel-K controller takes few minutes to deploy the KameletBinding, you can watch the pods of the `{tutorial-namespace}` namespace for its status: include::advanced:partial$adv-kubectl-queries.adoc[tags="kgpow"] @@ -294,14 +330,11 @@ include::advanced:partial$adv-kubectl-queries.adoc[tags="kgpow"] .fruit-processor Knative service pods [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME READY STATUS AGE -camel-k-operator-5d74595cdf-4v9qz 1/1 Running 4h17m -*_fruits-processor-h45f7-6fdfd74cf9-nmfkn 1/1 Running 29s_* -fruityvice-proxy-76d6ff5f7f-rlrqh 1/1 Running 24m +NAME READY STATUS AGE +camel-k-operator-5d74595cdf-4v9qz 1/1 Running 4h17m +*fruits-processor-to-knative-595945f8d7-wc9qz 1/1 Running 4h42m* ---- -A successful `fruit-processor` is deploy will show the following pods in `{tutorial-namespace}` - [NOTE] ==== Wondering why `fruit-producer` is not listed ? @@ -309,20 +342,21 @@ Wondering why `fruit-producer` is not listed ? `fruit-producer` is a Knative service, hence it wil be scaled down to zero in 60-90 seconds. ==== +You can check if your `KameletBinding` is `Ready` by running: [.console-input] [#kamel-cbr-query-camelsources] [source,bash,subs="+quotes,+attributes,+macros"] ---- -watch kubectl get -n {tutorial-namespace} camelsources +kn source kamelet binding list -n {tutorial-namespace} ---- -When the CamelSource deployment is successful you will see it in `READY` state as shown: +When the KamelBinding is successful you will see it in `READY` state as shown: [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME READY REASON AGE -fruits-processor True 2m22s +NAME READY REASON AGE +fruits-processor-to-knative True 2m22s ---- [[camel-k-cbr-event-subscriber]] @@ -354,7 +388,6 @@ NAME READY STATUS AGE camel-k-operator-5d74595cdf-4v9qz 1/1 Running 4h21m *_fruit-events-display-8d47bc98f-6r7zt 1/1 Running 15s_* fruits-processor-h45f7-6fdfd74cf9-nmfkn 1/1 Running 4m12s -fruityvice-proxy-76d6ff5f7f-rlrqh 1/1 Running 24m ---- The web `fruit-events-display` application will refresh its UI as and when it receives the processed data, you need you open the web application in your browser. @@ -479,10 +512,10 @@ image::cbr_app_ui_with_data.png[align="center"] [source,bash,subs="+quotes,+attributes,+macros"] ---- kamel delete -n {tutorial-namespace} fruits-producer -kubectl delete -n {tutorial-namespace} -f eip/fruits-processor.yaml +kubectl delete -n {tutorial-namespace} -f eip/fruits-processor-kamelet.yaml +kubectl delete -n {tutorial-namespace} -f eip/fruits-processor-to-knative.yaml kubectl delete -n {tutorial-namespace} -f eip/sugary-fruits.yaml kubectl delete -n {tutorial-namespace} -f $TUTORIAL_HOME/install/utils/fruit-events-display.yaml -kubectl delete -n {tutorial-namespace} -f $TUTORIAL_HOME/install/utils/fruityvice-proxy.yaml kn broker delete -n {tutorial-namespace} default kamel -n {tutorial-namespace} reset kamel -n {tutorial-namespace} uninstall diff --git a/documentation/modules/advanced/pages/deploy-apache-kafka.adoc b/documentation/modules/advanced/pages/deploy-apache-kafka.adoc index 0f1b30a2..61de2c08 100644 --- a/documentation/modules/advanced/pages/deploy-apache-kafka.adoc +++ b/documentation/modules/advanced/pages/deploy-apache-kafka.adoc @@ -65,17 +65,16 @@ The command should show the following output: [.console-output] [source,bash,subs="+quotes,attributes+,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -kafkabridges kb kafka.strimzi.io true KafkaBridge -kafkaconnectors kctr kafka.strimzi.io true KafkaConnector -kafkaconnects kc kafka.strimzi.io true KafkaConnect -kafkaconnects2is kcs2i kafka.strimzi.io true KafkaConnectS2I -kafkamirrormaker2s kmm2 kafka.strimzi.io true KafkaMirrorMaker2 -kafkamirrormakers kmm kafka.strimzi.io true KafkaMirrorMaker -kafkarebalances kr kafka.strimzi.io true KafkaRebalance -kafkas k kafka.strimzi.io true Kafka -kafkatopics kt kafka.strimzi.io true KafkaTopic -kafkausers ku kafka.strimzi.io true KafkaUser +NAME SHORTNAMES APIVERSION NAMESPACED KIND +kafkabridges kb kafka.strimzi.io/v1beta2 true KafkaBridge +kafkaconnectors kctr kafka.strimzi.io/v1beta2 true KafkaConnector +kafkaconnects kc kafka.strimzi.io/v1beta2 true KafkaConnect +kafkamirrormaker2s kmm2 kafka.strimzi.io/v1beta2 true KafkaMirrorMaker2 +kafkamirrormakers kmm kafka.strimzi.io/v1beta2 true KafkaMirrorMaker +kafkarebalances kr kafka.strimzi.io/v1beta2 true KafkaRebalance +kafkas k kafka.strimzi.io/v1beta2 true Kafka +kafkatopics kt kafka.strimzi.io/v1beta2 true KafkaTopic +kafkausers ku kafka.strimzi.io/v1beta2 true KafkaUser ---- Now with the Apache Kafka operator running, you can deploy and verify a single node Apache Kafka cluster by running the command: @@ -101,13 +100,10 @@ Watch the `kafka` namespace for the cluster deployment: [.console-output] [source,bash,subs="+quotes,attributes+,+macros"] ---- -NAME READY STATUS AGE -my-cluster-entity-operator-7d677bdf7b-jpws7 3/3 Running 85s -my-cluster-kafka-0 2/2 Running 110s -my-cluster-zookeeper-0 2/2 Running 2m22s -my-cluster-zookeeper-1 2/2 Running 2m22s -my-cluster-zookeeper-2 2/2 Running 2m22s -strimzi-cluster-operator-85f596bfc7-7dgds 1/1 Running 4m22s +my-cluster-entity-operator-6cb88758b7-hhxq7 3/3 Running 0 31s +my-cluster-kafka-0 1/1 Running 0 54s +my-cluster-zookeeper-0 1/1 Running 2 (104s ago) 118s +strimzi-cluster-operator-787d48b5bc-649jb 1/1 Running 2 (2m7s ago) 41m ---- The Kubernetes CRD resource `$TUTORIAL_HOME/eventing/kafka-broker-my-cluster.yaml`, will deploy a single *Zookeeper*, *Kafka Broker* and a *Entity-Operator*. The *Entity-Operator* is responsible for managing different custom resources such as KafkaTopic and KafkaUser. @@ -117,7 +113,7 @@ Now that you have an Apache Kafka cluster deployed, you can create a Kafka Topic .Create Kafka Topic my-topic [source,yaml] ---- -apiVersion: kafka.strimzi.io/v1beta1 +apiVersion: kafka.strimzi.io/v1beta2 kind: KafkaTopic metadata: name: my-topic diff --git a/documentation/modules/advanced/pages/eventing-with-kafka.adoc b/documentation/modules/advanced/pages/eventing-with-kafka.adoc index 58f3bb64..0e829cf0 100644 --- a/documentation/modules/advanced/pages/eventing-with-kafka.adoc +++ b/documentation/modules/advanced/pages/eventing-with-kafka.adoc @@ -23,8 +23,9 @@ Knative Eventing `KafkaSource` need to be used to have the Kafka messages to flo [#kn-eventing-adv-deploy-kafkasource] [source,bash,subs="+quotes,attributes+,+macros"] ---- + kubectl apply \ --f {knative-kafka-repo}/releases/download/{kafka-source-version}/source.yaml +-f {knative-kafka-repo}/releases/download/knative-{kafka-source-version}/source.yaml ---- The previous step deploys Knative KafkaSource in the `knative-sources` namespace as well as a CRD, ServiceAccount, ClusterRole, etc. Verify that knative-source namespace includes the `kafka-controller-manager-0` pod: @@ -33,7 +34,7 @@ The previous step deploys Knative KafkaSource in the `knative-sources` namespace [#watch-kafkasource-controller-pod] [source,bash,subs="+quotes,attributes+,+macros"] ---- -watch "kubectl get pods -n knative-sources" +watch "kubectl get pods -n knative-eventing" ---- The command above should show the following output: @@ -42,7 +43,16 @@ The command above should show the following output: [source,bash,subs="+quotes,attributes+,+macros"] ---- NAME READY STATUS AGE -kafka-controller-manager-0 1/1 Running 1m17s +NAME READY STATUS RESTARTS AGE +eventing-controller-6cd47bff4b-vlsjb 1/1 Running 1 92m +eventing-webhook-87b4f6cb5-btfr4 1/1 Running 12 (2m45s ago) 92m +imc-controller-5bd45cf5b-2wr9v 1/1 Running 12 (2m43s ago) 92m +imc-dispatcher-7b9bf546b8-cmf65 1/1 Running 14 (3m27s ago) 92m +kafka-controller-manager-7c4498d478-fsjxl 1/1 Running 0 67s +mt-broker-controller-5bb47f9cf5-dfs2z 1/1 Running 2 (52m ago) 92m +mt-broker-filter-7f468cbd7b-6r28q 1/1 Running 6 (4m35s ago) 92m +mt-broker-ingress-57db965447-8bv57 1/1 Running 5 (22m ago) 92m + ---- You should also deploy the Knative Kafka Channel that can be used to connect the Knative Eventing Channel with a Apache Kafka cluster backend, to deploy a Knative Kafka Channel run: @@ -52,7 +62,7 @@ You should also deploy the Knative Kafka Channel that can be used to connect the [source,bash,subs="+quotes,attributes+,+macros"] ---- curl -L "{knative-kafka-repo}/\ -releases/download/{kafka-source-version}/channel-consolidated.yaml" \ +releases/download/knative-{kafka-source-version}/channel-consolidated.yaml" \ | sed 's/REPLACE_WITH_CLUSTER_URL/my-cluster-kafka-bootstrap.kafka:9092/' \ | kubectl apply --filename - ---- @@ -77,17 +87,18 @@ The command will shown an output like: [.console-output] [source,bash,subs="+quotes,attributes+,+macros"] ---- -NAME READY STATUS RESTARTS AGE -broker-controller-56b4d58667-mgf4w 1/1 Running 0 3h54m -broker-filter-5bdbc8d8dd-jqrfc 1/1 Running 0 3h54m -broker-ingress-d896b6b46-nvg92 1/1 Running 0 3h54m -eventing-controller-5fc5645584-n42xs 1/1 Running 0 3h54m -eventing-webhook-7674b867dc-qn44m 1/1 Running 0 3h54m -imc-controller-6b548d6468-zcspc 1/1 Running 0 3h54m -imc-dispatcher-655cdf6ff6-x5sxx 1/1 Running 0 3h54m -#kafka-ch-controller-5cf4bdc98-tl8xv 1/1 Running 0 76s# -#kafka-webhook-5f8895ccdf-z6qnw 1/1 Running 0 76s# -mt-broker-controller-6d66c4c6f6-vbpk4 1/1 Running 0 3h54m +NAME READY STATUS RESTARTS AGE +eventing-controller-6cd47bff4b-vlsjb 1/1 Running 1 94m +eventing-webhook-87b4f6cb5-btfr4 1/1 Running 12 (72s ago) 94m +imc-controller-5bd45cf5b-2wr9v 1/1 Running 13 (26s ago) 94m +imc-dispatcher-7b9bf546b8-cmf65 1/1 Running 15 (74s ago) 94m +#kafka-ch-controller-566bb77694-5hmc9 1/1 Running 0 27s# +#kafka-controller-manager-7c4498d478-fsjxl 1/1 Running 1 (71s ago) 3m5s# +#kafka-webhook-66fcb6588b-gqpfd 1/1 Running 0 27s# +mt-broker-controller-5bb47f9cf5-dfs2z 1/1 Running 2 (54m ago) 94m +mt-broker-filter-7f468cbd7b-6r28q 1/1 Running 6 (6m33s ago) 94m +mt-broker-ingress-57db965447-8bv57 1/1 Running 5 (24m ago) 94m + ---- And you should also find some new api-resources as shown: @@ -124,7 +135,7 @@ TYPE NAME DESCRIPTION ApiServerSource apiserversources.sources.knative.dev Watch and send Kubernetes API events to addressable CamelSource camelsources.sources.knative.dev ContainerSource containersources.sources.knative.dev Generate events by Container image and send to addressable -*KafkaSource kafkasources.sources.knative.dev Route events from Apache Kafka Server to addressable* +#KafkaSource kafkasources.sources.knative.dev Route events from Apache Kafka Server to addressable# PingSource pingsources.sources.knative.dev Send periodically ping events to addressable SinkBinding sinkbindings.sources.knative.dev Binding for connecting a PodSpecable to addressable ---- @@ -145,7 +156,7 @@ The command should show the following APIs in `messaging.knative.dev` : NAME SHORTNAMES APIGROUP NAMESPACED KIND channels ch messaging.knative.dev true Channel inmemorychannels imc messaging.knative.dev true InMemoryChannel -*kafkachannels kc messaging.knative.dev true KafkaChannel* +#kafkachannels kc messaging.knative.dev true KafkaChannel# subscriptions sub messaging.knative.dev true Subscription ---- diff --git a/documentation/modules/camelk/nav.adoc b/documentation/modules/camelk/nav.adoc index 3f645f2c..322b4095 100644 --- a/documentation/modules/camelk/nav.adoc +++ b/documentation/modules/camelk/nav.adoc @@ -1,11 +1,10 @@ * xref:camelk:setup.adoc[Setup] -** xref:camelk:setup.adoc#install-camel-k[Install Camel K ] * xref:camelk:camel-k-basics.adoc[Camel K with Knative Serving] ** xref:camelk:camel-k-basics.adoc#deploy-camel-k-integration[Deploy Camel K integration] ** xref:camelk:camel-k-basics.adoc#deploy-camel-k-kn-integration[Deploy Camel K Knative Integration] ** xref:camelk:camel-k-basics.adoc#camelk-gs-cleanup[Cleanup] * xref:camelk:camel-k-eventing.adoc[Camel K with Knative Eventing] -** xref:camelk:camel-k-eventing.adoc#deploy-camel-k-source[Deploy Knative CamelSource] +** xref:camelk:camel-k-eventing.adoc#install-camel-k-plugin[Install the kn kamelet source plugin] ** xref:camelk:camel-k-eventing.adoc#logging-ce-messages[View CloudEvents Messages] -** xref:camelk:camel-k-eventing.adoc#camel-k-es-sink[CamelSource to Sink] +** xref:camelk:camel-k-eventing.adoc#camel-k-es-sink[Custom Kamelet as source for a Knative Eventing Sink] ** xref:camelk:camel-k-eventing.adoc#camelk-eventing-cleanup[Cleanup] diff --git a/documentation/modules/camelk/pages/_partials/invoke-service.adoc b/documentation/modules/camelk/pages/_partials/invoke-service.adoc index c459aaba..0ea43ba8 100644 --- a/documentation/modules/camelk/pages/_partials/invoke-service.adoc +++ b/documentation/modules/camelk/pages/_partials/invoke-service.adoc @@ -13,7 +13,7 @@ kubectl:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -SVC_URL=`kubectl -n {tutorial-namespace} get ksvc {svc-name} -ojsonpath='{.status.domain}'` +SVC_URL=`kubectl -n {tutorial-namespace} get ksvc {svc-name} -o jsonpath='{.status.domain}'` ---- -- oc:: @@ -22,7 +22,7 @@ oc:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -SVC_URL=`oc -n {tutorial-namespace} get ksvc {svc-name} -ojsonpath='{.status.domain}'` +SVC_URL=`oc -n {tutorial-namespace} get ksvc {svc-name} -o jsonpath='{.status.domain}'` ---- -- ==== diff --git a/documentation/modules/camelk/pages/camel-k-basics.adoc b/documentation/modules/camelk/pages/camel-k-basics.adoc index 260d86cd..52ea374a 100644 --- a/documentation/modules/camelk/pages/camel-k-basics.adoc +++ b/documentation/modules/camelk/pages/camel-k-basics.adoc @@ -186,14 +186,14 @@ The command above shows the following output: [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -builds ikb camel.apache.org true Build -camelcatalogs cc camel.apache.org true CamelCatalog -integrationkits ik camel.apache.org true IntegrationKit -integrationplatforms ip camel.apache.org true IntegrationPlatform -integrations it camel.apache.org true Integration -kameletbindings klb camel.apache.org true KameletBinding -kamelets kl camel.apache.org true Kamelet +NAME SHORTNAMES APIVERSION NAMESPACED KIND +builds ikb camel.apache.org/v1 true Build +camelcatalogs cc camel.apache.org/v1 true CamelCatalog +integrationkits ik camel.apache.org/v1 true IntegrationKit +integrationplatforms ip camel.apache.org/v1 true IntegrationPlatform +integrations it camel.apache.org/v1 true Integration +kameletbindings klb camel.apache.org/v1alpha1 true KameletBinding +kamelets kl camel.apache.org/v1alpha1 true Kamelet ---- [#camel-k-list-int] diff --git a/documentation/modules/camelk/pages/camel-k-eventing.adoc b/documentation/modules/camelk/pages/camel-k-eventing.adoc index 1e799858..a0864886 100644 --- a/documentation/modules/camelk/pages/camel-k-eventing.adoc +++ b/documentation/modules/camelk/pages/camel-k-eventing.adoc @@ -5,7 +5,7 @@ include::_attributes.adoc[] At the end of this chapter you will be able to: - How to use Knative Eventing Channels with Apache Camel K -- Using Knative CamelSource +- Using Knative Kamelet - Connect Apache Camel K source to Sink Navigate to the tutorial chapter's folder {camelk-repo}: @@ -17,62 +17,46 @@ Navigate to the tutorial chapter's folder {camelk-repo}: cd $TUTORIAL_HOME/{camelk-repo} ---- -[#deploy-camel-k-source] -== Deploy Knative Eventing CamelSource +[#install-camel-k-plugin] +== Install the kn kamelet source plugin -The `CamelSource` allows you use a Camel K integration as part of the Knative Eventing architecture. Simply speaking, you can make the Camel K integration act as a https://knative.dev/docs/eventing/sources/[Knative Event Source] and send the Camel exchanges (OUT) through a Knative Event Sink. +You can use the Camel K integration as part of the Knative Eventing architecture via a `Kamelet`. +Simply speaking, you can make the Camel K integration act as a https://knative.dev/docs/eventing/sources/[Knative Event Source] and send the Camel exchanges (OUT) through a Knative Event Sink. +To start working with Kamelets you will need to add the kamelet source plugin to `kn` CLI. -To deploy CamelSource run the following command: +As you probably already installed the `kn` CLI tooling, you can simply load the https://github.com/knative-sandbox/kn-plugin-source-kamelet/releases[Kamelet source plugin binaries] in order to add the commands for managing Kamelets as event sources. +To verify your installation, please run the following command: [.console-input] -[#deploy-camelsource] +[#list-kn-plugins] [source,bash,subs="+quotes,+attributes,+macros"] ---- -kubectl apply \ - -f "{eventing-camel-repo}/releases/download/{camel-source-version}/camel.yaml" +kn plugin list ---- -Once you deploy, thee following new pod showing up the `knative-sources` namespace, wait for the `camel-controller-manager-0` to be running: - -[.console-input] -[source,bash,subs="+quotes,+attributes,+macros"] ----- -watch 'kubectl -n knative-sources get pods' ----- +You should see an output similar to: [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME READY STATUS RESTARTS AGE -*camel-controller-manager-0 1/1 Running 0 88s* +- kn-quickstart : /usr/local/bin/kn-quickstart +- kn-source-kamelet : /usr/local/bin/kn-source-kamelet ---- -Plus, CamelSource is now part of the API along with other Knative Eventing Sources that you might have deployed: +By default, the `kn` CLI tool has a set of different event sources and its respective commands to manage those sources. +You can list all the available Kamelets with the following command: [.console-input] -[#camel-k-camelsource-api] -[source,bash,subs="+quotes,+attributes,+macros"] ----- -kubectl api-resources --api-group=sources.knative.dev ----- - -The command above should list: - -[.console-output] +[#list-kamelets] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -apiserversources sources.knative.dev true ApiServerSource -#camelsources sources.knative.dev true CamelSource# -containersources sources.knative.dev true ContainerSource -pingsources sources.knative.dev true PingSource -sinkbindings sources.knative.dev true SinkBinding SinkBinding +kn source kamelet list -n knativetutorial ---- [#logging-ce-messages] == View CloudEvents Messages -In order for you to view the events drained from the CamelSource `timed-greeter`, you need to deploy a utility service called `event-display`. Run the following command to deploy the service: +In order for you to view the events drained from the Kamelet `timed-greeter`, you need to deploy a utility service called `event-display`. Run the following command to deploy the service: [.console-input] [#deploy-ce-event-display] @@ -116,8 +100,8 @@ kn service -n {tutorial-namespace} ls [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME URL LATEST AGE CONDITIONS READY REASON -event-display http://event-display.knativetutorial.example.com event-display-7jvmm 85s 3 OK / 3 True +NAME URL LATEST AGE CONDITIONS READY REASON +event-display http://event-display.knativetutorial.192.168.59.101.nip.io event-display-00001 24s 3 OK / 3 True ---- -- @@ -141,73 +125,89 @@ event-display http://event-display.knativetutorial.example.com event-display [[camel-k-es-sink]] -== CamelSource to a Knative Eventing Sink +== Custom Kamlet as source for a Knative Eventing Sink Knative Eventing semantics allows you to link the Event Source to Event Sink using the **sink** block of the Knative Eventing source specification. -As part of this exercise we will deploy the same `timed-greeter` integration that you deployed <> but now as a CamelSource that was deployed <>. The event source (CamelSource) is configured to drain the events to the sink `event-display`. +As part of this exercise we will deploy the same `timed-greeter` integration that you deployed <> but now as a Kamelet. -The following listing provides the details of CamelSource configuration: +The following listing provides the details of Kamelet configuration: -.timed-greeter CamelSource +.timed-greeter Kamelet [source,yaml] ---- apiVersion: sources.knative.dev/v1alpha1 #<1> -kind: CamelSource +kind: Kamelet metadata: name: timed-greeter spec: - integration: #<2> - dependencies: - - camel:log - source: #<3> - flow: - from: - uri: "timer:tick" - parameters: - # time in milliseconds (10 s) - period: 10000 - steps: - - set-body: - constant: "Welcome to Apache Camel K" - - set-header: - name: ContentType - simple: text/plain - - transform: - simple: "${body.toUpperCase()}" - - log: - message: "${body}" - sink: #<4> - ref: - apiVersion: serving.knative.dev/v1 - kind: Service - name: event-display - ----- -<1> The CamelSource is provided by the API `sources.knative.dev`, it is now available as a result of deploying the CamelSource event source. -<2> The CamelSource spec has two main sections: `integration` and `source`. The `integration` block is used to configure the Camel K integration specific properties such as dependencies, traits, etc. In this example we add the required dependencies such as `camel:log`, it is the dependency that you earlier passed via `kamel` CLI. -<3> The `source` block is used to define the Camel K integration definition. The `flow` attribute of the `source` block allows you define the Camel route. -<4> The event sink for messages from the Camel event source. The sink could be either a Knative Service, Knative Event Channel or Knative Event Broker. In this case it is configured to be the `event-display` Knative Service. - -To deploy the CamelSource run the following command: + definition: + title: Timed Greeter Source + description: Produces periodic events with a custom payload. + required: + - message + type: object + properties: + period: + title: Period + description: The interval between two events in milliseconds + type: integer + default: 1000 + message: + title: Message + description: The message to generate + type: string + example: hello world + contentType: + title: Content Type + description: The content type of the message being generated + type: string + default: text/plain + dependencies: + - "camel:core"#<2> + - "camel:timer" + - "camel:kamelet" + template: + from: #<3> + uri: timer:tick + parameters: + period: 10000 + steps: + - set-body: + constant: "{{message}}" + - set-header: + name: "Content-Type" + constant: "{{contentType}}" + - transform: + simple: "${body.toUpperCase()}" + - to: "kamelet:sink"#<4> +---- +<1> The Kamelet is provided by the API `sources.knative.dev`. +<2> The Kamelet spec has three main sections: `definition`, `dependencies` and `template`. +The `dependencies` block is used to configure the Camel K integration specific properties such as dependencies, traits, etc. +In this example we add the required dependencies such as `camel:core`, it is the dependency that you earlier passed via `kamel` CLI. +<3> The `from` attribute allows you define the Camel route. +<4> The event sink for messages from the Camel event source. A Source Kamelet sends data to a `kamelet:sink`, that will be replaced at runtime by a different target. + +To deploy the Kamelet run the following command: [.console-input] [#deploy-greeter-camelsource] [source,bash,subs="+quotes,+attributes,+macros"] ---- -kubectl apply -n {tutorial-namespace} -f get-started/timed-greeter-source.yaml +kubectl apply -n {tutorial-namespace} -f get-started/timed-greeter-kamelet.yaml ---- -A successful deployment will show the CamelSource `timed-greeter` in ready state along with its pods in the {tutorial-namespace} namespace. +A successful deployment will show the Kamelet `timed-greeter` in ready state along with its pods in the {tutorial-namespace} namespace. [.console-input] [#camel-k-watch-camelsources] [source,bash,subs="+quotes,+attributes,+macros"] ---- -watch kubectl -n {tutorial-namespace} get camelsources +kn source kamelet list -n {tutorial-namespace} ---- -When the camel source is successfully running you will see it in "READY" state `True`: +When the Kamelet is successfully running you will see it in "READY" state `True`: [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] @@ -216,7 +216,68 @@ NAME READY AGE timed-greeter True 114s ---- -Once the `timed-greeter` is ready, you will notice Knative sink `event-display` scale up to receive the events from `timed-greeter`. +The event source is configured to drain the events to `kamelet:sink`. +Now we just need to bind the Kamelet to the service `event-display` and we can do that by using a `KameletBinding`: + +.timed-greeter KameletBinding +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: timed-greeter-binding +spec: + source: + ref: #<1> + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: timed-greeter + properties: + period: 5000 + message: Welcome to Apache Camel K + sink: + uri: #<2> +---- +<1> Kubernetes reference to the previously created Kamelet. +<2> Sink the input to the URI of `event-display`. + +To find out the URI of `event-display` please run the following command: + +[.console-input] +[source,bash,subs="+quotes,+attributes,+macros"] +---- +kn service describe event-display -o url -n {tutorial-namespace} +---- + +Copy and paste somewhere the value of the URL as you will use it to customize the KameletBinding definition: + +[.console-input] +[source,bash,subs="+quotes,+attributes,+macros"] +---- +kubectl create -f advanced/camel-k/get-started/timed-greeter-binding.yaml --edit -o yaml -n {tutorial-namespace} +---- + +The previous command let's you edit the definition of the KameletBinding with your URL and once you save it, +Kubernetes will create an object based on it. + +You can validate the state of your KameletBinding using: + +[.console-input] +[source,bash,subs="+quotes,+attributes,+macros"] +---- +kn source kamelet binding list -n {tutorial-namespace} +---- + +You should see an output stating it reached `Ready` state: + +[.console-output] +[source,bash,subs="+quotes,+attributes,+macros"] +---- +NAME PHASE AGE CONDITIONS READY REASON +timed-greeter-binding Ready 45m 1 OK / 1 True +---- + +Once the `timed-greeter` and `timed-greeter-binding` are ready, you will notice Knative sink `event-display` scale up to receive the events from `timed-greeter`. .CamelSource `timed-greeter` pod and event-display pod [.console-output] @@ -243,16 +304,17 @@ The `stern` command above should show the following output: [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -event-... user-container id: ID-timed-greeter-m4chq-7cbf4ddc66-kxpqd-1577072133461-0-19 -event-... user-container time: 2019-12-23T03:37:03.432Z -event-... user-container Data, -event-... user-container WELCOME TO APACHE CAMEL K event-... user-container ☁️ cloudevents.Event event-... user-container Validation: valid event-... user-container Context Attributes, -event-... user-container specversion: 0.3 +event-... user-container specversion: 1.0 event-... user-container type: org.apache.camel.event -event-... user-container source: camel-source:knativetutorial/timed-greeter +event-... user-container source: source +event-... user-container id: 3304E164DD1D7E1-0000000000000003 +event-... user-container time: 2022-01-31T17:40:01.752Z +event-... user-container datacontenttype: text/plain +event-... user-container Data, +event-... user-container WELCOME TO APACHE CAMEL K ---- [#cleanup] @@ -263,7 +325,8 @@ event-... user-container source: camel-source:knativetutorial/timed-greeter [source,bash,subs="+quotes,+attributes,+macros"] ---- $TUTORIAL_HOME/bin/clean-completed.sh -kubectl -n {tutorial-namespace} delete camelsource timed-greeter +kubectl delete kameletbinding.camel.apache.org/timed-greeter-binding -n {tutorial-namespace} +kubectl delete kamelet.camel.apache.org/timed-greeter -n {tutorial-namespace} ---- After few seconds you will see the `event-display` Knative Service scaling down to zero since it no longer receives events via the event source. diff --git a/documentation/modules/camelk/pages/setup.adoc b/documentation/modules/camelk/pages/setup.adoc index 7166c512..943739f8 100644 --- a/documentation/modules/camelk/pages/setup.adoc +++ b/documentation/modules/camelk/pages/setup.adoc @@ -1,11 +1,10 @@ -= Page Title +[#camelk-setup] += Setup include::_attributes.adoc[] -[#camelk-setup] -== Setup [#install-camel-k] -=== Install Apache Camel K +== Install Apache Camel K Download the latest Apache Camel K release from https://github.com/apache/camel-k/releases/latest[here]. Extract the content and add the binary `kamel` to the PATH. @@ -71,7 +70,7 @@ In OpenShift, the `kamel install` command will not install Camel K operator in e ==== [#configure-maven-repo] -=== Configure Camel K to build faster +== Configure Camel K to build faster Camel K uses https://maven.apache.org[Apache Maven] to build the integration kits and its related containers. The Apache Maven settings for Camel K are stored in a ConfigMap `camel-k-maven-settings` in the {tutorial-namespace} namespace. One of the ways to make the build faster is by using a maven repository manager such as https://www.sonatype.com/nexus-repository-oss[Sonatype Nexus], the repository manager helps in caching the maven artifacts from remote repositories and serves them from local the subsequent times they are asked to be downloaded. @@ -101,7 +100,7 @@ kamel install --force \#<.> <.> `--force` is used to update any existing `Camel K` installs to use the new settings -=== Deploy Nexus to Local Cluster (Optional) +== Deploy Nexus to Local Cluster (Optional) If you don't have a https://www.sonatype.com/download-oss-sonatype[Sonatype Nexus Repository^,role="ext-link"], you can deploy one into the cluster using the deployment `$TUTORIAL_HOME/install/utils/nexus/app.yaml`. diff --git a/documentation/modules/eventing/examples/eventing/trigger-helloaloha.yaml b/documentation/modules/eventing/examples/eventing/trigger-helloaloha.yaml index a6204b81..6ae26164 100644 --- a/documentation/modules/eventing/examples/eventing/trigger-helloaloha.yaml +++ b/documentation/modules/eventing/examples/eventing/trigger-helloaloha.yaml @@ -3,9 +3,10 @@ kind: Trigger metadata: name: helloaloha spec: + broker: default filter: attributes: - type: greeting + type: aloha subscriber: ref: apiVersion: serving.knative.dev/v1 diff --git a/documentation/modules/eventing/examples/eventing/trigger-hellobonjour.yaml b/documentation/modules/eventing/examples/eventing/trigger-hellobonjour.yaml index ea01ba25..6feab707 100644 --- a/documentation/modules/eventing/examples/eventing/trigger-hellobonjour.yaml +++ b/documentation/modules/eventing/examples/eventing/trigger-hellobonjour.yaml @@ -6,7 +6,7 @@ spec: broker: default filter: attributes: - type: greeting + type: bonjour subscriber: ref: apiVersion: serving.knative.dev/v1 diff --git a/documentation/modules/eventing/pages/_partials/deploy-knative-resources.adoc b/documentation/modules/eventing/pages/_partials/deploy-knative-resources.adoc index 5bfd9bdc..a1a6d781 100644 --- a/documentation/modules/eventing/pages/_partials/deploy-knative-resources.adoc +++ b/documentation/modules/eventing/pages/_partials/deploy-knative-resources.adoc @@ -10,8 +10,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn broker create default \ - --namespace {tutorial-namespace} +kn broker create default ---- #end::broker[] @@ -20,7 +19,6 @@ kn broker create default \ [source,bash,subs="+macros,+attributes"] ---- kn service create eventinghello \ - --namespace {tutorial-namespace} \ --concurrency-target=1 \ --image=quay.io/rhdevelopers/eventinghello:0.0.2 ---- @@ -31,7 +29,6 @@ kn service create eventinghello \ [source,bash,subs="+macros,+attributes"] ---- kn service create {sink-service-name} \ - --namespace {tutorial-namespace} \ --concurrency-target=1 \ --revision-name={revision-name} \ --image=quay.io/rhdevelopers/eventinghello:0.0.2 @@ -43,7 +40,6 @@ kn service create {sink-service-name} \ [source,bash,subs="+macros,+attributes"] ---- kn source ping create eventinghello-ping-source \ - --namespace {tutorial-namespace} \ --schedule "*/2 * * * *" \ --data pass:['{"message": "Thanks for doing Knative Tutorial"}'] \ --sink ksvc:eventinghello @@ -54,8 +50,7 @@ kn source ping create eventinghello-ping-source \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn channel create {channel-name} \ - --namespace {tutorial-namespace} +kn channel create {channel-name} ---- #end::channel[] @@ -63,9 +58,7 @@ kn channel create {channel-name} \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping create \ - event-greeter-ping-source \ - --namespace {tutorial-namespace} \ +kn source ping create event-greeter-ping-source \ --schedule "*/2 * * * *" \ --sink channel:eventinghello-ch ---- @@ -74,9 +67,7 @@ kn source ping create \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn subscription create \ - eventinghelloa-sub \ - --namespace {tutorial-namespace} \ +kn subscription create eventinghelloa-sub \ --channel eventinghello-ch \ --sink eventinghelloa ---- @@ -85,9 +76,7 @@ kn subscription create \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn subscription create \ - eventinghellob-sub \ - --namespace {tutorial-namespace} \ +kn subscription create eventinghellob-sub \ --channel eventinghello-ch \ --sink eventinghellob ---- @@ -97,10 +86,9 @@ kn subscription create \ [source,bash,subs="+macros,+attributes"] ---- kn trigger create {trigger-name} \ - --namespace {tutorial-namespace} \ --broker=default \ --sink=ksvc:{trigger-sub-name} \ - --filter=type=greeting + --filter=type={trigger-event} ---- #end::eventing-trigger-sub[] #tag::tab-2[] @@ -111,7 +99,7 @@ kn trigger create {trigger-name} \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -{kubernetes-cli} apply -n {tutorial-namespace} -f link:{github-repo}/{eventing-repo}/{service-file}[pass:[${TUTORIAL_HOME}]/{eventing-repo}/{service-file}] +{kubernetes-cli} apply -f link:{github-repo}/{eventing-repo}/{service-file}[pass:[${TUTORIAL_HOME}]/{eventing-repo}/{service-file}] ---- -- ==== diff --git a/documentation/modules/eventing/pages/_partials/invoke-service.adoc b/documentation/modules/eventing/pages/_partials/invoke-service.adoc index 2d36662f..d4fa3110 100644 --- a/documentation/modules/eventing/pages/_partials/invoke-service.adoc +++ b/documentation/modules/eventing/pages/_partials/invoke-service.adoc @@ -27,7 +27,7 @@ copyToClipboard::{doc-sec}-{k8s-cli}-svc-call[] [#{doc-sec}-{k8s-env}-{k8s-cli}-svc-call] [source,bash,subs="+macros,+attributes"] ---- -export SVC_URL=`oc get rt greeter -o yaml | yq read - 'status.url'` && \ +export SVC_URL=`oc get rt greeter -o jsonpath={.status.url} && \ http $SVC_URL ---- @@ -40,7 +40,7 @@ copyToClipboard::{doc-sec}-{k8s-env}-{k8s-cli}-svc-call[] [#{doc-sec}-{k8s-cli}-svc-call-params] [source,bash,subs="+macros,+attributes"] ---- -export SVC_URL=`oc get rt greeter -o yaml | yq read - 'status.url'` && \ +export SVC_URL=`oc get rt greeter -o jsonpath={.status.url} && \ http $SVC_URL/{svc-params} ---- diff --git a/documentation/modules/eventing/pages/_partials/knative-objects.adoc b/documentation/modules/eventing/pages/_partials/knative-objects.adoc index 3877f76a..cf67a589 100644 --- a/documentation/modules/eventing/pages/_partials/knative-objects.adoc +++ b/documentation/modules/eventing/pages/_partials/knative-objects.adoc @@ -7,7 +7,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn broker -n {tutorial-namespace} list +kn broker list ---- [.console-output] @@ -44,7 +44,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn channel list --namespace {tutorial-namespace} +kn channel list ---- [.console-output] @@ -60,7 +60,7 @@ eventinghello-ch InMemoryChannel http://eventinghello-ch-kn-channel.knativet [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl get --namespace {tutorial-namespace} channels.messaging.knative.dev eventinghello-ch +kubectl get channels.messaging.knative.dev eventinghello-ch ---- [.console-output] @@ -82,7 +82,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping --namespace {tutorial-namespace} list +kn source ping list ---- [.console-output] @@ -99,7 +99,7 @@ event-greeter-ping-source */2 * * * * Channel:eventinghello-ch 10m 4 OK [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl get --namespace {tutorial-namespace} pingsource.sources.knative.dev event-greeter-ping-source +kubectl get pingsource.sources.knative.dev event-greeter-ping-source ---- [.console-output] @@ -121,7 +121,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn subscription list --namespace {tutorial-namespace} +kn subscription list ---- [.console-output] @@ -138,7 +138,7 @@ eventinghellob-sub Channel:eventinghello-ch ksvc:eventinghellob [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get subscriptions.messaging.knative.dev +kubectl get subscriptions.messaging.knative.dev ---- [.console-output] @@ -162,7 +162,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service --namespace {tutorial-namespace} list +kn service list ---- -- {kubernetes-cli}:: @@ -171,7 +171,7 @@ kn service --namespace {tutorial-namespace} list [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get service.serving.knative.dev eventinghello +kubectl get service.serving.knative.dev eventinghello ---- -- ==== @@ -187,7 +187,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn trigger list --namespace {tutorial-namespace} +kn trigger list ---- [.console-output] @@ -204,7 +204,7 @@ hellobonjour default ksvc:eventingbonjour 11m 5 OK / 5 True [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get triggers.eventing.knative.dev +kubectl get triggers.eventing.knative.dev ---- [.console-output] @@ -229,7 +229,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping --namespace {tutorial-namespace} list +kn source ping list ---- -- {kubernetes-cli}:: @@ -238,7 +238,7 @@ kn source ping --namespace {tutorial-namespace} list [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get containersources.sources.knative.dev heartbeat-event-source +kubectl get containersources.sources.knative.dev heartbeat-event-source ---- -- ==== diff --git a/documentation/modules/eventing/pages/channel-and-subscribers.adoc b/documentation/modules/eventing/pages/channel-and-subscribers.adoc index 4d8327ca..474feb57 100644 --- a/documentation/modules/eventing/pages/channel-and-subscribers.adoc +++ b/documentation/modules/eventing/pages/channel-and-subscribers.adoc @@ -45,7 +45,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn channel list -n {tutorial-namespace} +kn channel list ---- -- {kubernetes-cli}:: @@ -54,8 +54,7 @@ kn channel list -n {tutorial-namespace} [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} get \ - channels.messaging.knative.dev +kubectl get channels.messaging.knative.dev ---- -- ==== @@ -112,7 +111,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping -n {tutorial-namespace} list +kn source ping list ---- Running the above command should return the following result: @@ -131,7 +130,7 @@ kubectl:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} get pingsource.sources.knative.dev +kubectl get pingsource.sources.knative.dev ---- Running the above command should return the following result: @@ -270,7 +269,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn subscription -n {tutorial-namespace} list +kn subscription list ---- Running the above command should return the following result: @@ -289,8 +288,7 @@ eventinghellob-sub Channel:eventinghello-ch ksvc:eventinghellob [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} \ - get subscription.messaging.knative.dev +kubectl get subscription.messaging.knative.dev ---- Running the above command should return the following result: @@ -349,12 +347,12 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service delete -n {tutorial-namespace} eventinghelloa -kn subscription delete eventinghelloa-sub --namespace {tutorial-namespace} -kn service delete -n {tutorial-namespace} eventinghellob -kn subscription delete eventinghellob-sub --namespace {tutorial-namespace} -kn source ping delete -n {tutorial-namespace} event-greeter-ping-source -kn channel delete -n {tutorial-namespace} eventinghello-ch +kn service delete eventinghelloa +kn subscription delete eventinghelloa-sub +kn service delete eventinghellob +kn subscription delete eventinghellob-sub +kn source ping delete event-greeter-ping-source +kn channel delete eventinghello-ch ---- -- {kubernetes-cli}:: @@ -363,12 +361,12 @@ kn channel delete -n {tutorial-namespace} eventinghello-ch [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} delete -f eventing-helloa-sink.yaml -kubectl -n {tutorial-namespace} delete -f eventing-helloa-sub.yaml -kubectl -n {tutorial-namespace} delete -f eventing-hellob-sink.yaml -kubectl -n {tutorial-namespace} delete -f eventing-hellob-sub.yaml -kubectl -n {tutorial-namespace} delete -f event-source.yaml -kubectl -n knativetutorial delete -f channel.yaml +kubectl delete -f eventing-helloa-sink.yaml +kubectl delete -f eventing-helloa-sub.yaml +kubectl delete -f eventing-hellob-sink.yaml +kubectl delete -f eventing-hellob-sub.yaml +kubectl delete -f event-source.yaml +kubectl delete -f channel.yaml ---- -- ==== diff --git a/documentation/modules/eventing/pages/eventing-src-to-sink.adoc b/documentation/modules/eventing/pages/eventing-src-to-sink.adoc index 47d5e1cf..4fc065e4 100644 --- a/documentation/modules/eventing/pages/eventing-src-to-sink.adoc +++ b/documentation/modules/eventing/pages/eventing-src-to-sink.adoc @@ -24,11 +24,11 @@ kubectl api-resources --api-group='sources.knative.dev' [.console-output] [source,bash] ---- -NAME APIGROUP NAMESPACED KIND -apiserversources sources.knative.dev true ApiServerSource -containersources sources.knative.dev true ContainerSource -pingsources sources.knative.dev true PingSource -sinkbindings sources.knative.dev true SinkBinding +NAME SHORTNAMES APIVERSION NAMESPACED KIND +apiserversources sources.knative.dev/v1 true ApiServerSource +containersources sources.knative.dev/v1 true ContainerSource +pingsources sources.knative.dev/v1 true PingSource +sinkbindings sources.knative.dev/v1 true SinkBinding ---- Let's see how a simple source, the *PingSource* looks like : @@ -125,7 +125,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping list -n {tutorial-namespace} +kn source ping list ---- Running the above command should return the following result: @@ -134,7 +134,7 @@ Running the above command should return the following result: [source,bash] ---- NAME SCHEDULE SINK AGE CONDITIONS READY REASON -eventinghello-ping-source */2 * * * * ksvc:eventinghello 99s 4 OK / 4 True +eventinghello-ping-source */2 * * * * ksvc:eventinghello 9s 3 OK / 3 True ---- -- @@ -144,8 +144,7 @@ eventinghello-ping-source */2 * * * * ksvc:eventinghello 99s 4 OK / 4 [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} get \ - pingsources.sources.knative.dev \ +kubectl get pingsources.sources.knative.dev \ eventinghello-ping-source ---- @@ -172,16 +171,16 @@ stern eventinghello -c user-container -n {tutorial-namespace} [source,bash,subs="quotes"] ---- ... -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,427 INFO [eventing-hello] (executor-thread-1) ce-id=4b59c201-56a3-4189-b042-4246d3f33504 -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-source=/apis/v1/namespaces/user2-knativetutorial/pingsources/eventinghello-ping-source -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-specversion=1.0 -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-time=2021-01-28T08:14:00.000224506Z -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) ce-type=dev.knative.sources.ping -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) content-type=application/json -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) content-length=47 -#eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) POST:{"message":"Thanks for doing Knative Tutorial"}# -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container I> No access restrictor found, access to any MBean is allowed -eventinghello-2m4hn-deployment-c8f4f6758-qrjm6 user-container Jolokia: Agent started with URL https://10.129.4.97:8778/jolokia/ +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,427 INFO [eventing-hello] (executor-thread-1) ce-id=4b59c201-56a3-4189-b042-4246d3f33504 +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-source=/apis/v1/namespaces/user2-knativetutorial/pingsources/eventinghello-ping-source +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-specversion=1.0 +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,501 INFO [eventing-hello] (executor-thread-1) ce-time=2021-01-28T08:14:00.000224506Z +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) ce-type=dev.knative.sources.ping +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) content-type=application/json +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) content-length=47 +#eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container 2021-01-28 08:14:05,502 INFO [eventing-hello] (executor-thread-1) POST:{"message":"Thanks for doing Knative Tutorial"}# +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container I> No access restrictor found, access to any MBean is allowed +eventinghello-00001-deployment-c8f4f6758-qrjm6 user-container Jolokia: Agent started with URL https://10.129.4.97:8778/jolokia/ ---- @@ -196,8 +195,8 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn source ping delete -n {tutorial-namespace} eventinghello-ping-source -kn service delete -n {tutorial-namespace} eventinghello +kn source ping delete eventinghello-ping-source +kn service delete eventinghello ---- -- {kubernetes-cli}:: @@ -206,8 +205,8 @@ kn service delete -n {tutorial-namespace} eventinghello [.console-input] [source,bash,subs="+macros,+attributes"] ---- -{kubernetes-cli} -n {tutorial-namespace} delete -f pass:[${TUTORIAL_HOME}]/eventing/eventinghello-source.yaml -{kubernetes-cli} -n {tutorial-namespace} delete -f pass:[${TUTORIAL_HOME}]/eventing/eventing-hello-sink.yaml +{kubernetes-cli} delete -f pass:[${TUTORIAL_HOME}]/eventing/eventinghello-source.yaml +{kubernetes-cli} delete -f pass:[${TUTORIAL_HOME}]/eventing/eventing-hello-sink.yaml ---- -- ==== diff --git a/documentation/modules/eventing/pages/eventing-trigger-broker.adoc b/documentation/modules/eventing/pages/eventing-trigger-broker.adoc index 08ebe173..058d69b3 100644 --- a/documentation/modules/eventing/pages/eventing-trigger-broker.adoc +++ b/documentation/modules/eventing/pages/eventing-trigger-broker.adoc @@ -83,7 +83,7 @@ spec: broker: default filter: attributes: - type: greeting # <1> + type: aloha # <1> subscriber: ref: apiVersion: serving.knative.dev/v1 @@ -98,12 +98,14 @@ Now create the the trigger for `eventingaloha` that will associate the filtered :service-file: trigger-helloaloha.yaml :trigger-name: helloaloha :trigger-sub-name: eventingaloha +:trigger-event: aloha === Create Aloha Trigger include::eventing:partial$deploy-knative-resources.adoc[tags=tab-1;eventing-trigger-sub;tab-2] :service-file: trigger-hellobonjour.yaml :trigger-name: hellobonjour :trigger-sub-name: eventingbonjour +:trigger-event: bonjour === Create Bonjour Trigger Now create the the trigger for `eventingbonjour` that will associate the filtered events to a service: @@ -221,12 +223,12 @@ Exec into the `curler` pod: kubectl -n {tutorial-namespace} exec -it curler -- /bin/bash ---- -Using the `curler` pod's shell, curl the subcriberURI for eventingaloha: +Using the `curler` pod's shell, curl the broker URI for eventingaloha: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -curl -v "http://eventingaloha.{tutorial-namespace}.svc.cluster.local" \ +curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \ -X POST \ -H "Ce-Id: say-hello" \ -H "Ce-Specversion: 1.0" \ @@ -255,12 +257,12 @@ curler 1/1 Running 59s eventingaloha-1-deployment-6cdc888d9d-9xnnn 2/2 Running 30s ----- -Next, curl the subcriberURI for `eventingbonjour`: +Next, curl the broker URI for `eventingbonjour`: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -curl -v "http://eventingbonjour.{tutorial-namespace}.svc.cluster.local" \ +curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \ -X POST \ -H "Ce-Id: say-hello" \ -H "Ce-Specversion: 1.0" \ @@ -286,52 +288,14 @@ The command above should show the following output: ----- NAME READY STATUS AGE curler 1/1 Running 82s -eventingaloha-1-deployment-6cdc888d9d-9xnnn 2/2 Running 53s eventingbonjour-1-deployment-fc7858b5b-s9prj 2/2 Running 5s ----- -Now, trigger both `eventingaloha` and `eventingbonjour` by curling the subcriberURI for the broker: - -[#trigger-verify-trigger-all] -[.console-input] -[source,bash,subs="+macros,+attributes"] ----- -curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \ --X POST \ --H "Ce-Id: say-hello" \ --H "Ce-Specversion: 1.0" \ --H "Ce-Type: greeting" \ --H "Ce-Source: mycurl" \ --H "Content-Type: application/json" \ --d '{"key":"from a curl"}' ----- - -[NOTE] -==== -"Ce-Type: greeting" is the key to insuring that both aloha and bonjour respond to this event -==== - -And by watching the *{tutorial-namespace}* namespace, you will see both `eventingaloha` and `eventingbonjour` will come to life: - -[#trigger-watch-all-scale] -[.console-input] -[source,bash,subs="+macros,+attributes"] ------ -watch kubectl get pods ------ - -The command above should show the following output: - -[.console-output] -[source,bash] ------ -NAME READY STATUS AGE -curler 1/1 Running 3m21s -eventingaloha-1-deployment-6cdc888d9d-nlpm8 2/2 Running 6s -eventingbonjour-1-deployment-fc7858b5b-btdcr 2/2 Running 6s ------ +In the previous examples you sent to the broker a payload configured with `Ce-Type: aloha` or `Ce-Type: bonjour`. +Each trigger filtered the incoming message and sent it to the configured Sink Service in case of a match. -You can experiment by using different type filters in the Subscription to see how the different subscribed services respond. `Filters` may use an link:https://cloudevents.io/[CloudEvent] attribute for its criteria. +You can experiment by using different type filters in the Subscription to see how the different subscribed services respond. +`Filters` may use an link:https://cloudevents.io/[CloudEvent] attribute for its criteria. [#eventing-cleanup] == Cleanup @@ -344,12 +308,12 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service delete eventingbonjour -n {tutorial-namespace} -kn service delete eventingaloha -n {tutorial-namespace} -kn trigger delete helloaloha -n {tutorial-namespace} -kn trigger delete hellobonjour -n {tutorial-namespace} -kubectl -n {tutorial-namespace} delete pod curler -kn broker delete default -n {tutorial-namespace} +kn service delete eventingbonjour +kn service delete eventingaloha +kn trigger delete helloaloha +kn trigger delete hellobonjour +kubectl delete pod curler +kn broker delete default ---- -- {kubernetes-cli}:: @@ -358,12 +322,12 @@ kn broker delete default -n {tutorial-namespace} [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} delete -f eventing-aloha-sink.yaml -kubectl -n {tutorial-namespace} delete -f eventing-bonjour-sink.yaml -kubectl -n {tutorial-namespace} delete -f trigger-helloaloha.yaml -kubectl -n {tutorial-namespace} delete -f trigger-hellobonjour.yaml -kubectl -n {tutorial-namespace} delete -f curler.yaml -kubectl -n knativetutorial delete -f default-broker.yaml +kubectl delete -f eventing-aloha-sink.yaml +kubectl delete -f eventing-bonjour-sink.yaml +kubectl delete -f trigger-helloaloha.yaml +kubectl delete -f trigger-hellobonjour.yaml +kubectl delete -f curler.yaml +kubectl delete -f default-broker.yaml ---- -- ==== diff --git a/documentation/modules/serving/pages/_partials/deploy-knative-resources.adoc b/documentation/modules/serving/pages/_partials/deploy-knative-resources.adoc index eed5559d..a16930d0 100644 --- a/documentation/modules/serving/pages/_partials/deploy-knative-resources.adoc +++ b/documentation/modules/serving/pages/_partials/deploy-knative-resources.adoc @@ -94,7 +94,7 @@ kn service update prime-generator \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -{kubernetes-cli} apply -n {tutorial-namespace} -f link:{github-repo}/{basics-repo}/{service-file}[pass:[$TUTORIAL_HOME]/{basics-repo}/{service-file}] +{kubernetes-cli} apply -f link:{github-repo}/{basics-repo}/{service-file}[pass:[$TUTORIAL_HOME]/{basics-repo}/{service-file}] ---- -- ==== diff --git a/documentation/modules/serving/pages/_partials/invoke-service.adoc b/documentation/modules/serving/pages/_partials/invoke-service.adoc index 3f894d26..51fb38c0 100644 --- a/documentation/modules/serving/pages/_partials/invoke-service.adoc +++ b/documentation/modules/serving/pages/_partials/invoke-service.adoc @@ -11,7 +11,7 @@ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -http $(kn service describe greeter -n {tutorial-namespace} -o url) +http $(kn service describe greeter -o url) ---- #end::call[] @@ -21,7 +21,7 @@ http $(kn service describe greeter -n {tutorial-namespace} -o url) [.console-input] [source,bash,subs="+macros,+attributes"] ---- -export SVC_URL=`{kubernetes-cli} get rt greeter -o yaml | yq read - 'status.url'` && \ +export SVC_URL=`{kubernetes-cli} get rt greeter -o jsonpath={.status.url} && \ http $SVC_URL ---- @@ -32,7 +32,7 @@ http $SVC_URL [.console-input] [source,bash,subs="+macros,+attributes"] ---- -export SVC_URL=`{kubernetes-cli} get rt greeter -o yaml | yq read - 'status.url'` && \ +export SVC_URL=`{kubernetes-cli} get rt greeter -o jsonpath={.status.url} && \ http $SVC_URL/{svc-params} ---- diff --git a/documentation/modules/serving/pages/_partials/knative-objects.adoc b/documentation/modules/serving/pages/_partials/knative-objects.adoc index 1f68bfa2..94aba6df 100644 --- a/documentation/modules/serving/pages/_partials/knative-objects.adoc +++ b/documentation/modules/serving/pages/_partials/knative-objects.adoc @@ -7,7 +7,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service list -n {tutorial-namespace} +kn service list ---- [.console-output] @@ -23,14 +23,14 @@ greeter http://greeter.{tutorial-namespace}.{minikube-nip-io} greeter-sxnzq- [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get services.serving.knative.dev greeter +kubectl get services.serving.knative.dev greeter ---- [.console-output] [source,bash,subs="+macros,+attributes"] ---- -NAME URL LATESTCREATED LATESTREADY READY REASON -greeter http://greeter.{tutorial-namespace}.{minikube-nip-io} greeter-sxnzq-1 greeter-sxnzq-1 True +NAME LATESTCREATED LATESTREADY READY REASON +greeter greeter-00001 greeter-00001 True ---- -- ==== @@ -42,7 +42,7 @@ greeter http://greeter.{tutorial-namespace}.{minikube-nip-io} greeter-sxnzq- [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get configurations.serving.knative.dev greeter +kubectl get configurations.serving.knative.dev greeter ---- #end::knative-configs[] @@ -56,14 +56,14 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn route --namespace {tutorial-namespace} list +kn route list ---- [.console-output] [source,bash,subs="+attributes"] ---- NAME URL READY -greeter http://greeter.{tutorial-namespace}.{minikube-nip-io} True +greeter http://greeter.knativetutorial.example.com True ---- -- @@ -73,7 +73,7 @@ greeter http://greeter.{tutorial-namespace}.{minikube-nip-io} True [.console-input] [source,bash,subs="+macros,+attributes"] ---- -{kubernetes-cli} --namespace {tutorial-namespace} get routes.serving.knative.dev greeter +{kubernetes-cli} get routes.serving.knative.dev greeter ---- [.console-output] @@ -96,7 +96,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn revision list --namespace {tutorial-namespace} +kn revision list ---- -- {kubernetes-cli}:: @@ -105,7 +105,7 @@ kn revision list --namespace {tutorial-namespace} [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get rev \ +kubectl get rev \ --selector=serving.knative.dev/service=greeter \ --sort-by="{.metadata.creationTimestamp}" ---- @@ -118,7 +118,7 @@ kubectl --namespace {tutorial-namespace} get rev \ [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl --namespace {tutorial-namespace} get rev \ +kubectl get rev \ -l serving.knative.dev/configuration=greeter \ --sort-by="{.metadata.creationTimestamp}" ---- diff --git a/documentation/modules/serving/pages/basic-fundas.adoc b/documentation/modules/serving/pages/basic-fundas.adoc index d5a87c37..64e67734 100644 --- a/documentation/modules/serving/pages/basic-fundas.adoc +++ b/documentation/modules/serving/pages/basic-fundas.adoc @@ -48,7 +48,7 @@ After successful deployment of the service we should see a Kubernetes Deployment [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl get deployments -n {tutorial-namespace} +kubectl get deployments ---- NOTE: The actual deployment name may vary in your setup @@ -114,8 +114,8 @@ include::serving:partial$knative-objects.adoc[tag=knative-configs] [.console-output] [source,bash] ---- -NAME LATESTCREATED LATESTREADY READY -greeter greeter-sxnzq-1 greeter-sxnzq-1 True +NAME LATESTCREATED LATESTREADY READY REASON +greeter greeter-00001 greeter-00001 True ---- [#basics-show-knative-routes] @@ -131,8 +131,8 @@ include::serving:partial$knative-objects.adoc[tag=knative-revisions] [.console-output] [source,bash] ---- -NAME CONFIG NAME K8S SERVICE NAME GENERATION READY -greeter-sxnzq-1 greeter greeter-sxnzq-1 1 True +NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON +greeter-00001 greeter 100% 1 9m37s 3 OK / 4 True ---- [TIP] @@ -150,7 +150,7 @@ kn:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service -n {tutorial-namespace} delete greeter +kn service delete greeter ---- -- {kubernetes-cli}:: @@ -159,7 +159,7 @@ kn service -n {tutorial-namespace} delete greeter [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kubectl -n {tutorial-namespace} delete services.serving.knative.dev greeter +kubectl delete services.serving.knative.dev greeter ---- -- ==== diff --git a/documentation/modules/serving/pages/knative-client.adoc b/documentation/modules/serving/pages/knative-client.adoc index c98dd21b..f5dc4e5d 100644 --- a/documentation/modules/serving/pages/knative-client.adoc +++ b/documentation/modules/serving/pages/knative-client.adoc @@ -38,14 +38,14 @@ The above command will return a response like [.console-output] ---- Version: {kn-client-version} -Build Date: 2020-11-25 18:27:45 -Git Revision: f128d045 +Build Date: 2021-12-14T12:31:50Z +Git Revision: 530841f1 Supported APIs: * Serving - - serving.knative.dev/v1 (knative-serving v0.19.0) + - serving.knative.dev/v1 (knative-serving ) * Eventing - - sources.knative.dev/v1alpha2 (knative-eventing v0.19.0) - - eventing.knative.dev/v1beta1 (knative-eventing v0.19.0) + - sources.knative.dev/v1 (knative-eventing ) + - eventing.knative.dev/v1 (knative-eventing ) ---- [#kn-ksvc] @@ -134,8 +134,7 @@ In previous chapter we deployed a new revision of Knative service by adding an e [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn service update greeter --namespace {tutorial-namespace} \ - --env "MESSAGE_PREFIX=Namaste" +kn service update greeter --env "MESSAGE_PREFIX=Namaste" ---- [.console-output] @@ -169,7 +168,7 @@ Sometime you wish you get the YAML of the Knative service to build a new service [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn service describe --namespace {tutorial-namespace} greeter +kn service describe greeter ---- The describe should show you a short summary of your service : @@ -200,7 +199,7 @@ To list all the revisions as part of the `describe` command use: [.console-input] [source,subs="+macros,attributes+"] ---- -kn service describe --namespace {tutorial-namespace} greeter -v +kn service describe greeter -v ---- [.console-output] [source,text,subs="+quotes,+macros,attributes+"] @@ -234,7 +233,7 @@ To get the Knative service url use `describe` with `-o url` option: [.console-input] [source,bash,subs="attributes+"] ---- -kn service describe --namespace {tutorial-namespace} greeter -o url +kn service describe greeter -o url ---- [.console-output] @@ -256,16 +255,15 @@ You can list the available revisions of a Knative service using: [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn revision list --namespace {tutorial-namespace} +kn revision list ---- [.console-output] [source,bash] ---- -NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON -greeter-tjtpm-2 greeter 100% 2 98s 4 OK / 4 True -greeter-twpgf-1 greeter 1 11h 3 OK / 4 True - +NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON +greeter-00002 greeter 100% 2 3m37s 3 OK / 4 True +greeter-00001 greeter 1 16m 3 OK / 4 True ---- [#kn-revisions-desc] @@ -277,25 +275,25 @@ To get the details about a specific revision you can use the command: [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn revision describe --namespace {tutorial-namespace} greeter-twpgf-1 +kn revision describe greeter-00001 ---- [.console-output] [source,bash] ---- -Name: greeter-twpgf-1 +Name: greeter-00001 Namespace: knativetutorial -Age: 10m +Age: 17m Image: quay.io/rhdevelopers/knative-tutorial-greeter:quarkus (pinned to 767e2f) +Replicas: 0/0 Service: greeter Conditions: OK TYPE AGE REASON - ++ Ready 9m - ++ ContainerHealthy 9m - ++ ResourcesAvailable 9m - I Active 8m NoTraffic - + ++ Ready 17m + ++ ContainerHealthy 17m + ++ ResourcesAvailable 17m + I Active 16m NoTraffic ---- [#kn-revisions-delete] @@ -306,13 +304,13 @@ To delete a specific revision you can use the command: [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn revision delete --namespace {tutorial-namespace} greeter-twpgf-1 +kn revision delete greeter-00001 ---- [.console-output] [source,bash] ---- -Revision 'greeter-twpgf-1' successfully deleted in namespace 'knativetutorial'. +Revision 'greeter-00001' successfully deleted in namespace 'knativetutorial'. ---- [#kn-routes] @@ -344,7 +342,7 @@ You can also use `kn` to delete the service that were created, to delete the ser [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn service delete --namespace {tutorial-namespace} greeter +kn service delete greeter ---- [source,bash] diff --git a/documentation/modules/serving/pages/scaling.adoc b/documentation/modules/serving/pages/scaling.adoc index 7a91a69c..672dd0af 100644 --- a/documentation/modules/serving/pages/scaling.adoc +++ b/documentation/modules/serving/pages/scaling.adoc @@ -70,7 +70,7 @@ For better clarity and understanding let us <> the dep [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn -n {tutorial-namespace} service delete greeter +kn service delete greeter ---- :service-file: service-10.yaml @@ -114,7 +114,7 @@ We will now send some load to the greeter service. The command below sends 50 c [.console-input] [source,bash,subs="attributes+,+macros",linenums] ---- -export SVC_URL=$(kn service describe prime-generator -n{tutorial-namespace} -url) +export SVC_URL=$(kn service describe prime-generator -o url) hey -c 50 -z 10s "pass:[$SVC_URL]/?sleep=3&upto=10000&memload=100" ---- @@ -175,5 +175,5 @@ When all requests are done and if we are beyond the `scale-to-zero-grace-period` [source,bash,subs="attributes+,+macros"] [.console-input] ---- -kn service delete -n {tutorial-namespace} prime-generator +kn service delete prime-generator ---- diff --git a/documentation/modules/serving/pages/traffic-distribution.adoc b/documentation/modules/serving/pages/traffic-distribution.adoc index 052c3863..af605f9a 100644 --- a/documentation/modules/serving/pages/traffic-distribution.adoc +++ b/documentation/modules/serving/pages/traffic-distribution.adoc @@ -102,15 +102,15 @@ kn:: [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kn revision list --namespace {tutorial-namespace} +kn revision list ---- [.console-output] [source,bash] ---- NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON -blue-green-canary-yzrwq-2 blue-green-canary 100% 2 2m33s 3 OK / 4 True -blue-green-canary-xjygh-1 blue-green-canary 1 30m 3 OK / 4 True +blue-green-canary-00002 blue-green-canary 100% 2 2m33s 3 OK / 4 True +blue-green-canary-00001 blue-green-canary 1 30m 3 OK / 4 True ---- -- {kubernetes-cli}:: @@ -120,7 +120,7 @@ blue-green-canary-xjygh-1 blue-green-canary 1 30 [.console-input] [source,bash,subs="+macros,attributes+"] ---- -kubectl --namespace {tutorial-namespace} get rev \ +kubectl get rev \ --selector=serving.knative.dev/service=blue-green-canary \ --sort-by="{.metadata.creationTimestamp}" ---- @@ -129,8 +129,8 @@ kubectl --namespace {tutorial-namespace} get rev \ [source,bash] ---- NAME CONFIG NAME K8S SERVICE NAME GENERATION READY REASON -blue-green-canary-xjygh-1 blue-green-canary blue-green-canary-xjygh-1 1 True -blue-green-canary-yzrwq-2 blue-green-canary blue-green-canary-yzrwq-2 2 True +blue-green-canary-00001 blue-green-canary blue-green-canary-00001 1 True +blue-green-canary-00002 blue-green-canary blue-green-canary-00002 2 True ---- -- ==== @@ -144,7 +144,7 @@ video::KAeDG4j5fr8[youtube,width=640,height=480] [#tag-service-revisions] == Tag Revisions -As you had observed that the Knative service `blue-green-canary` now has two revisions namely *blue-green-canary-xjygh-1* and *blue-green-canary-yzrwq-2*. As the Revision names are autogenerated it is hard to comprehend to which code/configuration set it corresponds to. To overcome this problem Knative provides *tagging* of revision names that allows one to tag a revision name to a logical human understanable names called *tags*. +As you had observed that the Knative service `blue-green-canary` now has two revisions namely *blue-green-canary-00001* and *blue-green-canary-00002*. As the Revision names are autogenerated it is hard to comprehend to which code/configuration set it corresponds to. To overcome this problem Knative provides *tagging* of revision names that allows one to tag a revision name to a logical human understanable names called *tags*. As our colors service shows different colors on the browser let us tag the revisions with color, @@ -160,20 +160,20 @@ kn revision list -s blue-green-canary [source,bash] ---- NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON -blue-green-canary-yzrwq-2 blue-green-canary 100% 2 23m 3 OK / 4 True -blue-green-canary-xjygh-1 blue-green-canary 1 51m 3 OK / 4 True +blue-green-canary-00002 blue-green-canary 100% 2 23m 3 OK / 4 True +blue-green-canary-00001 blue-green-canary 1 51m 3 OK / 4 True ---- When Knative rolls out a new revision, it increments the `GENERATION` by *1* and then routes *100%* of the `TRAFFIC` to it, hence we can use the `GENERATION` or `TRAFFIC` to identify the latest reivsion. === Tag Blue -Let us tag `blue-green-canary-xjygh-1` which shows *blue* browser page with tag name `blue`. +Let us tag `blue-green-canary-00001` which shows *blue* browser page with tag name `blue`. [.console-input] [source,bash,subs="+macros,attributes+,+quotes"] ---- -kn service update -n {tutorial-namespace} blue-green-canary --tag=#blue-green-canary-xjygh-1#=blue +kn service update blue-green-canary --tag=#blue-green-canary-00001#=blue ---- [.console-output] @@ -186,18 +186,18 @@ Updating Service 'blue-green-canary' in namespace 'knativetutorial': 0.162s Waiting for load balancer to be ready 0.303s Ready to serve. -Service 'blue-green-canary' with latest revision 'blue-green-canary-yzrwq-2' (unchanged) is available at URL: +Service 'blue-green-canary' with latest revision 'blue-green-canary-00002' (unchanged) is available at URL: http://blue-green-canary.knativetutorial.192.168.64.13.nip.io ---- === Tag Green -Let us tag `blue-green-canary-yzrwq-2` which shows *green* browser page with tag name `green`. +Let us tag `blue-green-canary-00002` which shows *green* browser page with tag name `green`. [.console-input] [source,bash,subs="+macros,attributes+,+quotes"] ---- -kn service update -n {tutorial-namespace} blue-green-canary --tag=#blue-green-canary-yzrwq-2#=green +kn service update blue-green-canary --tag=#blue-green-canary-00002#=green ---- [.console-output] @@ -210,7 +210,7 @@ Updating Service 'blue-green-canary' in namespace 'knativetutorial': 0.162s Waiting for load balancer to be ready 0.303s Ready to serve. -Service 'blue-green-canary' with latest revision 'blue-green-canary-yzrwq-2' (unchanged) is available at URL: +Service 'blue-green-canary' with latest revision 'blue-green-canary-00002' (unchanged) is available at URL: http://blue-green-canary.knativetutorial.192.168.64.13.nip.io ---- @@ -221,7 +221,7 @@ Lets tag whatever revision that is latest to be tagged as *latest*. [.console-input] [source,bash,subs="+macros,attributes+,+quotes"] ---- -kn service update -n {tutorial-namespace} blue-green-canary --tag=@latest=latest +kn service update blue-green-canary --tag=@latest=latest ---- [.console-output] @@ -234,7 +234,7 @@ Updating Service 'blue-green-canary' in namespace 'knativetutorial': 0.162s Waiting for load balancer to be ready 0.303s Ready to serve. -Service 'blue-green-canary' with latest revision 'blue-green-canary-yzrwq-2' (unchanged) is available at URL: +Service 'blue-green-canary' with latest revision 'blue-green-canary-00002' (unchanged) is available at URL: http://blue-green-canary.knativetutorial.192.168.64.13.nip.io ---- @@ -250,8 +250,8 @@ kn revision list -s blue-green-canary [source,bash,subs="+quotes"] ---- NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON -blue-green-canary-yzrwq-2 blue-green-canary 100% #latest,green# 2 29m 3 OK / 4 True -blue-green-canary-xjygh-1 blue-green-canary #blue# 1 57m 3 OK / 4 True +blue-green-canary-00002 blue-green-canary 100% #latest,green# 2 29m 3 OK / 4 True +blue-green-canary-00001 blue-green-canary #blue# 1 57m 3 OK / 4 True ---- As *green* happend to be latest revision it has been tagged with name `lastest` in addition to `green`. @@ -265,7 +265,7 @@ Knative offers a simple way of switching 100% of the traffic from one Knative se In this exercise you will applying the Blue/Green deployment pattern with the Knative Service called greeter. You have already deployed two <> of blue-green-canary identified using the tags `blue` and `green`. -With the deployment of *green* revison you noticed that Knative automatically started to routing 100% of the traffic to `blue-green-canary-yzrwq-2`. +With the deployment of *green* revison you noticed that Knative automatically started to routing 100% of the traffic to `blue-green-canary-00002`. Now let us assume, due to a critical bug we need to roll back `green` to `blue`. @@ -292,7 +292,7 @@ Let us list all revisions with tags: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn revision list --namespace {tutorial-namespace} +kn revision list ---- Based on the revision tags that we created earlier, the output should be like: @@ -301,8 +301,8 @@ Based on the revision tags that we created earlier, the output should be like: [source,text,subs="quotes"] ---- NAME SERVICE TRAFFIC TAGS GENERATION AGE CONDITIONS READY REASON -blue-green-canary-yzrwq-2 blue-green-canary latest,green 2 56m 4 OK / 4 True -blue-green-canary-xjygh-1 blue-green-canary #100%# #blue# 1 83m 4 OK / 4 True +blue-green-canary-00002 blue-green-canary latest,green 2 56m 4 OK / 4 True +blue-green-canary-00001 blue-green-canary #100%# #blue# 1 83m 4 OK / 4 True ---- Let us list the available sub-routes: @@ -342,8 +342,8 @@ image::blue-green-canary-blue.png[] [source,bash,subs="+quotes,+attributes,+macros"] ---- NAME READY STATUS RESTARTS AGE -#blue-green-canary-xjygh-1-deployment-54597d94b9-25x4r# 2/2 Running 0 12s -blue-green-canary-yzrwq-2-deployment-6cb545df65-ktqc2 0/2 Terminating 0 2m +#blue-green-canary-00001-deployment-54597d94b9-25x4r# 2/2 Running 0 12s +blue-green-canary-00002-deployment-6cb545df65-ktqc2 0/2 Terminating 0 2m ---- Since `blue` is the active revision now, the existing `green` pod is getting terminated as no future requests will be served by it. @@ -375,7 +375,7 @@ To roll out the greeter canary deployment use the following command: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn service update blue-green-canary -n {tutorial-namespace} \ +kn service update blue-green-canary \ --traffic="blue=80" \ --traffic="green=20" ---- @@ -398,8 +398,8 @@ watch "{kubernetes-cli} get pods -n {tutorial-namespace}" [source,bash,subs="+quotes,+attributes,+macros"] ---- NAME READY STATUS RESTARTS AGE -blue-green-canary-xjygh-1-deployment-54597d94b9-q8c57 2/2 Running 0 79s -blue-green-canary-yzrwq-2-deployment-8564bf5b5b-gtvh4 2/2 Running 0 14s +blue-green-canary-00001-deployment-54597d94b9-q8c57 2/2 Running 0 79s +blue-green-canary-00002-deployment-8564bf5b5b-gtvh4 2/2 Running 0 14s ---- [NOTE,caption=Challenge] @@ -424,6 +424,6 @@ video::5cNU6vAAbXQ[youtube,width=640,height=480] [.console-input] [source,bash,subs="+macros,+attributes"] ---- -kn -n {tutorial-namespace} service delete blue-green-canary +kn service delete blue-green-canary ---- diff --git a/documentation/modules/setup/pages/minikube.adoc b/documentation/modules/setup/pages/minikube.adoc index 8a89a217..c661a759 100644 --- a/documentation/modules/setup/pages/minikube.adoc +++ b/documentation/modules/setup/pages/minikube.adoc @@ -56,8 +56,8 @@ minikube -p {tutorial-namespace} addons enable registry [source,bash,subs="+macros,+attributes"] ---- kubectl apply \ - --filename {knative-serving-repo}/{knative-serving-version}/serving-crds.yaml \ - --filename {knative-eventing-repo}/{knative-eventing-version}/eventing-crds.yaml + --filename {knative-serving-repo}/knative-{knative-serving-version}/serving-crds.yaml \ + --filename {knative-eventing-repo}/knative-{knative-eventing-version}/eventing-crds.yaml ---- Now that you have installed the Knative Serving and Eventing CRDs, the following sections we will verify the CRDs by querying the `api-resources`. @@ -73,11 +73,12 @@ kubectl api-resources --api-group='serving.knative.dev' [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -configurations config,cfg serving.knative.dev true Configuration -revisions rev serving.knative.dev true Revision -routes rt serving.knative.dev true Route -services kservice,ksvc serving.knative.dev true Service +NAME SHORTNAMES APIVERSION NAMESPACED KIND +configurations config,cfg serving.knative.dev/v1 true Configuration +domainmappings dm serving.knative.dev/v1beta1 true DomainMapping +revisions rev serving.knative.dev/v1 true Revision +routes rt serving.knative.dev/v1 true Route +services kservice,ksvc serving.knative.dev/v1 true Service ---- All *Knative Eventing* resources will be under the one of following API groups: @@ -95,9 +96,9 @@ kubectl api-resources --api-group='messaging.knative.dev' [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -channels ch messaging.knative.dev true Channel -subscriptions sub messaging.knative.dev true Subscription +NAME SHORTNAMES APIVERSION NAMESPACED KIND +channels ch messaging.knative.dev/v1 true Channel +subscriptions sub messaging.knative.dev/v1 true Subscription ---- .eventing.knative.dev @@ -109,10 +110,10 @@ kubectl api-resources --api-group='eventing.knative.dev' [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -brokers eventing.knative.dev true Broker -eventtypes eventing.knative.dev true EventType -triggers eventing.knative.dev true Trigger +NAME SHORTNAMES APIVERSION NAMESPACED KIND +brokers eventing.knative.dev/v1 true Broker +eventtypes eventing.knative.dev/v1beta1 true EventType +triggers eventing.knative.dev/v1 true Trigger ---- .sources.knative.dev @@ -125,11 +126,11 @@ kubectl api-resources --api-group='sources.knative.dev' [source,bash,subs="+quotes,+attributes,+macros"] [.console-output] ---- -NAME SHORTNAMES APIGROUP NAMESPACED KIND -apiserversources sources.knative.dev true ApiServerSource -containersources sources.knative.dev true ContainerSource -pingsources sources.knative.dev true PingSource -sinkbindings sources.knative.dev true SinkBinding +NAME SHORTNAMES APIVERSION NAMESPACED KIND +apiserversources sources.knative.dev/v1 true ApiServerSource +containersources sources.knative.dev/v1 true ContainerSource +pingsources sources.knative.dev/v1 true PingSource +sinkbindings sources.knative.dev/v1 true SinkBinding ---- The Knative has two main infrastructure components: https://kubernetes.io/docs/concepts/architecture/controller/[controller] and https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/[webhook] helps in translating the Knative CRDs which are usually written YAML files, into Kubernetes objects like Deployment and Service. Apart from the controller and webhook, the Knative Serving and Eventing also install their respective functional components which are listed in the upcoming sections. @@ -142,7 +143,7 @@ The Knative has two main infrastructure components: https://kubernetes.io/docs/c ---- kubectl apply \ --filename \ - {knative-serving-repo}/{knative-serving-version}/serving-core.yaml + {knative-serving-repo}/knative-{knative-serving-version}/serving-core.yaml ---- Wait for the Knative Serving deployment to complete: @@ -168,11 +169,13 @@ kubectl get pods -n knative-serving [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME READY STATUS RESTARTS AGE -activator-6b49796b46-g66z2 1/1 Running 0 11m -autoscaler-7b46fcb475-cnbrm 1/1 Running 0 11m -controller-65f4f4bcb4-mrkgs 1/1 Running 0 11m -webhook-59585cb6-wqldc 1/1 Running 0 11m +NAME READY STATUS RESTARTS AGE +activator-6fb68fff7b-24bsp 1/1 Running 0 23s +autoscaler-54f48f5bb7-mvvrd 1/1 Running 0 23s +controller-66cb4b556b-n8n99 1/1 Running 0 23s +domain-mapping-66f8d5bc4c-9f9c7 1/1 Running 0 23s +domainmapping-webhook-55bdf595dd-4t4w2 1/1 Running 0 23s +webhook-6d5c77f989-lf2sm 1/1 Running 0 23s ---- [#install-kourier-ingress-gateway] @@ -183,7 +186,7 @@ webhook-59585cb6-wqldc 1/1 Running 0 11m ---- kubectl apply \ --filename \ - +https://github.com/knative/net-kourier/releases/download/+{net-kourier-version}/kourier.yaml + https://github.com/knative/net-kourier/releases/download/knative-{net-kourier-version}/kourier.yaml ---- Wait for the Ingress Gateway deployment to complete: @@ -208,7 +211,6 @@ kubectl get pods --all-namespaces -l 'app in(3scale-kourier-gateway,3scale-kouri [source,bash,subs="+quotes,+attributes,+macros"] ---- NAMESPACE NAME READY STATUS RESTARTS AGE -knative-serving 3scale-kourier-control-6f9f49f99b-q7nn4 1/1 Running 1 3d10h kourier-system 3scale-kourier-gateway-79898dffd4-qsc65 1/1 Running 1 3d10h ---- @@ -257,11 +259,10 @@ kubectl get pods -n projectcontour [.console-output] [source,bash,subs="+macros,+attributes"] ---- -AME READY STATUS RESTARTS AGE -contour-5475898957-6d9xl 1/1 Running 1 34h -contour-5475898957-h6hxb 1/1 Running 1 34h -contour-certgen-v1.10.0-x69qz 0/1 Completed 0 34h -envoy-ft8ct 2/2 Running 2 34h +NAME READY STATUS RESTARTS AGE +contour-76bb4ff6cc-8666g 1/1 Running 0 89s +contour-76bb4ff6cc-wvtpx 1/1 Running 0 89s +envoy-dszgl 2/2 Running 0 89s ---- [#configure-ingress-to-gateway] @@ -323,11 +324,11 @@ configmap/config-domain patched ---- kubectl apply \ --filename \ - {knative-eventing-repo}/{knative-eventing-version}/eventing-core.yaml \ + {knative-eventing-repo}/knative-{knative-eventing-version}/eventing-core.yaml \ --filename \ - {knative-eventing-repo}/{knative-eventing-version}/in-memory-channel.yaml \ + {knative-eventing-repo}/knative-{knative-eventing-version}/in-memory-channel.yaml \ --filename \ - {knative-eventing-repo}/{knative-eventing-version}/mt-channel-broker.yaml + {knative-eventing-repo}/knative-{knative-eventing-version}/mt-channel-broker.yaml ---- Like Knative Serving deployment, Knative Eventing deployment will also take few minutes to complete, check the status of the deployment using: @@ -356,14 +357,14 @@ kubectl get pods -n knative-eventing [.console-output] [source,bash,subs="+quotes,+attributes,+macros"] ---- -NAME READY STATUS RESTARTS AGE -eventing-controller-75b7567ddc-dp5q7 1/1 Running 0 96s -eventing-webhook-5b859fd7f-mzvbh 1/1 Running 0 96s -imc-controller-7d465bddc5-2ckww 1/1 Running 0 95s -imc-dispatcher-f64dcc94d-ztnnx 1/1 Running 0 95s -mt-broker-controller-d5f96b5b5-2xr9z 1/1 Running 0 95s -mt-broker-filter-5d994fb97f-kpm5z 1/1 Running 0 95s -mt-broker-ingress-769b458fd-ghmnc 1/1 Running 0 95s +NAME READY STATUS RESTARTS AGE +eventing-controller-56ccd89cd8-w9wmm 1/1 Running 0 26s +eventing-webhook-76b66cd56c-n2dqj 1/1 Running 0 26s +imc-controller-6c8cfbb558-zvglm 1/1 Running 0 25s +imc-dispatcher-b8bf96b6d-mpltl 1/1 Running 0 25s +mt-broker-controller-7dfb75f5cc-zv5jr 1/1 Running 0 25s +mt-broker-filter-8799894b4-fhk5z 1/1 Running 0 25s +mt-broker-ingress-685f5554c-mbpbd 1/1 Running 0 25s ---- [#create-tutorial-namespace] @@ -377,6 +378,14 @@ All the tutorial exercises will be deployed in namespace called `{tutorial-names kubectl create namespace {tutorial-namespace} ---- +In order not to worry about the namespace used, will set it up as as current context: +[.console-input] +[source,bash,subs="+macros,+attributes"] +---- +kubectl config set-context --current --namespace={tutorial-namespace} +---- + + [TIP] ===== The https://github.com/ahmetb/kubens[kubens] utility installed as part of https://github.com/ahmetb/kubectx[kubectx] allows for easy switching between Kubernetes namespaces. diff --git a/documentation/modules/setup/pages/openshift.adoc b/documentation/modules/setup/pages/openshift.adoc index af6ef175..fdeb5141 100644 --- a/documentation/modules/setup/pages/openshift.adoc +++ b/documentation/modules/setup/pages/openshift.adoc @@ -27,7 +27,7 @@ Kubernetes Version: {kubernetes-version} video::eOwJjC9u4aM[youtube,width=640,height=480] -For more information on OpenShift Servertless, consult the https://docs.openshift.com/container-platform/4.6/serverless/installing_serverless/installing-openshift-serverless.html[OpenShift^] documentation. +For more information on OpenShift Servertless, consult the https://docs.openshift.com/container-platform/4.9/serverless/install/install-serverless-operator.html[OpenShift^] documentation. **Navigate to tutorial project** diff --git a/documentation/modules/setup/pages/setup.adoc b/documentation/modules/setup/pages/setup.adoc index afc8454a..4f747dfd 100644 --- a/documentation/modules/setup/pages/setup.adoc +++ b/documentation/modules/setup/pages/setup.adoc @@ -64,9 +64,9 @@ The following CLI tools are required for running the exercises in this tutorial. | https://httpie.org/doc#windows-etc | https://github.com/rakyll/hey[hey] -| https://storage.googleapis.com/hey-release/hey_darwin_amd64[Download] -| https://storage.googleapis.com/jblabs/dist/hey_linux_v0.1.2[Download] -| https://storage.googleapis.com/jblabs/dist/hey_win_v0.1.2.exe[Download] +| `brew install hey` +| https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64[Download] +| https://hey-release.s3.us-east-2.amazonaws.com/hey_windows_amd64[Download] | watch | `brew install watch` diff --git a/eventing/curler.yaml b/eventing/curler.yaml index 65debc23..a3b42cc2 100644 --- a/eventing/curler.yaml +++ b/eventing/curler.yaml @@ -7,5 +7,5 @@ metadata: spec: containers: - name: curler - image: fedora:29 - tty: true \ No newline at end of file + image: fedora:34 + tty: true diff --git a/eventing/event-source.yaml b/eventing/event-source.yaml index deff5e8b..61cdfe4f 100644 --- a/eventing/event-source.yaml +++ b/eventing/event-source.yaml @@ -4,7 +4,7 @@ metadata: name: event-greeter-ping-source spec: schedule: "*/2 * * * *" - jsonData: '{"message": "Thanks for doing Knative Tutorial"}' + data: '{"message": "Thanks for doing Knative Tutorial"}' sink: ref: apiVersion: messaging.knative.dev/v1 diff --git a/eventing/eventinghello-source-ch.yaml b/eventing/eventinghello-source-ch.yaml index 7b0d065d..b927403d 100644 --- a/eventing/eventinghello-source-ch.yaml +++ b/eventing/eventinghello-source-ch.yaml @@ -1,12 +1,12 @@ -apiVersion: sources.eventing.knative.dev/v1alpha1 -kind: CronJobSource +apiVersion: sources.knative.dev/v1 +kind: PingSource metadata: name: my-cjs spec: - schedule: "*/2 * * * *" - data: '{"key": "from CronJobSource"}' + schedule: "*/1 * * * *" + data: '{"key": "from PingSource"}' sink: ref: - apiVersion: messaging.knative.dev/v1alpha1 + apiVersion: messaging.knative.dev/v1 kind: Channel name: eventinghello-ch diff --git a/eventing/eventinghello-source-ping.yaml b/eventing/eventinghello-source-ping.yaml index 317e4717..aa63eee2 100644 --- a/eventing/eventinghello-source-ping.yaml +++ b/eventing/eventinghello-source-ping.yaml @@ -1,10 +1,10 @@ -apiVersion: sources.eventing.knative.dev/v1alpha2 +apiVersion: sources.knative.dev/v1 kind: PingSource metadata: name: eventinghello-ping-source spec: schedule: "*/2 * * * *" - jsonData: '{"key": "every 2 mins"}' + data: '{"key": "every 2 mins"}' sink: ref: apiVersion: serving.knative.dev/v1 diff --git a/eventing/eventinghello-source.yaml b/eventing/eventinghello-source.yaml index 15566163..d565c661 100644 --- a/eventing/eventinghello-source.yaml +++ b/eventing/eventinghello-source.yaml @@ -4,7 +4,7 @@ metadata: name: eventinghello-ping-source spec: data: '{"message": "Thanks for doing Knative Tutorial"}' - schedule: '*/2 * * * *' + schedule: '*/1 * * * *' sink: ref: apiVersion: serving.knative.dev/v1 diff --git a/eventing/kafka-broker-my-cluster.yaml b/eventing/kafka-broker-my-cluster.yaml index f72164c6..2ac9efc9 100644 --- a/eventing/kafka-broker-my-cluster.yaml +++ b/eventing/kafka-broker-my-cluster.yaml @@ -1,10 +1,9 @@ -apiVersion: kafka.strimzi.io/v1beta1 +apiVersion: kafka.strimzi.io/v1beta2 kind: Kafka metadata: name: my-cluster spec: kafka: - version: 2.6.0 replicas: 1 listeners: - name: plain @@ -15,21 +14,31 @@ spec: port: 9093 type: internal tls: true + authentication: + type: tls - name: external port: 9094 type: nodeport tls: false + storage: + type: jbod + volumes: + - id: 0 + type: persistent-claim + size: 100Gi + deleteClaim: false config: offsets.topic.replication.factor: 1 transaction.state.log.replication.factor: 1 transaction.state.log.min.isr: 1 - log.message.format.version: "2.6" - storage: - type: ephemeral + default.replication.factor: 1 + min.insync.replicas: 1 zookeeper: - replicas: 3 + replicas: 1 storage: - type: ephemeral + type: persistent-claim + size: 100Gi + deleteClaim: false entityOperator: topicOperator: {} userOperator: {} \ No newline at end of file diff --git a/eventing/kafka-topic-my-topic.yaml b/eventing/kafka-topic-my-topic.yaml index ae41e3fe..d3218d78 100644 --- a/eventing/kafka-topic-my-topic.yaml +++ b/eventing/kafka-topic-my-topic.yaml @@ -1,4 +1,4 @@ -apiVersion: kafka.strimzi.io/v1alpha1 +apiVersion: kafka.strimzi.io/v1beta2 kind: KafkaTopic metadata: name: my-topic diff --git a/eventing/trigger-helloaloha.yaml b/eventing/trigger-helloaloha.yaml index 6e4e4f0c..4f807f29 100644 --- a/eventing/trigger-helloaloha.yaml +++ b/eventing/trigger-helloaloha.yaml @@ -6,7 +6,7 @@ spec: broker: default filter: attributes: - type: greeting + type: aloha subscriber: ref: apiVersion: serving.knative.dev/v1 diff --git a/eventing/trigger-hellobonjour.yaml b/eventing/trigger-hellobonjour.yaml index ea01ba25..6feab707 100644 --- a/eventing/trigger-hellobonjour.yaml +++ b/eventing/trigger-hellobonjour.yaml @@ -6,7 +6,7 @@ spec: broker: default filter: attributes: - type: greeting + type: bonjour subscriber: ref: apiVersion: serving.knative.dev/v1 diff --git a/site.yml b/site.yml index 031b8f1b..99065aea 100644 --- a/site.yml +++ b/site.yml @@ -9,26 +9,26 @@ site: content: sources: - url: git@github.com:redhat-developer-demos/knative-tutorial.git - tags: v1.13.4 + tags: v1.18 branches: [] start_path: documentation asciidoc: attributes: tutorial-namespace: knativetutorial - branch: v1.13.4 + branch: v1.18 workshop-domain: guru.devx.red - minikube-version: v1.17.1 - openshift-version: v4.6 - kubernetes-version: v1.19.0 - knative-version: v0.19.0 - knative-serving-version: v0.19.0 - net-kourier-version: v0.19.0 - knative-eventing-version: v0.19.2 - knative-sources-version: v0.19.0 - kn-client-version: v0.19.1 - camel-source-version: v0.19.0 - kafka-source-version: v0.19.3 - kamel-version: 1.3.1 + minikube-version: v1.25.1 + openshift-version: v4.8 + kubernetes-version: v1.23.0 + knative-version: v1.1.0 + knative-serving-version: v1.1.0 + net-kourier-version: v1.1.0 + knative-eventing-version: v1.1.0 + knative-sources-version: v1.1.0 + kn-client-version: v1.1.0 + camel-source-version: v0.24.0 + kafka-source-version: v1.1.0 + kamel-version: 1.8.0 kubernetes-cli: kubectl release-version: master page-pagination: true diff --git a/staging.yml b/staging.yml index 1279f573..e3297dca 100644 --- a/staging.yml +++ b/staging.yml @@ -17,15 +17,18 @@ asciidoc: tutorial-namespace: knativetutorial branch: master workshop-domain: guru.devx.red - minikube-version: v1.17.1 - openshift-version: v4.6 - kubernetes-version: v1.19.0 - knative-version: v0.19.0 - knative-serving-version: v0.19.0 - net-kourier-version: v0.19.0 - knative-eventing-version: v0.19.2 - knative-sources-version: v0.19.0 - kn-client-version: v0.19.1 + minikube-version: v1.25.1 + openshift-version: v4.8 + kubernetes-version: v1.23.0 + knative-version: v1.1.0 + knative-serving-version: v1.1.0 + net-kourier-version: v1.1.0 + knative-eventing-version: v1.1.0 + knative-sources-version: v1.1.0 + kn-client-version: v1.1.0 + camel-source-version: v0.24.0 + kafka-source-version: v1.1.0 + kamel-version: 1.8.0 kubernetes-cli: kubectl release-version: master page-pagination: true