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 GatewayAPI route attachment restriction #1440

Merged
merged 16 commits into from
Mar 17, 2023

Conversation

stillfox-lee
Copy link
Contributor

Type of change:

close: #1424
close: #1349

What this PR does / why we need it:

  • Add new feature for support GatewayAPI route attachment
  • Fix bug: Should not filter GatewayClass by Namespace #1424. GatewayClass is cluster scoped resource, shouldn't filter by namespace.
  • Fix Gateway sync function. Compatible with scenario: GatewayClass add event is received after the Gateway event.

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2022

Codecov Report

Merging #1440 (6c9d04d) into master (07c7d9d) will increase coverage by 0.19%.
The diff coverage is 67.44%.

❗ Current head 6c9d04d differs from pull request most recent head a02e516. Consider uploading reports for the commit a02e516 to get more accurate results

@@            Coverage Diff             @@
##           master    #1440      +/-   ##
==========================================
+ Coverage   41.48%   41.68%   +0.19%     
==========================================
  Files          89       90       +1     
  Lines        7667     7701      +34     
==========================================
+ Hits         3181     3210      +29     
- Misses       4122     4127       +5     
  Partials      364      364              
Impacted Files Coverage Δ
pkg/providers/gateway/translation/gateway.go 0.00% <0.00%> (ø)
...providers/gateway/translation/gateway_httproute.go 48.38% <ø> (ø)
pkg/providers/utils/domain.go 100.00% <100.00%> (ø)
pkg/providers/utils/string.go 26.08% <100.00%> (+26.08%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@stillfox-lee stillfox-lee changed the title Gatewayapi/route attachment feat: Support GatewayAPI route attachment restriction Nov 7, 2022
pkg/providers/utils/string.go Outdated Show resolved Hide resolved
pkg/providers/gateway/provider.go Outdated Show resolved Hide resolved
pkg/providers/gateway/provider.go Outdated Show resolved Hide resolved
pkg/providers/gateway/validator.go Outdated Show resolved Hide resolved
test/e2e/scaffold/ingress.go Show resolved Hide resolved
test/e2e/suite-gateway/route_attchment.go Outdated Show resolved Hide resolved
pkg/providers/utils/domain.go Outdated Show resolved Hide resolved
@tao12345666333 tao12345666333 added area/controller triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Nov 10, 2022
@stillfox-lee
Copy link
Contributor Author

Hi @tao12345666333 @lingsamuel @AlinsRan .
Since #1445, Gateway and HTTPRoute has been upgraded to v1beta1. But other route resources are still under v1alpha2. Hence I need to implement both v1alpha2 and v1beta1 validation to support all route resources. If we planning to support multiple versions. Why Translator just replace the older version? I'm confused about our GatewayAPI's versioning management.

@AlinsRan
Copy link
Contributor

Hi @tao12345666333 @lingsamuel @AlinsRan . Since #1445, Gateway and HTTPRoute has been upgraded to v1beta1. But other route resources are still under v1alpha2. Hence I need to implement both v1alpha2 and v1beta1 validation to support all route resources. If we planning to support multiple versions. Why Translator just replace the older version? I'm confused about our GatewayAPI's versioning management.

TCPRoute、UDPRoute etc. have not entered v1beta1.
In fact, only one version needs to be implemented, and gateway-api CRDs will be compatible with it. The final effect is that only one stable version needs to be maintained.

@tao12345666333
Copy link
Member

as @AlinsRan said
we only need maintain only one version.

@stillfox-lee
Copy link
Contributor Author

Hi @tao12345666333 @lingsamuel @AlinsRan . Since #1445, Gateway and HTTPRoute has been upgraded to v1beta1. But other route resources are still under v1alpha2. Hence I need to implement both v1alpha2 and v1beta1 validation to support all route resources. If we planning to support multiple versions. Why Translator just replace the older version? I'm confused about our GatewayAPI's versioning management.

TCPRoute、UDPRoute etc. have not entered v1beta1. In fact, only one version needs to be implemented, and gateway-api CRDs will be compatible with it. The final effect is that only one stable version needs to be maintained.

Thanks for your reply. I should RTFM at first.

@lingsamuel
Copy link
Member

The code LGTM, just need to resolve the conflicts.
Thanks for your contribution!

@stillfox-lee
Copy link
Contributor Author

@tao12345666333 I have run the golangci-lint and no errors occurred. PTAL.

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

Some imports require sorting, which is why lint fails.

Also, could you merge the master branch first?

pkg/providers/gateway/types/types.go Outdated Show resolved Hide resolved
@stillfox-lee
Copy link
Contributor Author

ping @tao12345666333 @lingsamuel . All CI passed.

@tao12345666333 tao12345666333 added this to the v1.7.0 milestone Dec 30, 2022
@tao12345666333
Copy link
Member

sorry for delay, I recently got covid-19.

plase resolve conflicts, thanks!

@stillfox-lee
Copy link
Contributor Author

@tao12345666333 All done. PTAL.

@yujinchoi-94 yujinchoi-94 mentioned this pull request Feb 1, 2023
14 tasks
@tao12345666333
Copy link
Member

Sorry for the delay, the code LGTM.

Please resolve the conflicts, thanks!

@tao12345666333
Copy link
Member

The test case job failed. Please check it. Thanks

@stillfox-lee
Copy link
Contributor Author

2023-03-08T18:02:17+08:00 error gateway/gateway.go:269 failed to record status change for Gateway resource {"error": "Operation cannot be fulfilled on gateways.gateway.networking.k8s.io \"test-gateway\": StorageError: invalid object, Code: 4, Key: /registry/gateway.networking.k8s.io/gateways/ingress-apisix-e2e-tests-default-299106829/test-gateway, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: 043033bc-3aa5-445c-b8bb-0149f5734dc2, UID in object meta: ", "name": "test-gateway", "namespace": "ingress-apisix-e2e-tests-default-299106829"}
It appears from the information above that the UID of the Gateway resource has changed, making it unable to update the Status sub-resource, which has led to the test failing. I have tested this several times in my local environment, but have been unable to replicate the issue, so I may need more time to resolve this problem.

@stillfox-lee
Copy link
Contributor Author

@tao12345666333 Please help me run the test again.

@AlinsRan
Copy link
Contributor

I will rerun the failed job.

@tao12345666333 tao12345666333 merged commit a431dd0 into apache:master Mar 17, 2023
@stillfox-lee stillfox-lee deleted the gatewayapi/route-attachment branch March 17, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controller triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

bug: Should not filter GatewayClass by Namespace feat: Support Gateway API route attachment constraints
5 participants