This is an automated email from the ASF dual-hosted git repository. ronething pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push: new 14c29cc0 fix: reduce the complexity of calculating route priority (#2459) 14c29cc0 is described below commit 14c29cc05bcbac7cc570a53b834f33bde69d59fc Author: Ashing Zheng <axing...@gmail.com> AuthorDate: Sat Jul 5 23:31:49 2025 +0800 fix: reduce the complexity of calculating route priority (#2459) Signed-off-by: ashing <axing...@gmail.com> --- .github/actions/add-pr-comment | 1 + .github/workflows/apisix-conformance-test.yml | 11 ++++++++++ .gitmodules | 3 +++ internal/provider/adc/translator/httproute.go | 30 +++++++-------------------- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/actions/add-pr-comment b/.github/actions/add-pr-comment new file mode 160000 index 00000000..dd126dd8 --- /dev/null +++ b/.github/actions/add-pr-comment @@ -0,0 +1 @@ +Subproject commit dd126dd8c253650d181ad9538d8b4fa218fc31e8 diff --git a/.github/workflows/apisix-conformance-test.yml b/.github/workflows/apisix-conformance-test.yml index 014d1302..a9ca2497 100644 --- a/.github/workflows/apisix-conformance-test.yml +++ b/.github/workflows/apisix-conformance-test.yml @@ -31,6 +31,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +permissions: + pull-requests: write + jobs: prepare: name: Prepare @@ -124,3 +127,11 @@ jobs: echo '```yaml' >> report.md cat apisix-ingress-controller-conformance-report.yaml >> report.md echo '```' >> report.md + + - name: Report Conformance Test Result to PR Comment + if: ${{ github.event_name == 'pull_request' }} + uses: ./.github/actions/add-pr-comment + with: + message-id: 'apisix-conformance-test-report-${{ matrix.provider_type }}' + message-path: | + report.md diff --git a/.gitmodules b/.gitmodules index 88d541c2..ff01dee1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,6 @@ [submodule ".github/actions/markdown-link-check"] path = .github/actions/markdown-link-check url = https://github.com/gaurav-nelson/github-action-markdown-link-check.git +[submodule ".github/actions/add-pr-comment"] + path = .github/actions/add-pr-comment + url = https://github.com/mshick/add-pr-comment.git diff --git a/internal/provider/adc/translator/httproute.go b/internal/provider/adc/translator/httproute.go index 228111f5..8506bc8d 100644 --- a/internal/provider/adc/translator/httproute.go +++ b/internal/provider/adc/translator/httproute.go @@ -382,14 +382,14 @@ func (t *Translator) translateBackendRef(tctx *provider.TranslateContext, ref ga // ref: https://github.com/Kong/kubernetes-ingress-controller/blob/57472721319e2c63e56cb8540425257e8e02520f/internal/dataplane/translator/subtranslator/httproute_atc.go#L279-L296 func calculateHTTPRoutePriority(match *gatewayv1.HTTPRouteMatch, ruleIndex int, hosts []string) uint64 { const ( - // PreciseHostnameShiftBits assigns bit 43-50 for the length of hostname(max length=253). - PreciseHostnameShiftBits = 43 - // HostnameLengthShiftBits assigns bits 35-42 for the length of hostname(max length=253). - HostnameLengthShiftBits = 35 - // ExactPathShiftBits assigns bit 34 to mark if the match is exact path match. - ExactPathShiftBits = 34 - // PathLengthShiftBits assigns bits 23-32 to path length. (max length = 1024, but must start with /) - PathLengthShiftBits = 23 + // PreciseHostnameShiftBits assigns bit 31-38 for the length of hostname(max length=253). + // which has 8 bits, so the max length of hostname is 2^8-1 = 255. + PreciseHostnameShiftBits = 31 + + // HostnameLengthShiftBits assigns bits 23-30 for the length of hostname(max length=253). + // which has 8 bits, so the max length of hostname is 2^8-1 = 255. + HostnameLengthShiftBits = 23 + // MethodMatchShiftBits assigns bit 22 to mark if method is specified. MethodMatchShiftBits = 22 // HeaderNumberShiftBits assign bits 17-21 to number of headers. (max number of headers = 16) @@ -430,20 +430,6 @@ func calculateHTTPRoutePriority(match *gatewayv1.HTTPRouteMatch, ruleIndex int, priority |= (uint64(maxHostnameLength) << HostnameLengthShiftBits) } - // ExactPathShiftBits - if match.Path != nil && match.Path.Type != nil && *match.Path.Type == gatewayv1.PathMatchExact { - priority |= (1 << ExactPathShiftBits) - } - - // PathLengthShiftBits - // max length of path is 1024, but path must start with /, so we use PathLength-1 to fill the bits. - if match.Path != nil && match.Path.Value != nil { - pathLength := len(*match.Path.Value) - if pathLength > 0 { - priority |= (uint64(pathLength-1) << PathLengthShiftBits) - } - } - // MethodMatchShiftBits if match.Method != nil { priority |= (1 << MethodMatchShiftBits)