Skip to content

Commit

Permalink
Apply feedback
Browse files Browse the repository at this point in the history
Signed-off-by: gabriel-farache <gfarache@redhat.com>
  • Loading branch information
gabriel-farache committed Jan 29, 2025
1 parent 9070efa commit 025114e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
30 changes: 20 additions & 10 deletions docs/main/eventing-communication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 -
Expand All @@ -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 \
Expand Down
25 changes: 13 additions & 12 deletions docs/main/eventing-communication/eventing-automate-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ 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"
echo " ORCHESTRATOR_NAME Name of the installed orchestrator CR"
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
}

Expand All @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit 025114e

Please # to comment.