Skip to content

Commit

Permalink
simplify net-gateway-api install
Browse files Browse the repository at this point in the history
- we can reuse net-istio's third_party istio install yaml
- use the gateway api crds in third_party - the prior download url didn't work
  • Loading branch information
dprotaso committed Dec 2, 2021
1 parent 50e4b64 commit c8cb927
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
27 changes: 7 additions & 20 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function knative_setup() {
fi

# Download Istio YAMLs
if is_ingress_class istio; then
if is_ingress_class istio || is_ingress_class gateway-api; then
stage_istio_head

# Download istio resources we need for upgrade tests
Expand All @@ -219,18 +219,6 @@ function knative_setup() {
fi
fi

# Install gateway-api and istio. Gateway API CRD must be installed before Istio.
if is_ingress_class gateway-api; then
# TODO: Do not use fixed Gateway API version and Istio version.
kubectl apply -k 'github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.3.0'
export ISTIO_VERSION=1.11.4 && curl -sL https://istio.io/downloadIstioctl | sh -
if (( KIND )); then
$HOME/.istioctl/bin/istioctl install -y --set values.gateways.istio-ingressgateway.type=NodePort --set values.global.proxy.clusterDomain="${CLUSTER_DOMAIN}"
else
$HOME/.istioctl/bin/istioctl install -y --set values.global.proxy.clusterDomain="${CLUSTER_DOMAIN}"
fi
fi

stage_test_resources

install "${INSTALL_SERVING_VERSION}" "${INSTALL_ISTIO_VERSION}"
Expand Down Expand Up @@ -264,9 +252,14 @@ function install() {
"${REPO_ROOT_DIR}/test/config/ytt/core"
)

if is_ingress_class istio; then
if is_ingress_class istio || is_ingress_class gateway-api; then
# Istio - see cluster_setup for how the files are staged
YTT_FILES+=("${E2E_YAML_DIR}/istio/${ingress_version}/install")
fi

if is_ingress_class istio; then
# We use the staged net-istio file since we can install different versions
YTT_FILES+=("${E2E_YAML_DIR}/net-istio/${ingress_version}/install")
else
YTT_FILES+=("${REPO_ROOT_DIR}/third_party/${ingress}-latest")
fi
Expand Down Expand Up @@ -339,12 +332,6 @@ function install() {
# kubectl -n ${SYSTEM_NAMESPACE} delete leases --all
wait_for_leader_controller || return 1
fi

# Due to https://github.com/vmware-tanzu/carvel-kapp/issues/381, deploy svc by kubectl instead of kapp.
if is_ingress_class gateway-api; then
kubectl delete -f ${REPO_ROOT_DIR}/third_party/gateway-api-latest/istio-gateway.yaml
kubectl apply -f ${REPO_ROOT_DIR}/third_party/gateway-api-latest/istio-gateway.yaml
fi
}

# Check if we should use --resolvabledomain. In case the ingress only has
Expand Down
22 changes: 15 additions & 7 deletions test/e2e-networking-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,41 @@ function is_ingress_class() {
function stage_istio_head() {
header "Staging Istio YAML (HEAD)"
local istio_head_dir="${E2E_YAML_DIR}/istio/HEAD/install"
local net_istio_head_dir="${E2E_YAML_DIR}/net-istio/HEAD/install"
mkdir -p "${istio_head_dir}"
download_net_istio_yamls "${REPO_ROOT_DIR}/third_party/istio-latest/net-istio.yaml" "${istio_head_dir}"
mkdir -p "${net_istio_head_dir}"
download_net_istio_yamls "${REPO_ROOT_DIR}/third_party/istio-latest/net-istio.yaml" \
"${istio_head_dir}" \
"${net_istio_head_dir}"
}

function stage_istio_latest() {
header "Staging Istio YAML (${LATEST_NET_ISTIO_RELEASE_VERSION})"
local istio_latest_dir="${E2E_YAML_DIR}/istio/latest-release/install"
local net_istio_latest_dir="${E2E_YAML_DIR}/net-istio/latest-release/install"
mkdir -p "${istio_latest_dir}"
mkdir -p "${net_istio_latest_dir}"

download_net_istio_yamls \
"https://github.com/knative-sandbox/net-istio/releases/download/${LATEST_NET_ISTIO_RELEASE_VERSION}/net-istio.yaml" \
"${istio_latest_dir}"
"${net_istio_latest_dir}"
}

function download_net_istio_yamls() {
local net_istio_yaml="$1"
local target_dir="$2"
local istio_dir="$2"
local net_istio_dir="$3"

if [[ "${net_istio_yaml}" == "http"* ]]; then
wget "${net_istio_yaml}" -P "${target_dir}" \
wget "${net_istio_yaml}" -P "${net_istio_dir}" \
|| fail_test "Unable to download istio file ${net_istio_yaml}"
else
cp "${net_istio_yaml}" "${target_dir}"
cp "${net_istio_yaml}" "${net_istio_dir}"
fi

# Point to our local copy
net_istio_yaml="${target_dir}/$(basename "${net_istio_yaml}")"
net_istio_yaml="${net_istio_dir}/$(basename "${net_istio_yaml}")"

local sha=$(head -n 1 ${net_istio_yaml} | grep "# Generated when HEAD was" | sed 's/^.* //')
if [[ -z "${sha:-}" ]]; then
Expand All @@ -60,13 +68,13 @@ function download_net_istio_yamls() {
local istio_yaml="$(net_istio_file_url "$sha" istio.yaml)"
local istio_config_yaml="$(net_istio_file_url "$sha" config-istio.yaml)"

wget -P "${target_dir}" "${istio_yaml}" \
wget -P "${istio_dir}" "${istio_yaml}" \
|| fail_test "Unable to get istio install file ${istio_yaml}"

# Some istio profiles don't have a config-istio so do a HEAD request to check
# before downloading
if wget -S --spider "${istio_config_yaml}" &> /dev/null; then
wget -P "${target_dir}" "${istio_config_yaml}" \
wget -P "${istio_dir}" "${istio_config_yaml}" \
|| fail_test "Unable to get istio install file ${istio_config_yaml}"
else
echo "istio profile does not have a config-istio.yaml upstream"
Expand Down

0 comments on commit c8cb927

Please sign in to comment.