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

feat: support nacos storage #796

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bd58388
feat: support nacos storage
sjcsjc123 Jan 22, 2024
625c61d
recover something
sjcsjc123 Jan 22, 2024
d848bb8
recover something
sjcsjc123 Jan 22, 2024
e8888cb
recover something
sjcsjc123 Jan 22, 2024
d01a220
simple
sjcsjc123 Jan 22, 2024
d8bb8d3
fix bug
sjcsjc123 Jan 23, 2024
5aed7f4
modify nacos image
sjcsjc123 Jan 23, 2024
0ffcc30
update nacos image in Makefile
sjcsjc123 Jan 23, 2024
c0c4e38
add nacos client
sjcsjc123 Jan 23, 2024
8eb8f5b
add ci for nacos storage
sjcsjc123 Jan 23, 2024
9bb4920
delete something
sjcsjc123 Jan 23, 2024
31ca385
fix bug with start fail
sjcsjc123 Jan 23, 2024
b5fd8a7
rename make
sjcsjc123 Jan 23, 2024
85b8274
opt import
sjcsjc123 Jan 23, 2024
370d386
update e2e
sjcsjc123 Jan 24, 2024
01c08fe
opt import
sjcsjc123 Jan 24, 2024
06651de
recover something
sjcsjc123 Jan 24, 2024
35c5db1
modify default falg value
sjcsjc123 Jan 24, 2024
9449862
make ci print simple
sjcsjc123 Jan 24, 2024
ecb2672
update apply
sjcsjc123 Jan 24, 2024
62c421a
update apply
sjcsjc123 Jan 24, 2024
2e72259
add wasm+nacos ci
sjcsjc123 Jan 24, 2024
0c83d5f
update wasm+nacos ci
sjcsjc123 Jan 24, 2024
0715626
fix ci
sjcsjc123 Jan 24, 2024
62cb1dd
fix bug with wasm plugin
sjcsjc123 Jan 24, 2024
8ce8df9
Merge branch 'main' into helm/nacos-storage
sjcsjc123 Jan 27, 2024
cd3527e
Merge branch 'main' into helm/nacos-storage
sjcsjc123 Jan 31, 2024
4b5cd88
fix ci
sjcsjc123 Feb 1, 2024
a3ecec7
Merge branch 'main' into helm/nacos-storage
sjcsjc123 Feb 1, 2024
9349772
fix ci
sjcsjc123 Feb 1, 2024
a3b114b
fix ci
sjcsjc123 Feb 1, 2024
41bd16a
Merge branch 'main' into helm/nacos-storage
johnlanni Feb 3, 2024
598aaf0
Merge branch 'main' into helm/nacos-storage
johnlanni Feb 20, 2024
a8af197
Merge branch 'main' into helm/nacos-storage
sjcsjc123 Feb 28, 2024
6cd64b4
update nacos image
sjcsjc123 Feb 29, 2024
5575512
update nacos image
sjcsjc123 Feb 29, 2024
81810c0
fix ci
sjcsjc123 Feb 29, 2024
daba6c7
fix ci
sjcsjc123 Feb 29, 2024
32a6786
fix ci
sjcsjc123 Mar 1, 2024
0a425dd
fix ci
sjcsjc123 Mar 1, 2024
0f270ce
Merge branch 'main' into helm/nacos-storage
sjcsjc123 Mar 27, 2024
b306f61
Merge branch 'main' into helm/nacos-storage
johnlanni Apr 1, 2024
688442b
Merge branch 'main' into helm/nacos-storage
johnlanni Apr 23, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/build-and-test-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,43 @@ jobs:
- name: "Run Ingress WasmPlugins Tests"
run: GOPROXY="https://proxy.golang.org,direct" PLUGIN_TYPE=${{ matrix.wasmPluginType }} make higress-wasmplugin-test

