Skip to content

Commit 252cb06

Browse files
committed
Merge branch 'release-v2-dev' into feat/apisix-standalone
2 parents e458da5 + 3899e70 commit 252cb06

37 files changed

+1567
-1780
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: APISIX E2E Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-v2-dev
8+
pull_request:
9+
branches:
10+
- master
11+
- release-v2-dev
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
prepare:
19+
name: Prepare
20+
runs-on: buildjet-2vcpu-ubuntu-2204
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Go Env
26+
id: go
27+
uses: actions/setup-go@v4
28+
with:
29+
go-version: "1.22"
30+
31+
- name: Install kind
32+
run: |
33+
go install sigs.k8s.io/[email protected]
34+
35+
e2e-test:
36+
needs:
37+
- prepare
38+
runs-on: buildjet-2vcpu-ubuntu-2204
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
submodules: recursive
44+
45+
- name: Setup Go Env
46+
uses: actions/setup-go@v4
47+
with:
48+
go-version: "1.22"
49+
50+
- name: Build images
51+
env:
52+
TAG: dev
53+
ARCH: amd64
54+
ENABLE_PROXY: "false"
55+
BASE_IMAGE_TAG: "debug"
56+
run: |
57+
echo "building images..."
58+
make build-image
59+
60+
- name: Launch Kind Cluster
61+
run: |
62+
make kind-up
63+
64+
- name: Install Gateway API And CRDs
65+
run: |
66+
make install
67+
68+
- name: Run E2E test suite
69+
shell: bash
70+
run: |
71+
make e2e-test-standalone

.github/workflows/push-docker.yaml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
name: push on dockerhub
22
on:
3-
release:
4-
types: [published]
3+
push:
4+
tags:
5+
- '*'
56

67
jobs:
78
docker:
8-
runs-on: ubuntu-20.04
9+
runs-on: buildjet-2vcpu-ubuntu-2204
910
steps:
10-
-
11-
name: Checkout
12-
uses: actions/checkout@v3
11+
- name: Checkout
12+
uses: actions/checkout@v4
1313
with:
14-
ref: ${{ github.ref }} # Use the reference to the release
15-
-
16-
name: Set up QEMU
14+
ref: ${{ github.ref }}
15+
submodules: recursive
16+
- name: Setup Go Env
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: "1.22"
20+
21+
- name: Set up QEMU
1722
uses: docker/setup-qemu-action@v3
18-
-
19-
name: Set up Docker Buildx
23+
24+
- name: Set up Docker Buildx
2025
uses: docker/setup-buildx-action@v3
21-
-
22-
name: Login to Docker Hub
26+
27+
- name: Login to Registry
2328
uses: docker/login-action@v3
2429
with:
2530
registry: ${{ secrets.DOCKER_REGISTRY }}
2631
username: ${{ secrets.DOCKER_USERNAME }}
2732
password: ${{ secrets.DOCKER_PASSWORD }}
2833
-
29-
name: Build and push
30-
uses: docker/build-push-action@v5
31-
with:
32-
context: .
33-
platforms: linux/amd64,linux/arm64
34-
push: true
35-
tags: '${{ github.event.release.tag_name }}' # Use the release tag as the image tag
34+
name: Build and push multi-arch image
35+
env:
36+
TAG: ${{ github.ref_name }}
37+
IMAGE_TAG: ${{ github.ref_name }}
38+
run: |
39+
echo "building multi-arch images with tag: $TAG"
40+
make build-push-multi-arch-image

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ENVTEST_K8S_VERSION = 1.30.0
1212
KIND_NAME ?= apisix-ingress-cluster
1313
GATEAY_API_VERSION ?= v1.2.0
1414

15-
DASHBOARD_VERSION ?= v3.8.0
16-
TEST_TIMEOUT ?= 45m
15+
DASHBOARD_VERSION ?= dev
16+
TEST_TIMEOUT ?= 60m
1717

1818
# CRD Reference Documentation
1919
CRD_REF_DOCS_VERSION ?= v0.1.0
@@ -111,6 +111,11 @@ e2e-test:
111111
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
112112
DASHBOARD_VERSION=$(DASHBOARD_VERSION) go test ./test/e2e/ -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
113113

