Skip to content

Commit

Permalink
simplify net-gateway-api install (knative#12386)
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 authored Dec 3, 2021
1 parent b291012 commit 8b808e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
19 changes: 5 additions & 14 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,7 @@ function knative_setup() {

# 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
stage_gateway_api_resources
fi

stage_test_resources
Expand Down Expand Up @@ -267,6 +260,10 @@ function install() {
if is_ingress_class istio; then
# Istio - see cluster_setup for how the files are staged
YTT_FILES+=("${E2E_YAML_DIR}/istio/${ingress_version}/install")
elif is_ingress_class gateway-api; then
# This installs an istio version that works with the v1alpha1 gateway api
YTT_FILES+=("${E2E_YAML_DIR}/gateway-api/install")
YTT_FILES+=("${REPO_ROOT_DIR}/third_party/${ingress}-latest")
else
YTT_FILES+=("${REPO_ROOT_DIR}/third_party/${ingress}-latest")
fi
Expand Down Expand Up @@ -339,12 +336,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
26 changes: 26 additions & 0 deletions test/e2e-networking-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ function is_ingress_class() {
[[ "${INGRESS_CLASS}" == *"${1}"* ]]
}

function stage_gateway_api_resources() {
# This installs an istio version that works with the v1alpha1 gateway api
header "Staging Gateway API Resources"

local gateway_dir="${E2E_YAML_DIR}/gateway-api/install"
mkdir -p "${gateway_dir}"

# TODO: if we switch to istio 1.12 we can reuse stage_istio_head
curl -sL https://istio.io/downloadIstioctl | ISTIO_VERSION=1.11.4 sh -

local params="--set values.global.proxy.clusterDomain=${CLUSTER_DOMAIN}"
if (( KIND )); then
params="${params} --set values.gateways.istio-ingressgateway.type=NodePort"
fi

cat <<EOF > "${gateway_dir}/istio.yaml"
apiVersion: v1
kind: Namespace
metadata:
name: istio-system
---
EOF

$HOME/.istioctl/bin/istioctl manifest generate $params >> "${gateway_dir}/istio.yaml"
}

function stage_istio_head() {
header "Staging Istio YAML (HEAD)"
local istio_head_dir="${E2E_YAML_DIR}/istio/HEAD/install"
Expand Down

0 comments on commit 8b808e6

Please sign in to comment.