higress-wasmplugin-test-nacos:
runs-on: ubuntu-latest
strategy:
matrix:
wasmPluginType: [ GO ]
wasmPluginName: [ request-block ]
steps:
- uses: actions/checkout@v3

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Setup Golang Caches
uses: actions/cache@v3
with:
path: |-
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-go

- name: Setup Submodule Caches
uses: actions/cache@v3
with:
path: |-
.git/modules
key: ${{ runner.os }}-submodules-cache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-submodules-cache

- run: git stash # restore patch

- name: "Run Ingress WasmPlugins Tests"
run: GOPROXY="https://proxy.golang.org,direct" PLUGIN_TYPE=${{ matrix.wasmPluginType }} PLUGIN_NAME=${{ matrix.wasmPluginName }} make higress-wasmplugin-test

publish:
runs-on: ubuntu-latest
needs: [higress-wasmplugin-test]
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,41 @@ jobs:

- name: "Run Higress E2E Conformance Tests"
run: GOPROXY="https://proxy.golang.org,direct" make higress-conformance-test


higress-conformance-test-nacos:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/checkout@v3

- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Setup Golang Caches
uses: actions/cache@v3
with:
path: |-
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-go

- name: Setup Submodule Caches
uses: actions/cache@v3
with:
path: |-
.git/modules
key: ${{ runner.os }}-submodules-cache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-submodules-cache

- run: git stash # restore patch

- name: "Run Higress E2E Conformance Nacos Tests"
run: GOPROXY="https://proxy.golang.org,direct" make higress-conformance-test-nacos

publish:
runs-on: ubuntu-latest
needs: [higress-conformance-test,gateway-conformance-test]
Expand Down
52 changes: 46 additions & 6 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ install-dev: pre-install
helm install higress helm/core -n higress-system --create-namespace --set 'controller.tag=$(TAG)' --set 'gateway.replicas=1' --set 'pilot.tag=$(ISTIO_LATEST_IMAGE_TAG)' --set 'gateway.tag=$(ENVOY_LATEST_IMAGE_TAG)' --set 'global.local=true'
install-dev-wasmplugin: build-wasmplugins pre-install
helm install higress helm/core -n higress-system --create-namespace --set 'controller.tag=$(TAG)' --set 'gateway.replicas=1' --set 'pilot.tag=$(ISTIO_LATEST_IMAGE_TAG)' --set 'gateway.tag=$(ENVOY_LATEST_IMAGE_TAG)' --set 'global.local=true' --set 'global.volumeWasmPlugins=true' --set 'global.onlyPushRouteCluster=false'
install-dev-nacos: pre-install
kubectl apply -f tools/hack/conf/nacos.yaml
tools/hack/gen-secret-configmap.sh
helm install higress helm/core -n higress-system --set 'controller.tag=$(TAG)' --set 'gateway.replicas=1' --set 'pilot.tag=$(ISTIO_LATEST_IMAGE_TAG)' --set 'gateway.tag=$(ENVOY_LATEST_IMAGE_TAG)' --set 'global.local=true' --set 'apiserver.enabled=true' --set 'apiserver.serverAddr="http://nacos-service.higress-system.svc.cluster.local:8848"'
install-dev-wasmplugin-nacos: build-wasmplugins pre-install
kubectl apply -f tools/hack/conf/nacos.yaml
tools/hack/gen-secret-configmap.sh
helm install higress helm/core -n higress-system --set 'controller.tag=$(TAG)' --set 'gateway.replicas=1' --set 'pilot.tag=$(ISTIO_LATEST_IMAGE_TAG)' --set 'gateway.tag=$(ENVOY_LATEST_IMAGE_TAG)' --set 'global.local=true' --set 'apiserver.enabled=true' --set 'apiserver.serverAddr="http://nacos-service.higress-system.svc.cluster.local:8848"' --set 'global.volumeWasmPlugins=true' --set 'global.onlyPushRouteCluster=false'

