Skip to content

Commit

Permalink
Added Scripts to deploy the Loom modules (#3290)
Browse files Browse the repository at this point in the history
* data-plane base to use env USE_LOOM

Signed-off-by: debasishbsws <debasishbsws.dev@gmail.com>

* Data Plane script log update

---------

Signed-off-by: debasishbsws <debasishbsws.dev@gmail.com>
  • Loading branch information
debasishbsws authored Aug 22, 2023
1 parent 0242a87 commit c6e8f3c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
40 changes: 32 additions & 8 deletions hack/data-plane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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 $?
}

Expand Down
3 changes: 3 additions & 0 deletions hack/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c6e8f3c

Please sign in to comment.