Skip to content

Commit

Permalink
e2e - drop imperative bash yaml for declarative ytt/kapp (knative#11175)
Browse files Browse the repository at this point in the history
* e2e - drop imperative bash yaml for declarative ytt/kapp

* don't override knative_setup

* fix namespace of some test-resources

* move ingress class to a property file

* change overlay file names to indicate which configmaps they overlay

* domain-mapping controller is HA

* better coordination between generate-yamls.sh and our e2e scripts

* post-install job support

* fix autotls tests

* fix kourier - do a global search when replacing the system namespace

* drop setting ambassador namespace

* pin kapp to a specific sha

* first pass at upgrade test fixes

* drop ignore-unknown-comments flag - no longer needed with v0.32.0

* fix istio latest-release install

* hardcode kapp app names
upgrade tests change the E2E_SCRIPT name thus we can end up with two installations

* kind tweaks

* drop unused constant

* minor cleanup

* fix stray # in istio mesh ytt file

* drop bash wait since kapp will do this for us

* pull back the global rename and just do it where we need to
otherwise we end up with cluster roles with weird names

* apply injection to namespaces

* custom-yamls now accepts the generated env file output from generate-yamls.sh

* include peer auth for net-certmanager webhook

* fix kong ingress value
  • Loading branch information
dprotaso authored Apr 30, 2021
1 parent e04223b commit e2a8237
Show file tree
Hide file tree
Showing 46 changed files with 964 additions and 767 deletions.
113 changes: 16 additions & 97 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
GO111MODULE: on
GOFLAGS: -tags=nostackdriver
# https://github.com/google/go-containerregistry/pull/125 allows insecure registry for
# '*.local' hostnames. This works both for `ko` and our own tag-to-digest resolution logic,
Expand Down Expand Up @@ -170,112 +170,31 @@ jobs:
# local reigstry, even when pushing $REGISTRY_NAME:$REGISTRY_PORT/some/image
sudo echo "127.0.0.1 $REGISTRY_NAME" | sudo tee -a /etc/hosts
- name: Install Knative Serving
env:
GO111MODULE: on
GOFLAGS: -mod=vendor
run: |
set -o pipefail
kubectl apply -f config/core/300-imagecache.yaml
# Build and Publish our containers to the docker daemon (including test assets)
ko apply --platform=linux/amd64 -PRf config/core
ko apply --platform=linux/amd64 -Pf test/config/
# Have Serving use the kingress option.
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress.class":"${{ matrix.kingress }}.ingress.networking.knative.dev"}}'
# Be KinD to these tests.
kubectl scale -nknative-serving deployment/chaosduck --replicas=0
# Setting deadline progress to a shorter value.
kubectl patch cm "config-deployment" -n knative-serving \
-p '{"data":{"progressDeadline":"120s"}}'
- name: Install Alpha Components
if: contains(matrix.test-flags, '--enable-alpha')
env:
GO111MODULE: on
GOFLAGS: -mod=vendor
run: |
ko apply --platform=all -PRf config/domain-mapping
- name: Wait for components to be up
run: |
# We need the webhook to be up
kubectl wait --for=condition=Available deployment -n knative-serving --all
- name: Install kingress provider (Contour)
if: matrix.kingress == 'contour'
run: |
set -o pipefail
# Apply a kingress option.
ko resolve -f third_party/contour-latest | \
sed 's/LoadBalancer/NodePort/g' | \
sed 's/imagePullPolicy:/# DISABLED: imagePullPolicy:/g' | \
kubectl apply -f -
# This tells the tests what namespace to look in for our kingress LB.
echo "GATEWAY_OVERRIDE=envoy" >> $GITHUB_ENV
echo "GATEWAY_NAMESPACE_OVERRIDE=contour-external" >> $GITHUB_ENV
- name: Install kingress provider (Kourier)
if: matrix.kingress == 'kourier'
run: |
set -o pipefail
# Apply a kingress option.
ko resolve -f third_party/kourier-latest | \
sed 's/LoadBalancer/NodePort/g' | \
kubectl apply -f -
# This tells the tests what namespace to look in for our kingress LB.
echo "GATEWAY_OVERRIDE=kourier" >> $GITHUB_ENV
echo "GATEWAY_NAMESPACE_OVERRIDE=kourier-system" >> $GITHUB_ENV
- name: Install kingress provider (Istio)
if: matrix.kingress == 'istio'
- name: Install Serving & Ingress
working-directory: ./src/knative.dev/serving
run: |
set -o pipefail
source ./test/e2e-common.sh
source test/e2e-networking-library.sh
KIND=1
INGRESS_CLASS="${{ matrix.kingress }}.ingress.networking.knative.dev"
CLUSTER_DOMAIN="${{ matrix.cluster-suffix }}"
PATCHED_YAML=$(mktemp)
ko resolve -f third_party/istio-latest/net-istio.yaml > $PATCHED_YAML
knative_setup
test_setup
# TODO: figure out how to use e2e-common.sh directly even if no
# custom namespace is used here.
TMP_DIR=$(mktemp -d -t ci-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXXXX)
KNATIVE_DEFAULT_NAMESPACE="knative-serving"
SYSTEM_NAMESPACE=$KNATIVE_DEFAULT_NAMESPACE
export KIND=true
export CLUSTER_DOMAIN="${{ matrix.cluster-suffix }}"
install_istio $PATCHED_YAML
echo "INGRESS_CLASS=$INGRESS_CLASS" >> $GITHUB_ENV
echo "CLUSTER_DOMAIN=$CLUSTER_DOMAIN" >> $GITHUB_ENV
echo "SYSTEM_NAMESPACE=$SYSTEM_NAMESPACE" >> $GITHUB_ENV
echo "GATEWAY_OVERRIDE=$GATEWAY_OVERRIDE" >> $GITHUB_ENV
echo "GATEWAY_NAMESPACE_OVERRIDE=$GATEWAY_NAMESPACE_OVERRIDE" >> $GITHUB_ENV
echo "GATEWAY_NAMESPACE_OVERRIDE=istio-system" >> $GITHUB_ENV
- name: Upload Test Images
run: |
# Build and Publish our test images to the docker daemon.
./test/upload-test-images.sh
- name: Wait for Serving and KIngress to be up
run: |
kubectl wait pod --for=condition=Ready -n knative-serving -l '!job-name'
kubectl wait pod --for=condition=Ready -n "${GATEWAY_NAMESPACE_OVERRIDE}" -l '!job-name'
- name: Run e2e Tests
- name: Run Test
working-directory: ./src/knative.dev/serving
run: |
set -x
# Exclude the control-plane node, which doesn't seem to expose the nodeport service.
IPS=( $(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}') )
# Run the tests tagged as e2e on the KinD cluster.
go test -race -count=1 -timeout=20m -tags=e2e ${{ matrix.test-suite }} \
--ingressendpoint="${IPS[0]}" \
Expand Down
13 changes: 13 additions & 0 deletions hack/generate-yamls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set -o pipefail

readonly YAML_REPO_ROOT=${1:?"First argument must be the repo root dir"}
readonly YAML_LIST_FILE=${2:?"Second argument must be the output file"}
readonly YAML_ENV_FILE=${3:-$(mktemp)}

# Set output directory
if [[ -z "${YAML_OUTPUT_DIR:-}" ]]; then
Expand Down Expand Up @@ -134,3 +135,15 @@ ${SERVING_DOMAINMAPPING_CRD_YAML}
${SERVING_CRD_YAML}
${SERVING_NSCERT_YAML}
EOF

cat << EOF > "${YAML_ENV_FILE}"
export SERVING_CORE_YAML=${SERVING_CORE_YAML}
export SERVING_DEFAULT_DOMAIN_YAML=${SERVING_DEFAULT_DOMAIN_YAML}
export SERVING_STORAGE_VERSION_MIGRATE_YAML=${SERVING_STORAGE_VERSION_MIGRATE_YAML}
export SERVING_POST_INSTALL_JOBS_YAML=${SERVING_POST_INSTALL_JOBS_YAML}
export SERVING_HPA_YAML=${SERVING_HPA_YAML}
export SERVING_DOMAINMAPPING_YAML=${SERVING_DOMAINMAPPING_YAML}
export SERVING_DOMAINMAPPING_CRD_YAML=${SERVING_DOMAINMAPPING_CRD_YAML}
export SERVING_CRD_YAML=${SERVING_CRD_YAML}
export SERVING_NSCERT_YAML=${SERVING_NSCERT_YAML}
EOF
28 changes: 0 additions & 28 deletions test/config/100-namespace.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions test/config/300-configmap.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions test/config/300-secret.yaml

This file was deleted.

59 changes: 0 additions & 59 deletions test/config/config-logging.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions test/config/config-observability.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions test/config/ytt/core/overlay-activator-min-replicas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")

#@ load("helpers.lib.yaml", "system_resource")

#@overlay/match by=system_resource(name="activator", kind="HorizontalPodAutoscaler"), expects=1
---
#@overlay/match-child-defaults missing_ok=True
spec:
minReplicas: 15
maxReplicas: 15
16 changes: 16 additions & 0 deletions test/config/ytt/core/overlay-cluster-local-override.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:yaml", "yaml")
#@ load("@ytt:data", "data")

#@ def rename_cluster_domain(old, new):
#@ def replace(left, right):
#@ yaml_left = yaml.encode(left)
#@ yaml_left = yaml_left.replace(old, new)
#@ return yaml.decode(yaml_left)
#@ end
#@ return replace
#@ end

#@overlay/match by=overlay.all, expects="1+"
#@overlay/replace via=rename_cluster_domain("cluster.local", data.values.k8s.cluster.domain)
---
8 changes: 8 additions & 0 deletions test/config/ytt/core/overlay-config-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#@ load("@ytt:overlay", "overlay")
#@ load("helpers.lib.yaml", "system_configmap")

#@overlay/match by=system_configmap("config-deployment"), expects=1
---
#@overlay/match-child-defaults missing_ok=True
data:
progressDeadline: "120s"
38 changes: 38 additions & 0 deletions test/config/ytt/core/overlay-config-logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#@ load("@ytt:overlay", "overlay")
#@ load("helpers.lib.yaml", "system_configmap")

#@overlay/match by=system_configmap("config-logging"), expects=1
---
#@overlay/match-child-defaults missing_ok=True
data:
zap-logger-config: |
{
"level": "debug",
"development": false,
"outputPaths": ["stdout"],
"errorOutputPaths": ["stderr"], "encoding": "json",
"encoderConfig": {
"timeKey": "timestamp",
"levelKey": "severity",
"nameKey": "logger",
"callerKey": "caller",
"messageKey": "message",
"stacktraceKey": "stacktrace",
"lineEnding": "",
"levelEncoder": "",
"timeEncoder": "iso8601",
"durationEncoder": "",
"callerEncoder": ""
}
}
loglevel.controller: "debug"
loglevel.autoscaler: "debug"
loglevel.queueproxy: "debug"
loglevel.webhook: "debug"
loglevel.activator: "debug"
loglevel.hpaautoscaler: "debug"
loglevel.domainmapping: "debug"
loglevel.certcontroller: "debug"
loglevel.istiocontroller: "debug"
loglevel.nscontroller: "debug"
Loading

0 comments on commit e2a8237

Please sign in to comment.