Skip to content

Commit

Permalink
Refactor post install to standalone function
Browse files Browse the repository at this point in the history
  • Loading branch information
dsimansk committed Jan 19, 2024
1 parent aea0e90 commit f908a43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
22 changes: 15 additions & 7 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ function install_knative_eventing() {
-f "${EVENTING_CORE_NAME}" || return 1
UNINSTALL_LIST+=( "${EVENTING_CORE_NAME}" )

local EVENTING_POST_INSTALL_NAME=${TMP_DIR}/${EVENTING_POST_INSTALL_YAML##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" "${EVENTING_POST_INSTALL_YAML}" > "${EVENTING_POST_INSTALL_NAME=}"
kubectl create \
-f "${EVENTING_POST_INSTALL_NAME}" || return 1
UNINSTALL_LIST+=( "${EVENTING_POST_INSTALL_NAME}" )

local EVENTING_TLS_REPLACES=${TMP_DIR}/${EVENTING_TLS_YAML##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" "${EVENTING_TLS_YAML}" > "${EVENTING_TLS_REPLACES}"
if [[ ! -z "${CLUSTER_SUFFIX:-}" ]]; then
Expand Down Expand Up @@ -227,7 +221,7 @@ function install_mt_broker() {
if [[ -z "${EVENTING_MT_CHANNEL_BROKER_YAML:-}" ]]; then
build_knative_from_source
else
echo "use exist EVENTING_MT_CHANNEL_BROKER_YAML"
echo "use existing EVENTING_MT_CHANNEL_BROKER_YAML"
fi
local EVENTING_MT_CHANNEL_BROKER_NAME=${TMP_DIR}/${EVENTING_MT_CHANNEL_BROKER_YAML##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" "${EVENTING_MT_CHANNEL_BROKER_YAML}" > "${EVENTING_MT_CHANNEL_BROKER_NAME}"
Expand All @@ -239,6 +233,20 @@ function install_mt_broker() {
wait_until_pods_running "${SYSTEM_NAMESPACE}" || fail_test "Knative Eventing with MT Broker did not come up"
}

function install_post_install_job() {
# Var defined and populated by generate-yaml.sh
if [[ -z "${EVENTING_POST_INSTALL_YAML:-}" ]]; then
build_knative_from_source
else
echo "use existing EVENTING_POST_INSTALL_YAML"
fi
local EVENTING_POST_INSTALL_NAME=${TMP_DIR}/${EVENTING_POST_INSTALL_YAML##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" "${EVENTING_POST_INSTALL_YAML}" > "${EVENTING_POST_INSTALL_NAME=}"
kubectl create \
-f "${EVENTING_POST_INSTALL_NAME}" || return 1
UNINSTALL_LIST+=( "${EVENTING_POST_INSTALL_NAME}" )
}

function enable_sugar() {
# Extra parameters for ko apply
KO_FLAGS="${KO_FLAGS:-}"
Expand Down
1 change: 1 addition & 0 deletions test/upgrade/installation/git_head.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func GitHead() pkgupgrade.Operation {
"install_head",
"install_channel_crds",
"install_mt_broker",
"install_post_install_job",
"enable_sugar",
}
for _, shellfunc := range ops {
Expand Down

0 comments on commit f908a43

Please sign in to comment.