Skip to content

Commit 191bc5f

Browse files
[release-0.22] precompute istio manifests (#589)
* precompute istio manifests * don't label namespace that doesn't exist * use proper mesh configuration * quote the selector so kubectl try to install extra resources * fix codegen scripts to work with run_go_tool * fix github action runs * apply the required config-istio * ensure correct config-istio is applied for the test * speed up e2e by building only linux/amd64 images * disable conformance tests in mesh mode * fix comment and link tracking issue * disable enable-virtualservice-status for istio-latest * move ytt invocation to a function so it's clear what's going on * inline install-config-istio script in e2e-common.sh and github workflows Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
1 parent 3e07329 commit 191bc5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+111478
-136
lines changed

.github/workflows/kind-e2e.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,20 @@ jobs:
132132
set -o pipefail
133133
134134
# Replace cluster.local with random suffix.
135-
sed -ie "s/cluster\.local/${CLUSTER_SUFFIX}/g" third_party/istio-${{ matrix.istio-version }}/istio-kind-no-mesh.yaml
135+
sed -ie "s/cluster\.local/${CLUSTER_SUFFIX}/g" third_party/istio-${{ matrix.istio-version }}/istio-kind-no-mesh/istio.yaml
136136
137137
# Deploy Istio
138-
./third_party/istio-${{ matrix.istio-version }}/install-istio.sh istio-kind-no-mesh.yaml
138+
./third_party/istio-${{ matrix.istio-version }}/install-istio.sh istio-kind-no-mesh
139139
140140
# Build and Publish our containers to the docker daemon (including test assets)
141141
export GO111MODULE=on
142142
export GOFLAGS=-mod=vendor
143-
ko resolve -f test/config/ -f config/ | kubectl apply -f -
143+
ko resolve --platform=linux/amd64 -f test/config/ -f config/ | kubectl apply -f -
144+
145+
CONFIG_ISTIO="./third_party/istio-${{ matrix.istio-version }}/istio-kind-no-mesh/config-istio.yaml"
146+
if [[ -f "${CONFIG_ISTIO}" ]]; then
147+
kubectl apply -f "${CONFIG_ISTIO}"
148+
fi
144149
145150
echo "GATEWAY_NAMESPACE_OVERRIDE=istio-system" >> $GITHUB_ENV
146151

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ described below.
7474
Run the following command to install Istio for development purpose:
7575

7676
```shell
77-
third_party/istio-stable/install-istio.sh istio-ci-no-mesh.yaml
77+
third_party/istio-stable/install-istio.sh istio-ci-no-mesh
7878
```
7979

8080
### Install Knative Serving

hack/release.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
# at https://github.com/knative/hack#using-the-releasesh-helper-script
1919

2020
source $(dirname $0)/../vendor/knative.dev/hack/release.sh
21-
source $(dirname $0)/../third_party/download-istio.sh
2221

2322
# Yaml files to generate, and the source config dir for them.
2423
declare -A COMPONENTS
@@ -66,18 +65,8 @@ function build_release() {
6665
done
6766

6867
# Build Istio YAML
69-
ISTIO_STABLE="$(dirname $0)/../third_party/istio-stable"
70-
ISTIO_VERSION=$(awk '/download_istio/ {print $2}' ${ISTIO_STABLE}/install-istio.sh)
71-
ISTIO_YAML="istio.yaml"
72-
73-
echo "Downloading Istio"
74-
download_istio $ISTIO_VERSION
75-
trap cleanup_istio EXIT
76-
77-
echo "Assembling istio.yaml"
78-
# `istiocl manifest generate` doesn't create the `istio-system` namespace
79-
cat "${ISTIO_STABLE}/extra/istio-namespace.yaml" > ${ISTIO_YAML}
80-
${ISTIO_DIR}/bin/istioctl manifest generate -f $(realpath "${ISTIO_STABLE}/istio-ci-no-mesh.yaml") >> ${ISTIO_YAML}
68+
ISTIO_YAML="$(dirname $0)/../third_party/istio-stable/istio-ci-no-mesh/istio.yaml"
69+
ISTIO_YAML="$(realpath $ISTIO_YAML)"
8170
all_yamls+=(${ISTIO_YAML})
8271

8372
ARTIFACTS_TO_PUBLISH="${all_yamls[@]}"

hack/update-codegen.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh
2222

2323
# If we run with -mod=vendor here, then generate-groups.sh looks for vendor files in the wrong place.
2424
export GOFLAGS=-mod=
25+
# hack's codegen shell library overrides GOBIN
26+
# we need it on the path so run_go_tool works
27+
export PATH="${PATH}:${GOBIN}"
28+
2529

2630
echo "=== Update Codegen for $MODULE_NAME"
2731

@@ -55,3 +59,19 @@ group "Update deps post-codegen"
5559
# Make sure our dependencies are up-to-date
5660
${REPO_ROOT_DIR}/hack/update-deps.sh
5761

62+
group "Update istio generated manifests"
63+
64+
# We don't update HEAD since it changes regularly and we don't
65+
# want our presubmit checks to fail because a diff occurred
66+
# ${REPO_ROOT_DIR}/third_party/istio-head/generate_manifests.sh
67+
68+
# We don't update stable - manifest generate (1.8.4) seems to have
69+
# bugs where it outputs duplicate resources in a non-deterministic order.
70+
# So re-running the command will produce a diff.
71+
#
72+
# Renable this once we reach a version # where that is fixed (ie. 1.9 seems fine)
73+
# ${REPO_ROOT_DIR}/third_party/istio-stable/generate-manifests.sh
74+
75+
# Update latest cause the istioctl version seems to generate
76+
# reproducible yaml. So let's check for unexpected diffs
77+
${REPO_ROOT_DIR}/third_party/istio-latest/generate-manifests.sh

test/e2e-common.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,28 @@ function test_setup() {
5353
echo ">> Publishing test images"
5454
$(dirname $0)/upload-test-images.sh || fail_test "Error uploading test images"
5555
echo ">> Creating test resources (test/config/)"
56-
ko apply --platform=all ${KO_FLAGS} -f test/config/ || return 1
56+
ko apply --platform=linux/amd64 ${KO_FLAGS} -f test/config/ || return 1
5757
if (( MESH )); then
5858
kubectl label namespace serving-tests istio-injection=enabled
59-
kubectl label namespace serving-tests-alt istio-injection=enabled
6059
fi
6160

6261
# Bringing up controllers.
6362
echo ">> Bringing up Istio"
6463
local istio_dir=third_party/istio-${ISTIO_VERSION}
65-
#kubectl apply -f ${istio_dir}/istio-crds.yaml || return 1
66-
#echo ">> Running Istio"
67-
${istio_dir}/install-istio.sh istio-ci-no-mesh.yaml || return 1
64+
local istio_profile=istio-ci-no-mesh
65+
66+
if (( MESH )); then
67+
istio_profile=istio-ci-mesh
68+
fi
69+
70+
${istio_dir}/install-istio.sh ${istio_profile} || return 1
71+
6872
echo ">> Bringing up net-istio Ingress Controller"
69-
ko apply --platform=all -f config/ || return 1
73+
ko apply --platform=linux/amd64 -f config/ || return 1
74+
75+
if [[ -f "${istio_dir}/${istio_profile}/config-istio.yaml" ]]; then
76+
kubectl apply -f "${istio_dir}/${istio_profile}/config-istio.yaml"
77+
fi
7078

7179
scale_controlplane networking-istio istio-webhook
7280

test/e2e-tests.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ source $(dirname $0)/e2e-common.sh
2020
# Script entry point.
2121
initialize $@ --skip-istio-addon
2222

23-
go_test_e2e -timeout=60m ./test/conformance --parallel 12 \
24-
--enable-beta --enable-alpha || fail_test
23+
# TODO Re-enable conformance tests for mesh when everything's been fixed
24+
# https://github.com/knative-sandbox/net-istio/issues/584
25+
if [[ $MESH -eq 0 ]]; then
26+
go_test_e2e -timeout=60m ./test/conformance --parallel 12 \
27+
--enable-beta --enable-alpha || fail_test
28+
fi
2529

2630
go_test_e2e -timeout=10m \
2731
./test/e2e || fail_test

test/upload-test-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function upload_test_images() {
3333
sed "s@knative.dev/networking@knative.dev/net-istio/vendor/knative.dev/networking@g" $yaml \
3434
`# ko resolve is being used for the side-effect of publishing images,` \
3535
`# so the resulting yaml produced is ignored.` \
36-
| ko resolve --platform=all ${tag_option} -RBf- > /dev/null
36+
| ko resolve --platform=linux/amd64 ${tag_option} -RBf- > /dev/null
3737
done
3838
)
3939
}

third_party/download-istio.sh

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: config-istio
6+
namespace: knative-serving
7+
labels:
8+
serving.knative.dev/release: devel
9+
networking.knative.dev/ingress-provider: istio
10+
data:
11+
local-gateway.mesh: "mesh"
12+
enable-virtualservice-status: "true"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: config-istio
6+
namespace: knative-serving
7+
labels:
8+
serving.knative.dev/release: devel
9+
networking.knative.dev/ingress-provider: istio
10+
data:
11+
enable-virtualservice-status: "true"

0 commit comments

Comments
 (0)