From c6e8f3c4c5c74917f36b3d30fc8bc3ffbccce8e2 Mon Sep 17 00:00:00 2001 From: Debasish Biswas Date: Tue, 22 Aug 2023 17:32:55 +0530 Subject: [PATCH] Added Scripts to deploy the Loom modules (#3290) * data-plane base to use env USE_LOOM Signed-off-by: debasishbsws * Data Plane script log update --------- Signed-off-by: debasishbsws --- hack/data-plane.sh | 40 ++++++++++++++++++++++++++++++++-------- hack/run.sh | 3 +++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/hack/data-plane.sh b/hack/data-plane.sh index 73463521f9..23c361afb9 100755 --- a/hack/data-plane.sh +++ b/hack/data-plane.sh @@ -31,8 +31,17 @@ readonly SINK_TLS_CONFIG_DIR=${DATA_PLANE_CONFIG_DIR}/sink-tls readonly CHANNEL_DATA_PLANE_CONFIG_DIR=${DATA_PLANE_CONFIG_DIR}/channel readonly CHANNEL_TLS_CONFIG_DIR=${DATA_PLANE_CONFIG_DIR}/channel-tls -readonly RECEIVER_DIRECTORY=receiver-vertx -readonly DISPATCHER_DIRECTORY=dispatcher-vertx +readonly RECEIVER_VERTX_DIRECTORY=receiver-vertx +readonly DISPATCHER_VERTX_DIRECTORY=dispatcher-vertx + +readonly RECEIVER_LOOM_DIRECTORY=receiver-loom +readonly DISPATCHER_LOOM_DIRECTORY=dispatcher-loom + +USE_LOOM=${USE_LOOM:-"false"} + +if [ $USE_LOOM == "true" ]; then + echo "Using loom modules ${USE_LOOM}" +fi # Checks whether the given function exists. function function_exists() { @@ -54,19 +63,29 @@ fi function receiver_build_push() { header "Building receiver ..." - local receiver="${KNATIVE_KAFKA_BROKER_RECEIVER:-${KO_DOCKER_REPO}/knative-kafka-broker-receiver}" - export KNATIVE_KAFKA_RECEIVER_IMAGE="${receiver}:${TAG}" + if [ $USE_LOOM == "true" ]; then + local receiver="${KNATIVE_KAFKA_BROKER_RECEIVER:-${KO_DOCKER_REPO}/knative-kafka-broker-receiver-loom}" + ./mvnw clean package jib:build -pl "${RECEIVER_LOOM_DIRECTORY}" -DskipTests || return $? + else + local receiver="${KNATIVE_KAFKA_RECEIVER:-${KO_DOCKER_REPO}/knative-kafka-broker-receiver}" + ./mvnw clean package jib:build -pl "${RECEIVER_VERTX_DIRECTORY}" -DskipTests || return $? + fi - ./mvnw clean package jib:build -pl ${RECEIVER_DIRECTORY} -DskipTests || return $? + export KNATIVE_KAFKA_RECEIVER_IMAGE="${receiver}:${TAG}" } function dispatcher_build_push() { header "Building dispatcher ..." - local dispatcher="${KNATIVE_KAFKA_BROKER_DISPATCHER:-${KO_DOCKER_REPO}/knative-kafka-broker-dispatcher}" + if [ "${USE_LOOM}" == "true" ]; then + local dispatcher="${KNATIVE_KAFKA_BROKER_DISPATCHER:-${KO_DOCKER_REPO}/knative-kafka-broker-dispatcher-loom}" + ./mvnw clean package jib:build -pl "${DISPATCHER_LOOM_DIRECTORY}" -DskipTests || return $? + else + local dispatcher="${KNATIVE_KAFKA_BROKER_DISPATCHER:-${KO_DOCKER_REPO}/knative-kafka-broker-dispatcher}" + ./mvnw clean package jib:build -pl "${DISPATCHER_VERTX_DIRECTORY}" -DskipTests || return $? + fi + export KNATIVE_KAFKA_DISPATCHER_IMAGE="${dispatcher}:${TAG}" - - ./mvnw clean package jib:build -pl "${DISPATCHER_DIRECTORY}" -DskipTests || return $? } function data_plane_build_push() { @@ -88,6 +107,11 @@ function replace_images() { sed -i "s|\${KNATIVE_KAFKA_DISPATCHER_IMAGE}|${KNATIVE_KAFKA_DISPATCHER_IMAGE}|g" "${file}" && sed -i "s|\${KNATIVE_KAFKA_RECEIVER_IMAGE}|${KNATIVE_KAFKA_RECEIVER_IMAGE}|g" "${file}" + # spefying 'runAsUser: 1001' in the source config for loom images + if [ "$USE_LOOM" == "true" ]; then + sed -i "s|runAsNonRoot: true|runAsUser: 1001|g" "${file}" + fi + return $? } diff --git a/hack/run.sh b/hack/run.sh index 0e30d0ca7b..471998682d 100755 --- a/hack/run.sh +++ b/hack/run.sh @@ -18,6 +18,7 @@ function usage() { echo " teardown-infra Remove eventing, Kafka (Strimzi)" echo " deploy-kafka Deploy Kafka (Strimzi)" echo " deploy Deploy eventing-kafka-broker" + echo " deploy-loom Deploy eventing-kafka-broker with loom modules" echo " deploy-source Deploy eventing-kafka-broker source bundle" echo " teardown Remove eventing-kafka-broker" echo " teardown-source Remove eventing-kafka-broker source bundle" @@ -47,6 +48,8 @@ elif [[ "${action}" == "deploy-kafka" ]]; then source "${ROOT_DIR}"/test/e2e-common.sh && kafka_setup elif [[ "${action}" == "deploy" ]]; then source "${ROOT_DIR}"/test/e2e-common.sh && test_setup +elif [[ "${action}" == "deploy-loom" ]]; then + USE_LOOM="true" && source "${ROOT_DIR}"/test/e2e-common.sh && test_setup elif [[ "${action}" == "deploy-source" ]]; then source "${ROOT_DIR}"/test/e2e-common.sh && test_source_setup elif [[ "${action}" == "build-from-source" ]]; then