upgrade to istio 1.19 (#1211)

Co-authored-by: CH3CHO <ch3cho@qq.com>
Co-authored-by: rinfx <893383980@qq.com>
This commit is contained in:
澄潭
2024-08-26 09:51:47 +08:00
committed by GitHub
parent a2c2d1d521
commit f7a419770d
401 changed files with 21171 additions and 7255 deletions

View File

@@ -0,0 +1,49 @@
diff -Naur proxy-old/WORKSPACE proxy/WORKSPACE
--- proxy-old/WORKSPACE 2024-08-15 14:23:44.000000000 +0800
+++ proxy/WORKSPACE 2024-08-15 14:47:49.000000000 +0800
@@ -45,11 +45,16 @@
# To override with local envoy, just pass `--override_repository=envoy=/PATH/TO/ENVOY` to Bazel or
# persist the option in `user.bazelrc`.
-http_archive(
+# http_archive(
+# name = "envoy",
+# sha256 = ENVOY_SHA256,
+# strip_prefix = ENVOY_REPO + "-" + ENVOY_SHA,
+# url = "https://github.com/" + ENVOY_ORG + "/" + ENVOY_REPO + "/archive/" + ENVOY_SHA + ".tar.gz",
+# )
+
+local_repository(
name = "envoy",
- sha256 = ENVOY_SHA256,
- strip_prefix = ENVOY_REPO + "-" + ENVOY_SHA,
- url = "https://github.com/" + ENVOY_ORG + "/" + ENVOY_REPO + "/archive/" + ENVOY_SHA + ".tar.gz",
+ path = "/home/envoy",
)
load("@envoy//bazel:api_binding.bzl", "envoy_api_binding")
diff -Naur proxy-old/scripts/release-binary.sh proxy/scripts/release-binary.sh
--- proxy-old/scripts/release-binary.sh 2024-08-15 14:23:44.000000000 +0800
+++ proxy/scripts/release-binary.sh 2024-08-15 14:24:06.000000000 +0800
@@ -113,7 +113,7 @@
# See: https://github.com/istio/istio/issues/15714 for details.
# k8-opt is the output directory for x86_64 optimized builds (-c opt, so --config=release-symbol and --config=release).
# k8-dbg is the output directory for -c dbg builds.
-for config in release release-symbol asan debug
+for config in release release-symbol
do
case $config in
"release" )
@@ -146,9 +146,9 @@
export BUILD_CONFIG=${config}
echo "Building ${config} proxy"
- BINARY_NAME="${HOME}/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.tar.gz"
- DWP_NAME="${HOME}/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.dwp"
- SHA256_NAME="${HOME}/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.sha256"
+ BINARY_NAME="${HOME}/package/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.tar.gz"
+ DWP_NAME="${HOME}/package/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.dwp"
+ SHA256_NAME="${HOME}/package/${BINARY_BASE_NAME}-${SHA}${ARCH_SUFFIX}.sha256"
# shellcheck disable=SC2086
bazel build ${BAZEL_BUILD_ARGS} ${CONFIG_PARAMS} //:envoy_tar //:envoy.dwp
BAZEL_TARGET="${BAZEL_OUT}/envoy_tar.tar.gz"

38
tools/hack/build-envoy.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Alibaba Group Holding Ltd.
# 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 -euo pipefail
SCRIPT_DIR="$(cd "$(dirname -- "$0")" &> /dev/null && pwd)"
source "${SCRIPT_DIR}/setup-istio-env.sh"
cd ${ROOT}/external/proxy
if patch_output=$(patch -d . -s -f --dry-run -p1 < ${SCRIPT_DIR}/build-envoy.patch 2>&1); then
patch -d . -p1 < ${SCRIPT_DIR}/build-envoy.patch
else
echo "build-envoy.patch was already patched"
fi
CONDITIONAL_HOST_MOUNTS+="--mount type=bind,source=${ROOT}/external/package,destination=/home/package "
CONDITIONAL_HOST_MOUNTS+="--mount type=bind,source=${ROOT}/external/envoy,destination=/home/envoy "
BUILD_WITH_CONTAINER=1 \
CONDITIONAL_HOST_MOUNTS=${CONDITIONAL_HOST_MOUNTS} \
BUILD_ENVOY_BINARY_ONLY=1 \
DOCKER_RUN_OPTIONS="--user root -e HTTP_PROXY -e HTTPS_PROXY" \
IMG=higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/build-tools-proxy:release-1.19-ef344298e65eeb2d9e2d07b87eb4e715c2def613 \
make test_release

38
tools/hack/build-istio-image.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Alibaba Group Holding Ltd.
# 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 -euo pipefail
source "$(dirname -- "$0")/setup-istio-env.sh"
cd ${ROOT}/external/istio
rm -rf out/linux_${TARGET_ARCH};
CONDITIONAL_HOST_MOUNTS+="--mount type=bind,source=${ROOT}/external/package,destination=/home/package "
DOCKER_RUN_OPTIONS+="-e HTTP_PROXY -e HTTPS_PROXY"
GOOS_LOCAL=linux TARGET_OS=linux TARGET_ARCH=${TARGET_ARCH} \
ISTIO_ENVOY_LINUX_RELEASE_URL=${ISTIO_ENVOY_LINUX_RELEASE_URL} \
BUILD_WITH_CONTAINER=1 \
USE_REAL_USER=${USE_REAL_USER:-0} \
CONDITIONAL_HOST_MOUNTS=${CONDITIONAL_HOST_MOUNTS} \
DOCKER_BUILD_VARIANTS=default DOCKER_TARGETS="${DOCKER_TARGETS}" \
ISTIO_BASE_REGISTRY="${HUB}" \
BASE_VERSION="${HIGRESS_BASE_VERSION}" \
DOCKER_RUN_OPTIONS=${DOCKER_RUN_OPTIONS} \
IMG=higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/build-tools:release-1.19-ef344298e65eeb2d9e2d07b87eb4e715c2def613 \
make "$@"

32
tools/hack/build-istio-pilot.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Alibaba Group Holding Ltd.
# 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 -euo pipefail
source "$(dirname -- "$0")/setup-istio-env.sh"
cd ${ROOT}/external/istio
rm -rf out/linux_${TARGET_ARCH};
GOOS_LOCAL=linux TARGET_OS=linux TARGET_ARCH=${TARGET_ARCH} \
ISTIO_ENVOY_LINUX_RELEASE_URL=${ISTIO_ENVOY_LINUX_RELEASE_URL} \
BUILD_WITH_CONTAINER=1 \
CONDITIONAL_HOST_MOUNTS=${CONDITIONAL_HOST_MOUNTS} \
ISTIO_BASE_REGISTRY="${HUB}" \
BASE_VERSION="${HIGRESS_BASE_VERSION}" \
DOCKER_RUN_OPTIONS="--user root -e HTTP_PROXY -e HTTPS_PROXY" \
IMG=higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/build-tools:release-1.19-ef344298e65eeb2d9e2d07b87eb4e715c2def613 \
make build-linux

View File

@@ -69,10 +69,20 @@ else
if [ "$file" == "waf" ]; then
continue
fi
if [ -d $EXTENSIONS_DIR$file ]; then
if [ -d $EXTENSIONS_DIR$file ]; then
name=${file##*/}
echo "🚀 Build Go WasmPlugin: $name"
PLUGIN_NAME=${name} BUILDER_REGISTRY="docker.io/alihigress/plugins-" make build
version_file="$EXTENSIONS_DIR$file/VERSION"
if [ -f "$version_file" ]; then
version=$(cat "$version_file")
if ! [[ "$version" =~ -alpha$ ]]; then
echo "🚀 Build Go WasmPlugin: $name (version $version)"
PLUGIN_NAME=${name} BUILDER_REGISTRY="docker.io/alihigress/plugins-" make build
else
echo "Plugin version $version ends with '-alpha', skipping compilation for $name."
fi
else
echo "VERSION file not found for plugin $name, skipping compilation."
fi
fi
done
else

View File

@@ -39,6 +39,7 @@ shift
set -e
PROJECT_DIR=${PROJECT_DIR:-"."}
BUILD_GOOS=${GOOS:-linux}
BUILD_GOARCH=${GOARCH:-amd64}
GOBINARY=${GOBINARY:-go}
@@ -78,9 +79,14 @@ if [ "${DEBUG}" == "1" ]; then
OPTIMIZATION_FLAGS=()
fi
pushd "$PROJECT_DIR"
time GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} ${GOBINARY} build \
${V} "${GOBUILDFLAGS_ARRAY[@]}" ${GCFLAGS:+-gcflags "${GCFLAGS}"} \
-o "${OUT}" \
"${OPTIMIZATION_FLAGS[@]}" \
-pkgdir="${GOPKG}/${BUILD_GOOS}_${BUILD_GOARCH}" \
-ldflags "${LDFLAGS} ${LD_EXTRAFLAGS}" "${@}"
popd

View File

@@ -1,8 +1,8 @@
#!/bin/bash
set -e
ENVOY_VERSION="${ENVOY_VERSION:=1.20}"
ISITO_VERSION="${ISTIO_VERSION:=1.12}"
GO_VERSION=1.20
WORK_DIR=`cd $(dirname "$0")/../..;pwd`
cd $WORK_DIR
@@ -15,14 +15,11 @@ for repo in ${envoy_repos[@]}; do
if [ -e external/$repo ];then
continue
fi
cp -r envoy/${ENVOY_VERSION}/$repo external/$repo
for patch in `ls envoy/${ENVOY_VERSION}/patches/$repo/*.patch`; do
patch -d external/$repo -p1 < $patch
done
cp -r envoy/$repo external/$repo
cd external/$repo
echo "gitdir: /parent/.git/modules/envoy/${ENVOY_VERSION}/$repo" > .git
echo "gitdir: /parent/.git/modules/envoy/$repo" > .git
if [ -f "go.mod" ]; then
go mod tidy
go mod tidy -go=${GO_VERSION}
fi
cd $WORK_DIR
done
@@ -33,14 +30,11 @@ for repo in ${istio_repos[@]}; do
if [ -e external/$repo ];then
continue
fi
cp -r istio/${ISTIO_VERSION}/$repo external/$repo
for patch in `ls istio/${ISTIO_VERSION}/patches/$repo/*.patch`; do
patch -d external/$repo -p1 < $patch
done
cp -r istio/$repo external/$repo
cd external/$repo
echo "gitdir: /parent/.git/modules/istio/${ISTIO_VERSION}/$repo" > .git
echo "gitdir: /parent/.git/modules/istio/$repo" > .git
if [ -f "go.mod" ]; then
go mod tidy
go mod tidy -go=${GO_VERSION}
fi
cd $WORK_DIR
done

27
tools/hack/setup-istio-env.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Alibaba Group Holding Ltd.
# 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 -euo pipefail
TARGET_ARCH=${TARGET_ARCH-"amd64"}
ROOT=$(cd "$(dirname -- "$0")/../.." > /dev/null && pwd -P)
ISTIO_ENVOY_LINUX_RELEASE_URL="${ENVOY_PACKAGE_URL_PATTERN/ARCH/${TARGET_ARCH}}"
CONDITIONAL_HOST_MOUNTS="\
--mount "type=bind,source=${ROOT},destination=/parent" \
"