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

Add Kourier as an Ingress option for e2e tests #5983

Merged
merged 16 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
43 changes: 39 additions & 4 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/e2e-tests.sh
CERT_MANAGER_VERSION="0.9.1"
ISTIO_VERSION=""
GLOO_VERSION=""
KOURIER_VERSION=""

HTTPS=0

Expand All @@ -48,7 +49,11 @@ function parse_flags() {
case "$1" in
--istio-version)
[[ $2 =~ ^[0-9]+\.[0-9]+(\.[0-9]+|\-latest)$ ]] || abort "version format must be '[0-9].[0-9].[0-9]' or '[0-9].[0-9]-latest"
readonly ISTIO_VERSION=$2
# TOTAL HACK BELOW - DO NOT COMMIT
# FORCE KOURIER TO RUN INSTEAD OF ISTIO
# NEVER MERGE THIS PR WITH THIS IN
#readonly ISTIO_VERSION=$2
readonly KOURIER_VERSION="0.2.2"
GATEWAY_SETUP=1
return 2
;;
Expand Down Expand Up @@ -96,6 +101,13 @@ function parse_flags() {
GATEWAY_SETUP=1
return 2
;;
--kourier-version)
# currently, the value of --kourier-version is ignored
# latest version of Kourier pinned in third_party will be installed
readonly KOURIER_VERSION=$2
GATEWAY_SETUP=1
return 2
;;
esac
return 0
}
Expand Down Expand Up @@ -174,6 +186,15 @@ function install_gloo() {
kubectl apply -f ${INSTALL_GLOO_YAML} || return 1
}

function install_kourier() {
local kourier_base="./third_party/kourier-latest"
INSTALL_KOURIER_YAML="${kourier_base}/kourier.yaml"
echo "Kourier YAML: ${INSTALL_KOURIER_YAML}"
echo ">> Bringing up Kourier"

kubectl apply -f ${INSTALL_KOURIER_YAML} || return 1
}

# 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
Expand All @@ -186,8 +207,8 @@ function install_knative_serving_standard() {
build_knative_from_source
INSTALL_RELEASE_YAML="${SERVING_YAML}"

# install serving core if installing for Gloo
if [[ -n "${GLOO_VERSION}" ]]; then
# install serving core if installing for Gloo or Kourier
if [[ -n "${GLOO_VERSION}" || -n "${KOURIER_VERSION}" ]]; then
INSTALL_RELEASE_YAML="${SERVING_CORE_YAML}"
fi

Expand All @@ -214,6 +235,9 @@ function install_knative_serving_standard() {
if [[ -n "${GLOO_VERSION}" ]]; then
install_gloo
fi
if [[ -n "${KOURIER_VERSION}" ]]; then
install_kourier
fi

echo ">> Installing Cert-Manager"
kubectl apply -f "${INSTALL_CERT_MANAGER_YAML}" --validate=false || return 1
Expand Down Expand Up @@ -276,10 +300,13 @@ EOF
# Some versions of Istio don't provide an HPA for pilot.
kubectl autoscale -n istio-system deploy istio-pilot --min=3 --max=10 --cpu-percent=60 || return 1
fi
else
elif [[ -n "${GLOO_VERSION}" ]]; then
# Scale replicas of the Gloo proxies to handle large qps
kubectl scale -n gloo-system deployment knative-external-proxy --replicas=6
kubectl scale -n gloo-system deployment knative-internal-proxy --replicas=6
elif [[ -n "${KOURIER_VERSION}" ]]; then
# Scale replicas of the Kourier gateways to handle large qps
kubectl scale -n kourier-system deployment 3scale-kourier-gateway --replicas=6
fi

if [[ -n "${INSTALL_MONITORING_YAML}" ]]; then
Expand Down Expand Up @@ -374,6 +401,14 @@ function test_setup() {
wait_until_pods_running gloo-system || return 1
wait_until_service_has_external_ip gloo-system knative-external-proxy
fi
if [[ -n "${KOURIER_VERSION}" ]]; then
# we must set these override values to allow the test spoofing client to work with Kourier
# see https://github.com/knative/pkg/blob/release-0.7/test/ingress/ingress.go#L37
export GATEWAY_OVERRIDE=kourier-external
export GATEWAY_NAMESPACE_OVERRIDE=kourier-system
wait_until_pods_running kourier-system || return 1
wait_until_service_has_external_ip kourier-system kourier-external
fi
if [[ -n "${INSTALL_MONITORING_YAML}" ]]; then
wait_until_pods_running knative-monitoring || return 1
fi
Expand Down
5 changes: 5 additions & 0 deletions third_party/kourier-latest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The kourier.yaml file is generated by running

```
./download-kourier.sh
```
28 changes: 28 additions & 0 deletions third_party/kourier-latest/download-kourier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -ex

# Download Kourier
KOURIER_VERSION=0.2.2
KOURIER_YAML=kourier-knative.yaml
DOWNLOAD_URL=https://raw.githubusercontent.com/3scale/kourier/v${KOURIER_VERSION}/deploy/${KOURIER_YAML}

wget ${DOWNLOAD_URL}

cat <<EOF > kourier.yaml
apiVersion: v1
kind: Namespace
metadata:
name: kourier-system
---
EOF

cat ${KOURIER_YAML} \
`# Install Kourier into the kourier-system namespace` \
| sed 's/namespace: knative-serving/namespace: kourier-system/' \
bbrowning marked this conversation as resolved.
Show resolved Hide resolved
`# Expose Kourier services with LoadBalancer IPs instead of ClusterIP` \
| sed 's/ClusterIP/LoadBalancer/' \
>> kourier.yaml

# Clean up.
rm ${KOURIER_YAML}
Loading