Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install latest release of net-istio whenever we install latest release of serving. #8158

Merged
merged 4 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 38 additions & 20 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ function build_knative_from_source() {
# Installs Knative Serving in the current cluster, and waits for it to be ready.
# If no parameters are passed, installs the current source-based build, unless custom
# YAML files were passed using the --custom-yamls flag.
# Parameters: $1 - Knative Serving YAML file
# Parameters: $1 - Knative Serving version "HEAD" or "latest-release". Default is "HEAD".
# $2 - Knative Monitoring YAML file (optional)
function install_knative_serving() {
local version=${1:-"HEAD"}
if [[ -z "${INSTALL_CUSTOM_YAMLS}" ]]; then
install_knative_serving_standard "$1" "$2"
install_knative_serving_standard "$version" "$2"
return
fi
echo ">> Installing Knative serving from custom YAMLs"
Expand Down Expand Up @@ -202,11 +203,10 @@ function install_istio() {
if [[ -n "$1" ]]; then
echo ">> Installing Istio Ingress"
echo "Istio Ingress YAML: ${1}"
# We apply a filter here because when we're installing from a pre-built
# bundle then the whole bundle it passed here. We use ko because it has
# better filtering support for CRDs.
local YAML_NAME=${TMP_DIR}/${1##*/}
# Create temp copy in which we replace knative-serving by the test's system namespace.
local YAML_NAME=$(mktemp -p $TMP_DIR --suffix=.$(basename "$1"))
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${1} > ${YAML_NAME}
echo "Istio Ingress YAML: $YAML_NAME"
ko apply -f "${YAML_NAME}" --selector=networking.knative.dev/ingress-provider=istio || return 1
UNINSTALL_LIST+=( "${YAML_NAME}" )
fi
Expand Down Expand Up @@ -282,7 +282,7 @@ function install_contour() {

# Installs Knative Serving in the current cluster, and waits for it to be ready.
# If no parameters are passed, installs the current source-based build.
# Parameters: $1 - Knative Serving YAML file
# Parameters: $1 - Knative Serving version "HEAD" or "latest-release".
# $2 - Knative Monitoring YAML file (optional)
function install_knative_serving_standard() {
echo ">> Creating ${SYSTEM_NAMESPACE} namespace if it does not exist"
Expand All @@ -294,19 +294,28 @@ function install_knative_serving_standard() {
add_trap "kubectl delete namespace ${SYSTEM_NAMESPACE} --ignore-not-found=true" SIGKILL SIGTERM SIGQUIT

echo ">> Installing Knative CRD"
if [[ -z "$1" ]]; then
SERVING_RELEASE_YAML=""
if [[ "$1" == "HEAD" ]]; then
# If we need to build from source, then kick that off first.
build_knative_from_source

echo "CRD YAML: ${SERVING_CRD_YAML}"
kubectl apply -f "${SERVING_CRD_YAML}" || return 1
UNINSTALL_LIST+=( "${SERVING_CRD_YAML}" )
else
local YAML_NAME=${TMP_DIR}/${1##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${1} > ${YAML_NAME}
echo "Knative YAML: ${YAML_NAME}"
ko apply -f "${YAML_NAME}" --selector=knative.dev/crd-install=true || return 1
UNINSTALL_LIST+=( "${YAML_NAME}" )
# Download the latest release of Knative Serving.
local url="https://github.com/knative/serving/releases/download/${LATEST_SERVING_RELEASE_VERSION}"
local yaml="serving.yaml"

local SERVING_RELEASE_YAML=${TMP_DIR}/"serving-${LATEST_SERVING_RELEASE_VERSION}.yaml"
wget "${url}/${yaml}" -O "${SERVING_RELEASE_YAML}" \
|| fail_test "Unable to download latest knative/serving release."

# Replace the default system namespace with the test's system namespace.
sed -i "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${SERVING_RELEASE_YAML}

echo "Knative YAML: ${SERVING_RELEASE_YAML}"
ko apply -f "${SERVING_RELEASE_YAML}" --selector=knative.dev/crd-install=true || return 1
fi

echo ">> Installing Ingress"
Expand All @@ -319,7 +328,18 @@ function install_knative_serving_standard() {
elif [[ -n "${CONTOUR_VERSION}" ]]; then
install_contour || return 1
else
install_istio "./third_party/net-istio.yaml" || return 1
if [[ "$1" == "HEAD" ]]; then
install_istio "./third_party/net-istio.yaml" || return 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed yesterday, shall we install the latest nightly release here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is from the latest nightly release?

Otherwise, what is the URL to get the latest nightly release? thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is already a lot of bash in this PR, I'd do that in a follow up.

else
# Download the latest release of net-istio.
local url="https://github.com/knative/net-istio/releases/download/${LATEST_NET_ISTIO_RELEASE_VERSION}"
local yaml="net-istio.yaml"
local YAML_NAME=${TMP_DIR}/"net-istio-${LATEST_NET_ISTIO_RELEASE_VERSION}.yaml"
wget "${url}/${yaml}" -O "${YAML_NAME}" \
|| fail_test "Unable to download latest knative/net-istio release."
echo "net-istio YAML: ${YAML_NAME}"
install_istio $YAML_NAME || return 1
fi
fi

echo ">> Installing Cert-Manager"
Expand All @@ -336,7 +356,7 @@ function install_knative_serving_standard() {
UNINSTALL_LIST+=( "${CERT_YAML_NAME}" )

echo ">> Installing Knative serving"
if [[ -z "$1" ]]; then
if [[ "$1" == "HEAD" ]]; then
local CORE_YAML_NAME=${TMP_DIR}/${SERVING_CORE_YAML##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${SERVING_CORE_YAML} > ${CORE_YAML_NAME}
local HPA_YAML_NAME=${TMP_DIR}/${SERVING_HPA_YAML##*/}
Expand All @@ -354,14 +374,12 @@ function install_knative_serving_standard() {
UNINSTALL_LIST+=( "${MONITORING_YAML}" )
fi
else
echo "Knative YAML: ${1}"
echo "Knative YAML: ${SERVING_RELEASE_YAML}"
# If we are installing from provided yaml, then only install non-istio bits here,
# and if we choose to install istio below, then pass the whole file as the rest.
# We use ko because it has better filtering support for CRDs.
local YAML_NAME=${TMP_DIR}/${1##*/}
sed "s/namespace: ${KNATIVE_DEFAULT_NAMESPACE}/namespace: ${SYSTEM_NAMESPACE}/g" ${1} > ${YAML_NAME}
ko apply -f "${YAML_NAME}" --selector=networking.knative.dev/ingress-provider!=istio || return 1
UNINSTALL_LIST+=( "${YAML_NAME}" )
ko apply -f "${SERVING_RELEASE_YAML}" --selector=networking.knative.dev/ingress-provider!=istio || return 1
UNINSTALL_LIST+=( "${SERVING_RELEASE_YAML}" )

if (( INSTALL_MONITORING )); then
echo ">> Installing Monitoring"
Expand Down
13 changes: 6 additions & 7 deletions test/e2e-upgrade-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ source $(dirname $0)/e2e-common.sh
# tagged release on the current branch will be used.
LATEST_SERVING_RELEASE_VERSION=$(git describe --match "v[0-9]*" --abbrev=0)

# Latest net-istio release.
LATEST_NET_ISTIO_RELEASE_VERSION=$(
curl --silent "https://api.github.com/repos/knative/net-istio/releases" | grep '"tag_name"' \
| cut -f2 -d: | sed "s/[^v0-9.]//g" | sort | tail -n1)

function install_latest_release() {
header "Installing Knative latest public release"
local url="https://github.com/knative/serving/releases/download/${LATEST_SERVING_RELEASE_VERSION}"
local yaml="serving.yaml"

local RELEASE_YAML="$(mktemp)"
wget "${url}/${yaml}" -O "${RELEASE_YAML}" \
|| fail_test "Unable to download latest Knative release."

install_knative_serving "${RELEASE_YAML}" \
install_knative_serving latest-release \
|| fail_test "Knative latest release installation failed"
wait_until_pods_running ${SYSTEM_NAMESPACE}
}
Expand Down