Skip to content

Commit

Permalink
Add Kourier as an Ingress option for e2e tests (#5983)
Browse files Browse the repository at this point in the history
* Add Kourier as an Ingress option for e2e tests

This copies the work done for Gloo, except for Kourier. The
download-kourier.sh script just pulls in Kourier 0.2.2 (the latest)
for now like Gloo does since we do not test with multiple versions of
either.

* HACK: Run all  tests w/ Kourier instead of Istio

This commit needs to be removed from this PR before merging.

* We need the kourier-system namespace as well

I missed then when converting things to use the download-kourier.sh
for generating the kourier.yaml

* Actually use Kourier ingress when it's enabled in tests

* Helps if it's not a dry-run

* Make Kourier the default ingress AFTER serving is installed

I guess I need to figure out how to run this entire e2e script locally...

* Bump to Kouvier 0.2.3 that does not reconcile ClusterIngress

* Try Kourier w/ 1 dataplane pod

* Temporarily enable route retrying logic to isolate test failures

* Bump to Kourier v0.2.4 and multiple gateway pods

Kourier 0.2.4 should now handle Ready status from multiple gateway
pods so that Ready isn't indicated until all gateways are ready. So,
bump to that and increase gateway replica count.

* Kourier v0.2.5

* Be smarter about serving-core.yaml vs serving.yaml in upgrade tests

When testing on Gloo or Kourier use serving-core.yaml instead of
serving.yaml for upgrade tests.

* Revert "Temporarily enable route retrying logic to isolate test failures"

This reverts commit e2e02aa.

* Copyright header, trailing whitespace cleanup

* Update to Kourier 0.2.6

* Revert "HACK: Run all  tests w/ Kourier instead of Istio"

This reverts commit d6056f2.
  • Loading branch information
bbrowning authored and knative-prow-robot committed Nov 26, 2019
1 parent d528a69 commit be9cdc9
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 5 deletions.
53 changes: 50 additions & 3 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 Down Expand Up @@ -96,6 +97,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 +182,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 +203,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,13 +231,32 @@ 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

echo ">> Bringing up Serving"
kubectl apply -f "${INSTALL_RELEASE_YAML}" || return 1

if [[ -n "${KOURIER_VERSION}" ]]; then
echo ">> Making Kourier the default ingress"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: config-network
namespace: knative-serving
labels:
serving.knative.dev/release: devel
data:
ingress.class: "kourier.ingress.networking.knative.dev"
clusteringress.class: "kourier.ingress.networking.knative.dev"
EOF
fi

if (( RECONCILE_GATEWAY )); then
echo ">> Turning on reconcileExternalGateway"
cat <<EOF | kubectl apply -f -
Expand Down Expand Up @@ -276,10 +312,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 @@ -366,6 +405,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
10 changes: 8 additions & 2 deletions test/e2e-upgrade-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ LATEST_SERVING_RELEASE_VERSION=$(git describe --match "v[0-9]*" --abbrev=0)
function install_latest_release() {
header "Installing Knative latest public release"
local url="https://github.com/knative/serving/releases/download/${LATEST_SERVING_RELEASE_VERSION}"
# TODO: should this test install istio and build at all, or only serving?
local yaml="serving.yaml"

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

install_knative_serving \
"${url}/serving.yaml" \
"${url}/${yaml}" \
|| fail_test "Knative latest release installation failed"
wait_until_pods_running knative-serving
}
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
```
42 changes: 42 additions & 0 deletions third_party/kourier-latest/download-kourier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# Copyright 2019 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

# Download Kourier
KOURIER_VERSION=0.2.6
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/' \
`# Expose Kourier services with LoadBalancer IPs instead of ClusterIP` \
| sed 's/ClusterIP/LoadBalancer/' \
>> kourier.yaml

# Clean up.
rm ${KOURIER_YAML}
Loading

0 comments on commit be9cdc9

Please sign in to comment.