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: add Gateway UDPRoute #1278

Merged
merged 8 commits into from Oct 12, 2022

Conversation

stillfox-lee
Copy link
Contributor

@stillfox-lee stillfox-lee commented Aug 27, 2022

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What this PR does / why we need it:

Just implement basic usage. Need other PR to support UDPRoute weight feature after Upstream can create nodes by weight.

@stillfox-lee stillfox-lee marked this pull request as draft August 27, 2022 16:50
@stillfox-lee
Copy link
Contributor Author

@tao12345666333 Could you please help me rerun CI again? The unit-test passed in my local env.

@tao12345666333
Copy link
Member

sure

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2022

Codecov Report

Merging #1278 (496442c) into master (40f1372) will decrease coverage by 0.26%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1278      +/-   ##
==========================================
- Coverage   40.73%   40.47%   -0.27%     
==========================================
  Files          77       78       +1     
  Lines        7030     7076      +46     
==========================================
  Hits         2864     2864              
- Misses       3851     3897      +46     
  Partials      315      315              
Impacted Files Coverage Δ
pkg/providers/gateway/translation/gateway.go 0.00% <0.00%> (ø)
.../providers/gateway/translation/gateway_udproute.go 0.00% <0.00%> (ø)
pkg/providers/gateway/translation/translator.go 0.00% <ø> (ø)

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

Copy link
Member

@lingsamuel lingsamuel left a comment

Choose a reason for hiding this comment

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

Thanks!

@tao12345666333
Copy link
Member

@stillfox-lee could you please resolve the conflicts? thanks!

@tao12345666333
Copy link
Member

Some CI tasks failed, do you have time to deal with them?
Because some logic changes were made in some recently merged PRs
A breaking change occurred. #1251

@stillfox-lee
Copy link
Contributor Author

Some CI tasks failed, do you have time to deal with them? Because some logic changes were made in some recently merged PRs A breaking change occurred. #1251

I will fix it ASAP.

@stillfox-lee
Copy link
Contributor Author

@tao12345666333 I think this PR is ready for review.

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.

Thanks!

Comment on lines 80 to 83
client, err := s.getGatewayClientset()
assert.Nil(ginkgo.GinkgoT(), err, "get GatewayClientset failed")
route, err := client.GatewayV1alpha2().UDPRoutes(s.namespace).Get(context.TODO(), name, metav1.GetOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "get UDPRoute failed")
Copy link
Member

Choose a reason for hiding this comment

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

Usually we don't check it, instead we check whether the corresponding resource is generated in APISIX

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the semantics of CreateUDPRoute is make sure create UDPRoute successfully. If we don't check the error here, then we need to return that error and change signature like:

func (s *Scaffold) CreateUDPRoute(...) (*gatewayv1alpha2.UDPRoute, error)

And then the caller still need to check the error which CreateUDPRoute returned. Every test case which create UDPRoute need to check that error. And that will make our code more boilerplate.

So I suggest we keep this semantics. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

sorry for delay!

        udpRoute := fmt.Sprintf(_udpRouteTemplate, name, backendName, backendPort)
	err := s.CreateResourceFromString(udpRoute)
	assert.Nil(ginkgo.GinkgoT(), err, "create UDPRoute failed")

In fact we have done error checking here. So we don't need to do this repeatedly

Copy link
Member

Choose a reason for hiding this comment

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

At the same time I don't think it is necessary to add CreateUDPRoute function,
CreateResourceFromString is enough, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the same time I don't think it is necessary to add CreateUDPRoute function, CreateResourceFromString is enough, right?

The function CreateUDPRoute is mainly intended to be able to reuse code. Otherwise, other test-cases will need to copy-paste the YAML template when they need to create a UDPRoute.

Copy link
Member

Choose a reason for hiding this comment

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

These templates are all replaced by passing variables, like:

udpRoute := fmt.Sprintf(_udpRouteTemplate, name, backendName, backendPort)

I don't see a clear benefit from it

Copy link
Member

Choose a reason for hiding this comment

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

But it won't be a key to blocking this PR merge.

The main thing at the moment is the need to resolve conflicts so we can move forward

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got it. We can just use udpRoute := fmt.Sprintf(_udpRouteTemplate, name, backendName, backendPort) instead of CreateUDPRoute. And error checking should be the responsibility of the creator.

@tao12345666333
Copy link
Member

Except for the comments above, everything else is LGTM.
Also, could you merge master branch to resolve conflicts?

Then can merge this one.

@tao12345666333 tao12345666333 mentioned this pull request Sep 26, 2022
14 tasks
@stillfox-lee stillfox-lee requested review from tao12345666333 and lingsamuel and removed request for tao12345666333 and lingsamuel September 26, 2022 10:25
@stillfox-lee
Copy link
Contributor Author

@tao12345666333 It looks like CI needs your approval to run.

@stillfox-lee
Copy link
Contributor Author

First-time contributors need a maintainer to approve running workflows. Learn more.

@tao12345666333, Please approve the CI. It's weird that GitHub always identifies me as first time contributor.

@tao12345666333
Copy link
Member

This is a known issue and I'm already looking for a solution

@stillfox-lee
Copy link
Contributor Author

@tao12345666333 Please trigger CI again...

@stillfox-lee
Copy link
Contributor Author

The failed test case seems not related to this PR.

@tao12345666333
Copy link
Member

all passed!

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

@tao12345666333 tao12345666333 merged commit 8a17eea into apache:master Oct 12, 2022
@tao12345666333 tao12345666333 linked an issue Oct 12, 2022 that may be closed by this pull request
14 tasks
@stillfox-lee stillfox-lee deleted the feat/gatewayapi-udp branch October 12, 2022 02:33
shareinto pushed a commit to shareinto/apisix-ingress-controller that referenced this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

feat: GatewayAPI Support
4 participants