uninstall:
helm uninstall higress -n higress-system
Expand Down Expand Up @@ -257,6 +265,19 @@ higress-wasmplugin-test: $(tools/kind) delete-cluster create-cluster docker-buil
.PHONY: higress-wasmplugin-test-clean
higress-wasmplugin-test-clean: $(tools/kind) delete-cluster

# higress-conformance-test-nacos runs ingress nacos tests.
.PHONY: higress-conformance-test-nacos
higress-conformance-test-nacos: $(tools/kind) delete-cluster create-cluster docker-build kube-load-image install-dev-nacos port-forward-nacos run-higress-e2e-test-nacos delete-cluster

# higress-wasmplugin-test-nacos runs ingress wasmplugin nacos tests.
.PHONY: higress-wasmplugin-test-nacos
higress-wasmplugin-test-nacos: $(tools/kind) delete-cluster create-cluster docker-build kube-load-image install-dev-wasmplugin-nacos port-forward-nacos run-higress-e2e-test-wasmplugin-nacos delete-cluster

.PHONY: port-forward-nacos
port-forward-nacos:
kubectl wait --timeout=10m -n higress-system deploy/nacos --for=condition=Available
kubectl port-forward -n higress-system svc/nacos-service 8848:8848 9848:9848 &

# create-cluster creates a kube cluster with kind.
.PHONY: create-cluster
create-cluster: $(tools/kind)
Expand All @@ -275,13 +296,13 @@ delete-cluster: $(tools/kind) ## Delete kind cluster.
kube-load-image: $(tools/kind) ## Install the Higress image to a kind cluster using the provided $IMAGE and $TAG.
tools/hack/kind-load-image.sh higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/higress $(TAG)
tools/hack/docker-pull-image.sh higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/dubbo-provider-demo 0.0.3-x86
tools/hack/docker-pull-image.sh docker.io/alihigress/nacos-standlone-rc3 1.0.0-RC3
tools/hack/docker-pull-image.sh docker.io/swsk33/nacos-standalone 2.2.3
tools/hack/docker-pull-image.sh docker.io/hashicorp/consul 1.16.0
tools/hack/docker-pull-image.sh docker.io/charlie1380/eureka-registry-provider v0.3.0
tools/hack/docker-pull-image.sh docker.io/bitinit/eureka latest
tools/hack/docker-pull-image.sh docker.io/alihigress/httpbin 1.0.2
tools/hack/kind-load-image.sh higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/dubbo-provider-demo 0.0.3-x86
tools/hack/kind-load-image.sh docker.io/alihigress/nacos-standlone-rc3 1.0.0-RC3
tools/hack/kind-load-image.sh docker.io/swsk33/nacos-standalone 2.2.3
tools/hack/kind-load-image.sh docker.io/hashicorp/consul 1.16.0
tools/hack/kind-load-image.sh docker.io/alihigress/httpbin 1.0.2
tools/hack/kind-load-image.sh docker.io/charlie1380/eureka-registry-provider v0.3.0
Expand Down Expand Up @@ -346,8 +367,8 @@ run-higress-e2e-test-wasmplugin:
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-gateway --for=condition=Available
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=all

# run-higress-e2e-test-wasmplugin-run starts to run ingress e2e conformance tests.
# run-higress-e2e-test-wasmplugin-run starts to run ingress e2e conformance tests.
.PHONY: run-higress-e2e-test-wasmplugin-run
run-higress-e2e-test-wasmplugin-run:
@echo -e "\n\033[36mRunning higress conformance tests...\033[0m"
Expand All @@ -356,8 +377,8 @@ run-higress-e2e-test-wasmplugin-run:
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-gateway --for=condition=Available
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=run

# run-higress-e2e-test-wasmplugin-clean starts to clean ingress e2e tests.
# run-higress-e2e-test-wasmplugin-clean starts to clean ingress e2e tests.
sjcsjc123 marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: run-higress-e2e-test-wasmplugin-clean
run-higress-e2e-test-wasmplugin-clean:
@echo -e "\n\033[36mRunning higress conformance tests...\033[0m"
Expand All @@ -366,3 +387,22 @@ run-higress-e2e-test-wasmplugin-clean:
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-gateway --for=condition=Available
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --debug=true --test-area=clean

