-
Notifications
You must be signed in to change notification settings - Fork 3k
[feat] support Kubernetes Gateway API #6347
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
Open
eye-gu
wants to merge
20
commits into
apache:master
Choose a base branch
from
eye-gu:fix-6346
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5dff4f5
[feat] support Kubernetes Gateway API
eye-gu 64a4a18
upgrade k8s
eye-gu c321334
upgrade k8s
eye-gu c890afb
fix review
eye-gu 045cbac
Merge branch 'master' into fix-6346
eye-gu 6624c29
ci: trigger CI re-run
eye-gu c5f6314
Merge branch 'master' into fix-6346
Aias00 226e7e5
Merge branch 'master' into fix-6346
Aias00 3118d28
fix review
eye-gu 38ed5cb
Merge branch 'master' into fix-6346
eye-gu e27b8e8
fix checkstyle
eye-gu 0484d61
chore: trigger CI re-run
eye-gu cfbcace
Merge branch 'master' into fix-6346
Aias00 9ccf112
Merge branch 'master' into fix-6346
Aias00 0df503c
Merge branch 'master' into fix-6346
Aias00 527961f
Merge branch 'master' into fix-6346
Aias00 e2bd1b3
Merge branch 'master' into fix-6346
Aias00 cac5e8f
Merge branch 'master' into fix-6346
Aias00 64c8539
Merge branch 'master' into fix-6346
Aias00 e68b4fb
Merge branch 'master' into fix-6346
Aias00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,208 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You 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. | ||
|
|
||
| name: it-k8s-gateway-api | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| case: | ||
| - shenyu-integrated-test-k8s-gateway-api-http | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'apache/shenyu' | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - uses: ./actions/paths-filter | ||
| id: filter | ||
| with: | ||
| filters: | | ||
| k8s-gateway-api: | ||
| - 'shenyu-integrated-test-k8s-gateway-api*/**' | ||
| - 'shenyu-*/**' | ||
| - 'pom.xml' | ||
| - '**/pom.xml' | ||
| - 'shenyu-examples/**' | ||
| - '!**/*.md' | ||
| - '!**/*.txt' | ||
| - '!resources/static/**' | ||
| - '!.asf.yaml' | ||
| - '!.gitignore' | ||
| - '!.licenserc.yaml' | ||
| - '!LICENSE' | ||
| - '!NOTICE' | ||
| - '!.github/ISSUE_TEMPLATE/**' | ||
| - '!.github/PULL_REQUEST_TEMPLATE' | ||
|
|
||
| - name: Clean Space | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| run: | | ||
| sudo rm -rf /usr/share/dotnet | ||
| sudo rm -rf /opt/ghc | ||
| sudo rm -rf "/usr/local/share/boost" | ||
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
|
|
||
| - name: Cache Maven Repos | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.m2/repository | ||
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-maven- | ||
|
|
||
| - uses: actions/setup-java@v4 | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| with: | ||
| java-version: 17 | ||
| distribution: "temurin" | ||
|
|
||
| - name: Install Go | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version: 1.21.x | ||
|
|
||
| - name: Install k8s | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| run: | | ||
| go install sigs.k8s.io/kind@v0.24.0 | ||
| curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.31.0/bin/linux/amd64/kubectl && sudo install kubectl /usr/local/bin/kubectl | ||
| kind create cluster --image=kindest/node:v1.31.0 --config=./shenyu-integrated-test/${{ matrix.case }}/deploy/kind-config.yaml | ||
|
|
||
| - name: Install mvnd | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| shell: bash | ||
| run: | | ||
| MVND_VERSION=1.0.2 | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| curl -sL https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-windows-amd64.zip -o mvnd.zip | ||
| unzip -q mvnd.zip | ||
| mkdir -p $HOME/.local | ||
| mv maven-mvnd-${MVND_VERSION}-windows-amd64 $HOME/.local/mvnd | ||
| echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH | ||
| echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV | ||
| else | ||
| curl -sL https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip -o mvnd.zip | ||
| unzip -q mvnd.zip | ||
| mkdir -p $HOME/.local | ||
| mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd | ||
| echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH | ||
| echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Build with Maven | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| shell: bash | ||
| run: | | ||
| if mvnd --version > /dev/null 2>&1; then | ||
| echo "Using mvnd for build" | ||
| mvnd -B clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true | ||
| else | ||
| echo "Falling back to maven wrapper" | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| ./mvnw.cmd -B clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true | ||
| else | ||
| ./mvnw -B clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true | ||
| fi | ||
| fi | ||
|
|
||
| - name: Build integrated tests | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| shell: bash | ||
| run: | | ||
| if mvnd --version > /dev/null 2>&1; then | ||
| echo "Using mvnd for build integrated tests" | ||
| mvnd -B clean install -Pit -DskipTests -am -f ./shenyu-integrated-test/pom.xml | ||
| else | ||
| echo "Falling back to maven wrapper for integrated tests" | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| ./mvnw.cmd -B clean install -Pit -DskipTests -am -f ./shenyu-integrated-test/pom.xml | ||
| else | ||
| ./mvnw -B clean install -Pit -DskipTests -am -f ./shenyu-integrated-test/pom.xml | ||
| fi | ||
| fi | ||
|
|
||
| - name: Build examples | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| shell: bash | ||
| run: | | ||
| if mvnd --version > /dev/null 2>&1; then | ||
| echo "Using mvnd for build examples" | ||
| mvnd -B clean install -Pexample -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml | ||
| else | ||
| echo "Falling back to maven wrapper for examples" | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| ./mvnw.cmd -B clean install -Pexample -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml | ||
| else | ||
| ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml | ||
| fi | ||
| fi | ||
|
|
||
| - name: Build k8s Cluster | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| run: bash ./shenyu-integrated-test/${{ matrix.case }}/script/build_k8s_cluster.sh | ||
|
|
||
| - name: Wait for k8s Cluster Start up | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| timeout-minutes: 15 | ||
| run: | | ||
| bash ./shenyu-integrated-test/${{ matrix.case }}/script/healthcheck.sh | ||
|
|
||
| - name: Run test | ||
| id: test | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| shell: bash | ||
| run: | | ||
| if mvnd --version > /dev/null 2>&1; then | ||
| echo "Using mvnd for running tests" | ||
| mvnd test -Pit -f ./shenyu-integrated-test/${{ matrix.case }}/pom.xml | ||
| else | ||
| echo "Falling back to maven wrapper for tests" | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| ./mvnw.cmd test -Pit -f ./shenyu-integrated-test/${{ matrix.case }}/pom.xml | ||
| else | ||
| ./mvnw test -Pit -f ./shenyu-integrated-test/${{ matrix.case }}/pom.xml | ||
| fi | ||
| fi | ||
| continue-on-error: true | ||
|
|
||
| - name: Cluster Test after Healthcheck | ||
| if: steps.filter.outputs.k8s-gateway-api == 'true' | ||
| run: | | ||
| echo "----------kubectl get all -o wide----------" | ||
| kubectl get all -o wide | ||
| echo "----------kubectl get all -n shenyu-gateway-api -o wide----------" | ||
| kubectl get all -n shenyu-gateway-api -o wide | ||
| echo "----------kubectl get events --all-namespaces----------" | ||
| kubectl get events --all-namespaces | ||
| echo "----------kubectl logs -l app=shenyu-gateway-api-controller -n shenyu-gateway-api --tail=-1----------" | ||
| kubectl logs -l app=shenyu-gateway-api-controller -n shenyu-gateway-api --tail=-1 | ||
| if [[ ${{steps.test.outcome}} == "failure" ]]; then | ||
| echo "Test Failed" | ||
| exit 1 | ||
| else | ||
| echo "Test Successful" | ||
| exit 0 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You 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. | ||
|
|
||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: GatewayClass | ||
| metadata: | ||
| name: shenyu | ||
| spec: | ||
| controllerName: gateway.shenyu.apache.org/shenyu-controller | ||
| --- | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: shenyu-gateway | ||
| annotations: | ||
| shenyu.apache.org/loadbalancer: p2c | ||
| spec: | ||
| gatewayClassName: shenyu | ||
| listeners: | ||
| - name: http | ||
| port: 9195 | ||
| protocol: HTTP | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: Same | ||
| --- | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: demo-http-route | ||
| spec: | ||
| parentRefs: | ||
| - name: shenyu-gateway | ||
| rules: | ||
| - matches: | ||
| - path: | ||
| type: PathPrefix | ||
| value: /order | ||
| backendRefs: | ||
| - name: shenyu-examples-http-service | ||
| port: 8189 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
shenyu-integrated-test/shenyu-integrated-test-k8s-gateway-api-http/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you 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. | ||
|
|
||
| FROM eclipse-temurin:17-centos7 | ||
|
|
||
| ENV APP_NAME shenyu-integrated-test-k8s-gateway-api-http | ||
| ENV LOCAL_PATH /opt/${APP_NAME} | ||
|
|
||
| RUN mkdir -p ${LOCAL_PATH} | ||
|
|
||
| ADD target/${APP_NAME}.jar ${LOCAL_PATH} | ||
|
|
||
| WORKDIR ${LOCAL_PATH} | ||
| EXPOSE 9195 | ||
|
|
||
| CMD java -jar ${APP_NAME}.jar |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.