From 025114e4aecdf44b34406efa294d6460cdf9ab5d Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Tue, 28 Jan 2025 17:30:59 +0100 Subject: [PATCH] Apply feedback Signed-off-by: gabriel-farache --- docs/main/eventing-communication/README.md | 30 ++++++++++++------- .../eventing-automate-install.sh | 25 ++++++++-------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/docs/main/eventing-communication/README.md b/docs/main/eventing-communication/README.md index 0379f640..d1dc9506 100644 --- a/docs/main/eventing-communication/README.md +++ b/docs/main/eventing-communication/README.md @@ -3,27 +3,37 @@ ## Automated installation steps Usage: ``` -Usage: ORCHESTRATOR_NAME=ORCHESTRATOR_NAME BROKER_NAME=BROKER_NAME BROKER_NAMESPACE=BROKER_NAMESPACE [KAFKA_REPLICATION_FACTOR=KAFKA_REPLICATION_FACTOR] [ORCHESTRATOR_NAMESPACE=openshift-operators] [BROKER_TYPE=kafka] [INSTALL_KAFKA_CLUSTER=true] ./eventing-automate-install.sh +Usage: ORCHESTRATOR_NAME=ORCHESTRATOR_NAME BROKER_NAME=BROKER_NAME BROKER_NAMESPACE=BROKER_NAMESPACE [KAFKA_REPLICATION_FACTOR=KAFKA_REPLICATION_FACTOR] [ORCHESTRATOR_NAMESPACE=openshift-operators] [BROKER_TYPE=Kafka] [INSTALL_KAFKA_CLUSTER=true] ./eventing-automate-install.sh ORCHESTRATOR_NAME Name of the installed orchestrator CR ORCHESTRATOR_NAMESPACE Optional, namespace in which the orchestrator operator is depoyed. Default is openshift-operators BROKER_NAME Name of the broker to install BROKER_NAMESPACE Namespace in which the broker must be installed - BROKER_TYPE Optional , type of the broker. Either 'kafka' or 'in-memory'. Default is: 'kafka' - INSTALL_KAFKA_CLUSTER Optional, if set to true, indicates that kafka cluster must be installed. Will only be used if BROKER_TYPE is 'kafka'. Default is: true - KAFKA_REPLICATION_FACTOR Optional, only used if INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'kafka', provide the replication factor for the Kafka cluster + BROKER_TYPE Optional , type of the broker. Either 'Kafka' or 'in-memory'. Default is: 'Kafka' + INSTALL_KAFKA_CLUSTER Optional, if set to true, indicates that Kafka cluster must be installed. Will only be used if BROKER_TYPE is 'Kafka'. Default is: true + KAFKA_REPLICATION_FACTOR Optional, only used if INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'Kafka', provide the replication factor for the Kafka cluster ``` ### Using Kafka broker #### With pre-existing Kafka cluster ```console -ORCHESTRATOR_NAME=orchestrator-sample BROKER_NAME=kafka-broker BROKER_NAMESPACE=sonataflow-infra INSTALL_KAFKA_CLUSTER=false KAFKA_REPLICATION_FACTOR=1 ./eventing-automate-install.sh +ORCHESTRATOR_NAME=orchestrator-sample \ +BROKER_NAME=kafka-broker \ +BROKER_NAMESPACE=sonataflow-infra \ +INSTALL_KAFKA_CLUSTER=false \ +KAFKA_REPLICATION_FACTOR=1 ./eventing-automate-install.sh ``` #### Without existing Kafka cluster ```console -ORCHESTRATOR_NAME=orchestrator-sample BROKER_NAME=kafka-broker BROKER_NAMESPACE=sonataflow-infra INSTALL_KAFKA_CLUSTER=true ./eventing-automate-install.sh +ORCHESTRATOR_NAME=orchestrator-sample \ +BROKER_NAME=kafka-broker \ +BROKER_NAMESPACE=sonataflow-infra \ +INSTALL_KAFKA_CLUSTER=true ./eventing-automate-install.sh ``` ### Using in-memory-broker ```console -BROKER_TYPE=in-memory ORCHESTRATOR_NAME=orchestrator-sample BROKER_NAME=simple-broker BROKER_NAMESPACE=sonataflow-infra ./eventing-automate-install.sh +BROKER_TYPE=in-memory \ +ORCHESTRATOR_NAME=orchestrator-sample \ +BROKER_NAME=simple-broker \ +BROKER_NAMESPACE=sonataflow-infra ./eventing-automate-install.sh ``` ## Manual installation steps @@ -36,13 +46,13 @@ A Kafka broker will bring resiliency and reliability to event losses to the sont 1. A Kafka cluster running, see https://strimzi.io/quickstarts/ for a quickstart setup #### Installation steps -1. Configure and enable Kafka broker feature in Knative: https://knative.dev/docs/eventing/brokers/broker-types/kafka-broker/ +1. Configure and enable Kafka broker feature in Knative: https://knative.dev/v1.16-docs/eventing/brokers/broker-types/kafka-broker/ ```console oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v1.16.1/eventing-kafka-controller.yaml oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v1.16.1/eventing-kafka-broker.yaml ``` > [!NOTE] -> At the time this document was written, the latest `knative` version was `v1.16.1`. Please refer to [the latest official documentation](https://knative.dev/v1.16-docs/eventing/brokers/broker-types/kafka-broker/) for more up-to-date instructions for the Kafka broker setup. +> At the time this document was written, the latest `knative` version was `v1.16.1`. Please refer to [the official documentation](https://knative.dev/v1.16-docs/eventing/brokers/broker-types/kafka-broker/) for more up-to-date instructions for the Kafka broker setup. * Review the `Security Context Constraints` (`scc`) to be granted to the `knative-kafka-broker-data-plane` service account used by the `kafka-broker-receiver` deployment: ```console oc get deployments.apps -n knative-eventing kafka-broker-receiver -oyaml | oc adm policy scc-subject-review --filename - @@ -51,7 +61,7 @@ oc get deployments.apps -n knative-eventing kafka-broker-receiver -oyaml | oc ad ```console oc -n knative-eventing adm policy add-scc-to-user nonroot-v2 -z knative-kafka-broker-data-plane ``` -* Make sure the `replication.factor` of your Kafka cluster match the one of the `kafka-broker-config` ConfigMap. With the Strimzi quickstart example, this value is set to `1` (see ConfigMap `my-cluster-dual-role-0`): +* Make sure the `replication.factor` of your Kafka cluster matches the one of the `kafka-broker-config` ConfigMap. With the Strimzi quickstart example, this value is set to `1` (see ConfigMap `my-cluster-dual-role-0`): ```console oc patch cm kafka-broker-config -n knative-eventing \ --type merge \ diff --git a/docs/main/eventing-communication/eventing-automate-install.sh b/docs/main/eventing-communication/eventing-automate-install.sh index bdc3af97..e325a049 100755 --- a/docs/main/eventing-communication/eventing-automate-install.sh +++ b/docs/main/eventing-communication/eventing-automate-install.sh @@ -4,6 +4,7 @@ set -e set -x program_name=$0 +KNATIVE_VERSION=1.16.1 function usage { echo -e "Usage: ORCHESTRATOR_NAME=ORCHESTRATOR_NAME BROKER_NAME=BROKER_NAME BROKER_NAMESPACE=BROKER_NAMESPACE [KAFKA_REPLICATION_FACTOR=KAFKA_REPLICATION_FACTOR] [ORCHESTRATOR_NAMESPACE=openshift-operators] [BROKER_TYPE=kafka] [INSTALL_KAFKA_CLUSTER=true] $program_name" @@ -11,9 +12,9 @@ function usage { echo " ORCHESTRATOR_NAMESPACE Optional, namespace in which the orchestrator operator is depoyed. Default is openshift-operators" echo " BROKER_NAME Name of the broker to install" echo " BROKER_NAMESPACE Namespace in which the broker must be installed" - echo " BROKER_TYPE Optional , type of the broker. Either 'kafka' or 'in-memory'. Default is: 'kafka'" - echo " INSTALL_KAFKA_CLUSTER Optional, if set to true, indicates that kafka cluster must be installed. Will only be used if BROKER_TYPE is 'kafka'. Default is: true" - echo " KAFKA_REPLICATION_FACTOR Optional, only used if INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'kafka', provide the replication factor for the Kafka cluster" + echo " BROKER_TYPE Optional , type of the broker. Either 'Kafka' or 'in-memory'. Default is: 'Kafka'" + echo " INSTALL_KAFKA_CLUSTER Optional, if set to true, indicates that Kafka cluster must be installed. Will only be used if BROKER_TYPE is 'Kafka'. Default is: true" + echo " KAFKA_REPLICATION_FACTOR Optional, only used if INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'Kafka', provide the replication factor for the Kafka cluster" exit 1 } @@ -27,16 +28,16 @@ if [[ -z "${ORCHESTRATOR_NAME}" ]]; then fi if [[ -z "${BROKER_TYPE}" ]]; then - BROKER_TYPE=kafka + BROKER_TYPE=Kafka fi -if [[ "$BROKER_TYPE" != "kafka" && "$BROKER_TYPE" != "in-memory" ]]; then - echo 'Error: BROKER_TYPE env variable must be set to either "kafka" or "in-memory"' +if [[ "$BROKER_TYPE" != "Kafka" && "$BROKER_TYPE" != "in-memory" ]]; then + echo 'Error: BROKER_TYPE env variable must be set to either "Kafka" or "in-memory"' usage fi if [[ -z "${INSTALL_KAFKA_CLUSTER}" ]]; then - if [ "$BROKER_TYPE" == "kafka" ]; then + if [ "$BROKER_TYPE" == "Kafka" ]; then INSTALL_KAFKA_CLUSTER=true else INSTALL_KAFKA_CLUSTER=false @@ -62,15 +63,15 @@ if [ "$INSTALL_KAFKA_CLUSTER" == true ]; then KAFKA_REPLICATION_FACTOR=1 fi -if [ "$BROKER_TYPE" == "kafka" ]; then +if [ "$BROKER_TYPE" == "Kafka" ]; then if [[ -z "${KAFKA_REPLICATION_FACTOR}" ]]; then - echo "KAFKA_REPLICATION_FACTOR env variable must be set when INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'kafka'." + echo "KAFKA_REPLICATION_FACTOR env variable must be set when INSTALL_KAFKA_CLUSTER is set to false and BROKER_TYPE is 'Kafka'." usage fi - echo "Installing Knative 1.16.1 kafka-related resources" + echo "Installing Knative ${KNATIVE_VERSION} Kafka-related resources" - oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v1.16.1/eventing-kafka-controller.yaml - oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v1.16.1/eventing-kafka-broker.yaml + oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v"${KNATIVE_VERSION}"/eventing-kafka-controller.yaml + oc apply --filename https://github.com/knative-extensions/eventing-kafka-broker/releases/download/knative-v"${KNATIVE_VERSION}"/eventing-kafka-broker.yaml oc -n knative-eventing adm policy add-scc-to-user nonroot-v2 -z knative-kafka-broker-data-plane oc patch cm kafka-broker-config -n knative-eventing \ --type merge \