114+
.PHONY: e2e-test-standalone
115+
e2e-test-standalone:
116+
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
117+
go test ./test/e2e/apisix/ -test.timeout=$(TEST_TIMEOUT) -v -ginkgo.v -ginkgo.focus="$(TEST_FOCUS)"
118+
114119
.PHONY: download-api7ee3-chart
115120
download-api7ee3-chart:
116121
@helm repo add api7 https://charts.api7.ai || true

cmd/root/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
// to ensure that exec-entrypoint and run can make use of them.
2121

2222
"go.uber.org/zap/zapcore"
23-
"gopkg.in/yaml.v2"
23+
"gopkg.in/yaml.v3"
2424
_ "k8s.io/client-go/plugin/pkg/client/auth"
2525

2626
"github.com/go-logr/zapr"

go.mod

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ toolchain go1.22.5
77
require (
88
github.com/Masterminds/sprig/v3 v3.2.3
99
github.com/api7/gopkg v0.2.1-0.20230601092738-0f3730f9b57a
10-
github.com/gavv/httpexpect v2.0.0+incompatible
1110
github.com/gavv/httpexpect/v2 v2.16.0
1211
github.com/go-logr/logr v1.4.2
1312
github.com/go-logr/zapr v1.3.0
@@ -28,13 +27,13 @@ require (
2827
go.uber.org/zap v1.27.0
2928
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
3029
golang.org/x/net v0.28.0
31-
gopkg.in/yaml.v2 v2.4.0
32-
gorm.io/gorm v1.25.11
30+
gopkg.in/yaml.v3 v3.0.1
3331
helm.sh/helm/v3 v3.15.4
3432
k8s.io/api v0.31.1
3533
k8s.io/apiextensions-apiserver v0.31.1
3634
k8s.io/apimachinery v0.31.1
3735
k8s.io/client-go v0.31.1
36+
k8s.io/kubectl v0.30.3
3837
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
3938
sigs.k8s.io/controller-runtime v0.19.0
4039
sigs.k8s.io/gateway-api v1.2.0
@@ -80,7 +79,6 @@ require (
8079
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
8180
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
8281
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
83-
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
8482
github.com/fatih/color v1.17.0 // indirect
8583
github.com/fatih/structs v1.1.0 // indirect
8684
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -121,8 +119,6 @@ require (
121119
github.com/imdario/mergo v0.3.16 // indirect
122120
github.com/imkira/go-interpol v1.1.0 // indirect
123121
github.com/inconshreveable/mousetrap v1.1.0 // indirect
124-
github.com/jinzhu/inflection v1.0.0 // indirect
125-
github.com/jinzhu/now v1.1.5 // indirect
126122
github.com/jmespath/go-jmespath v0.4.0 // indirect
127123
github.com/jmoiron/sqlx v1.3.5 // indirect
128124
github.com/josharian/intern v1.0.0 // indirect
@@ -149,7 +145,6 @@ require (
149145
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
150146
github.com/modern-go/reflect2 v1.0.2 // indirect
151147
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
152-
github.com/moul/http2curl v1.0.0 // indirect
153148
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
154149
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
155150
github.com/opencontainers/go-digest v1.0.0 // indirect
@@ -211,13 +206,12 @@ require (
211206
gopkg.in/fsnotify.v1 v1.4.7 // indirect
212207
gopkg.in/inf.v0 v0.9.1 // indirect
213208
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
214-
gopkg.in/yaml.v3 v3.0.1 // indirect
209+
gopkg.in/yaml.v2 v2.4.0 // indirect
215210
k8s.io/apiserver v0.31.1 // indirect
216211
k8s.io/cli-runtime v0.30.3 // indirect
217212
k8s.io/component-base v0.31.1 // indirect
218213
k8s.io/klog/v2 v2.130.1 // indirect
219214
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect
220-
k8s.io/kubectl v0.30.3 // indirect
221215
moul.io/http2curl/v2 v2.3.0 // indirect
222216
oras.land/oras-go v1.2.5 // indirect
223217
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect

go.sum

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0
130130
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
131131
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM=
132132
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
133-
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc=
134-
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
135133
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
136134
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
137135
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
@@ -147,8 +145,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
147145
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
148146
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
149147
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
150-
github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8=
151-
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
152148
github.com/gavv/httpexpect/v2 v2.16.0 h1:Ty2favARiTYTOkCRZGX7ojXXjGyNAIohM1lZ3vqaEwI=
153149
github.com/gavv/httpexpect/v2 v2.16.0/go.mod h1:uJLaO+hQ25ukBJtQi750PsztObHybNllN+t+MbbW8PY=
154150
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
@@ -244,7 +240,6 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3
244240
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
245241
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
246242
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
247-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
248243
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
249244
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
250245
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
@@ -295,10 +290,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
295290
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
296291
github.com/incubator4/go-resty-expr v0.1.1 h1:9ur1M+p0wDzL1bprdGzHugGkfK0Yd3Ba/ijcgvL+a1k=
297292
github.com/incubator4/go-resty-expr v0.1.1/go.mod h1:w9YQkQLUs1cArOb4O7SGJwJL/L8kuAo6y5CVS2o9eag=
298-
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
299-
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
300-
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
301-
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
302293
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
303294
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
304295
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -311,7 +302,6 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
311302
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
312303
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
313304
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
314-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
315305
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
316306
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
317307
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
@@ -397,8 +387,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
397387
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
398388
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
399389
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
400-
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
401-
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
402390
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
403391
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
404392
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -479,9 +467,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
479467
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
480468
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
481469
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
482-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
483470
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
484-
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
485471
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
486472
github.com/sony/sonyflake v1.1.0/go.mod h1:LORtCywH/cq10ZbyfhKrHYgAUGH7mOBa76enV9txy/Y=
487473
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
@@ -753,8 +739,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
753739
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
754740
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
755741
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
756-
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
757-
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
758742
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
759743
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
760744
helm.sh/helm/v3 v3.15.4 h1:UFHd6oZ1IN3FsUZ7XNhOQDyQ2QYknBNWRHH57e9cbHY=

internal/controller/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"text/template"
2222
"time"
2323

24-
"gopkg.in/yaml.v2"
24+
"gopkg.in/yaml.v3"
2525

2626
"github.com/apache/apisix-ingress-controller/internal/types"
2727
)

internal/controller/httproutepolicy.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ func (r *HTTPRouteReconciler) processHTTPRoutePolicies(tctx *provider.TranslateC
4646
return nil
4747
}
4848

49+
// set namespace in prentRef if it is not set
50+
var parentRefs = make([]gatewayv1.ParentReference, len(httpRoute.Spec.ParentRefs))
51+
for i := range httpRoute.Spec.ParentRefs {
52+
ref := httpRoute.Spec.ParentRefs[i]
53+
if ref.Namespace == nil || *ref.Namespace == "" {
54+
ref.Namespace = (*gatewayv1.Namespace)(&httpRoute.Namespace)
55+
}
56+
parentRefs[i] = ref
57+
}
58+
4959
var conflicts = make(map[types.NamespacedName]v1alpha1.HTTPRoutePolicy)
5060
for _, rule := range httpRoute.Spec.Rules {
5161
var policies = findPoliciesWhichTargetRefTheRule(rule.Name, "HTTPRoute", list)
@@ -71,7 +81,7 @@ func (r *HTTPRouteReconciler) processHTTPRoutePolicies(tctx *provider.TranslateC
7181
tctx.HTTPRoutePolicies = append(tctx.HTTPRoutePolicies, policy)
7282
}
7383

74-
if updated := setAncestorsForHTTPRoutePolicyStatus(httpRoute.Spec.ParentRefs, &policy, condition); updated {
84+
if updated := setAncestorsForHTTPRoutePolicyStatus(parentRefs, &policy, condition); updated {
7585
tctx.StatusUpdaters = append(tctx.StatusUpdaters, status.Update{
7686
NamespacedName: NamespacedName(&policy),
7787
Resource: policy.DeepCopy(),

0 commit comments

Comments
 (0)