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 2 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
```
20 changes: 20 additions & 0 deletions third_party/kourier-latest/download-kourier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/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 ${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}
258 changes: 258 additions & 0 deletions third_party/kourier-latest/kourier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
apiVersion: v1
kind: Service
metadata:
name: kourier
namespace: kourier-system
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8080
selector:
app: 3scale-kourier
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: 3scale-kourier-gateway
namespace: kourier-system
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: 3scale-kourier-gateway
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: 3scale-kourier-gateway
spec:
containers:
- args:
- -c
- /tmp/config/envoy-bootstrap.yaml
image: quay.io/3scale/kourier-gateway:v0.1.0
imagePullPolicy: Always
name: kourier-gateway
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: config-volume
mountPath: /tmp/config
volumes:
- name: config-volume
configMap:
name: kourier-bootstrap
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: 3scale-kourier-control
namespace: kourier-system
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: 3scale-kourier-control
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: 3scale-kourier-control
spec:
containers:
- image: quay.io/3scale/kourier:v0.2.2
imagePullPolicy: Always
name: kourier-control
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
- name: CERTS_SECRET_NAMESPACE
value: ""
- name: CERTS_SECRET_NAME
value: ""
- name: KOURIER_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: 3scale-kourier
terminationGracePeriodSeconds: 30
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: 3scale-kourier
namespace: kourier-system
rules:
- apiGroups: [""]
resources: [ "endpoints", "namespaces", "services", "secrets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["networking.internal.knative.dev"]
resources: ["clusteringresses","ingresses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["networking.internal.knative.dev"]
resources: ["ingresses/status","clusteringresses/status"]
verbs: ["update"]
- apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
verbs: ["get", "list", "watch"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: 3scale-kourier
namespace: kourier-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: 3scale-kourier
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: 3scale-kourier
subjects:
- kind: ServiceAccount
name: 3scale-kourier
namespace: kourier-system
---
apiVersion: v1
kind: Service
metadata:
name: kourier
namespace: kourier-system
spec:
ports:
- name: http2
port: 80
protocol: TCP
targetPort: 8080
selector:
app: 3scale-kourier-gateway
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
name: kourier-internal
namespace: kourier-system
spec:
ports:
- name: http2
port: 80
protocol: TCP
targetPort: 8081
selector:
app: 3scale-kourier-gateway
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
name: kourier-external
namespace: kourier-system
spec:
ports:
- name: http2
port: 80
protocol: TCP
targetPort: 8080
selector:
app: 3scale-kourier-gateway
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
name: kourier-control
namespace: kourier-system
spec:
ports:
- port: 18000
protocol: TCP
targetPort: 18000
selector:
app: 3scale-kourier-control
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kourier-bootstrap
namespace: kourier-system
data:
envoy-bootstrap.yaml: |
admin:
access_log_path: /tmp/test
address:
socket_address:
address: 0.0.0.0
port_value: 19000
dynamic_resources:
ads_config:
api_type: GRPC
grpc_services:
- envoy_grpc:
cluster_name: xds_cluster
cds_config:
ads: {}
lds_config:
ads: {}
node:
cluster: kourier-knative
id: 3scale-kourier-gateway
static_resources:
clusters:
- connect_timeout: 0.2s
load_assignment:
cluster_name: xds_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: kourier-control
port_value: 18000
http2_protocol_options: {}
upstream_connection_options:
tcp_keepalive: {}
lb_policy: ROUND_ROBIN
name: xds_cluster
type: STRICT_DNS