.PHONY: run-higress-e2e-test-nacos
run-higress-e2e-test-nacos:
@echo -e "\n\033[36mRunning higress conformance tests...\033[0m"
@echo -e "\n\033[36mWaiting higress-controller to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-controller --for=condition=Available
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-gateway --for=condition=Available
go test -v -tags conformance ./test/e2e/e2e_test.go --ingress-class=higress --enableApiServer=true

.PHONY: run-higress-e2e-test-wasmplugin-nacos
run-higress-e2e-test-wasmplugin-nacos:
@echo -e "\n\033[36mRunning higress conformance tests...\033[0m"
@echo -e "\n\033[36mWaiting higress-controller to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-controller --for=condition=Available
@echo -e "\n\033[36mWaiting higress-gateway to be ready...\033[0m\n"
kubectl wait --timeout=10m -n higress-system deployment/higress-gateway --for=condition=Available
go test -v -tags conformance ./test/e2e/e2e_test.go -isWasmPluginTest=true -wasmPluginType=$(PLUGIN_TYPE) -wasmPluginName=$(PLUGIN_NAME) --ingress-class=higress --enableApiServer=true

6 changes: 5 additions & 1 deletion docker/Dockerfile.higress
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ FROM ${HUB}/base:${BASE_VERSION}
ARG TARGETARCH

COPY ${TARGETARCH:-amd64}/higress /usr/local/bin/higress
COPY wait-for-apiserver.sh /usr/local/bin/wait-for-apiserver.sh
COPY run-higress.sh /usr/local/bin/run-higress.sh

RUN chmod +x /usr/local/bin/*.sh

USER 1337:1337

ENTRYPOINT ["/usr/local/bin/higress"]
ENTRYPOINT ["/usr/local/bin/run-higress.sh"]
4 changes: 4 additions & 0 deletions docker/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@

docker.higress: BUILD_ARGS=--build-arg BASE_VERSION=${BASE_VERSION} --build-arg HUB=${HUB}
docker.higress: $(OUT_LINUX)/higress
docker.higress: docker/wait-for-apiserver.sh
docker.higress: docker/run-higress.sh
docker.higress: docker/Dockerfile.higress
$(HIGRESS_DOCKER_RULE)

docker.higress-buildx: BUILD_ARGS=--build-arg BASE_VERSION=${BASE_VERSION} --build-arg HUB=${HUB}
docker.higress-buildx: $(AMD64_OUT_LINUX)/higress
docker.higress-buildx: $(ARM64_OUT_LINUX)/higress
docker.higress: docker/wait-for-apiserver.sh
docker.higress: docker/run-higress.sh
docker.higress-buildx: docker/Dockerfile.higress
$(HIGRESS_DOCKER_BUILDX_RULE)

Expand Down
27 changes: 27 additions & 0 deletions docker/run-higress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Copyright (c) 2022 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.

args=("$@")

for arg in "${args[@]}"; do
echo "Argument: $arg"
done

/usr/local/bin/wait-for-apiserver.sh

echo "starting higress..."

exec /usr/local/bin/higress "$@"
27 changes: 27 additions & 0 deletions docker/wait-for-apiserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Copyright (c) 2022 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.

# if has HIGRESS_APISERVER_SVC env, wait for apiserver ready
if [ -n "$HIGRESS_APISERVER_SVC" ]; then
while true; do
echo "testing higress apiserver is ready to connect..."
nc -z "$HIGRESS_APISERVER_SVC" "${HIGRESS_APISERVER_PORT}"
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
fi
4 changes: 4 additions & 0 deletions helm/core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ higress: {{ include "controller.name" . }}
true
{{- end }}
{{- end }}

{{- define "apiserver.name" -}}
{{- .Values.apiserver.name | default "higress-apiserver" -}}
{{- end }}
Loading
Loading