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

fix: support resolveGranularity of ApisixRoute #1251

Merged
merged 14 commits into from
Sep 9, 2022

Conversation

AlinsRan
Copy link
Contributor

@AlinsRan AlinsRan commented Aug 18, 2022

Type of change:

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

What this PR does / why we need it:

ref:

fixes:

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@AlinsRan AlinsRan marked this pull request as ready for review August 19, 2022 09:23
@AlinsRan AlinsRan changed the title fix: resolveGranularity of ApisixRoute fix: support resolveGranularity of ApisixRoute Aug 22, 2022
@lingsamuel lingsamuel self-requested a review August 23, 2022 08:06
@tao12345666333 tao12345666333 self-assigned this Aug 30, 2022
@tao12345666333 tao12345666333 added this to the v1.6.0 milestone Aug 30, 2022
return nil
}

func (u *upstreamService) Create(ctx context.Context, relation *v1.UpstreamServiceRelation) error {
// to do: delete one of
Copy link
Member

Choose a reason for hiding this comment

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

What does it mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Delete one of the upstreams. Currently, only service is deleted. There will be some redundant objects, but the results will not be affected.

@tao12345666333
Copy link
Member

Also, please adjust your parameter order

func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2022

Codecov Report

Merging #1251 (a407b4a) into master (866d40f) will increase coverage by 1.15%.
The diff coverage is 55.00%.

@@            Coverage Diff             @@
##           master    #1251      +/-   ##
==========================================
+ Coverage   39.77%   40.92%   +1.15%     
==========================================
  Files          75       75              
  Lines        6967     6954      -13     
==========================================
+ Hits         2771     2846      +75     
+ Misses       3897     3795     -102     
- Partials      299      313      +14     
Impacted Files Coverage Δ
pkg/apisix/apisix.go 61.36% <ø> (ø)
.../providers/gateway/translation/gateway_tlsroute.go 0.00% <0.00%> (ø)
pkg/providers/ingress/translation/translator.go 0.00% <0.00%> (ø)
pkg/providers/apisix/translation/apisix_route.go 19.14% <25.00%> (ø)
pkg/apisix/nonexistentclient.go 43.27% <50.00%> (ø)
pkg/apisix/upstreamservicerelation.go 62.85% <64.70%> (+59.15%) ⬆️
pkg/apisix/upstream.go 53.69% <100.00%> (+13.95%) ⬆️
...kg/providers/apisix/translation/apisix_upstream.go 100.00% <100.00%> (ø)
...providers/gateway/translation/gateway_httproute.go 64.10% <100.00%> (ø)
... and 4 more

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

@AlinsRan AlinsRan requested review from tao12345666333 and removed request for tokers and lingsamuel September 6, 2022 06:30
@AlinsRan
Copy link
Contributor Author

AlinsRan commented Sep 6, 2022

Also, please adjust your parameter order

func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

Done.

pkg/providers/apisix/apisix_upstream.go Outdated Show resolved Hide resolved
pkg/providers/k8s/endpoint/base.go Outdated Show resolved Hide resolved
pkg/types/apisix/v1/types.go Outdated Show resolved Hide resolved
pkg/types/apisix/v1/types.go Outdated Show resolved Hide resolved
@tao12345666333
Copy link
Member

I want you can add an e2e test case to cover #870, thanks!

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

thanks

pkg/apisix/upstreamservicerelation.go Outdated Show resolved Hide resolved
pkg/apisix/upstreamservicerelation.go Outdated Show resolved Hide resolved
pkg/apisix/upstreamservicerelation.go Outdated Show resolved Hide resolved
pkg/apisix/upstreamservicerelation.go Outdated Show resolved Hide resolved
pkg/apisix/upstreamservicerelation.go Outdated Show resolved Hide resolved
if err != nil {
if err == apisixcache.ErrNotFound {
continue
update := func(upsName string) error {
Copy link
Member

@lingsamuel lingsamuel Sep 9, 2022

Choose a reason for hiding this comment

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

Can it be a function instead of a local variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but it has many contexts, requires more parameters, and can't be reused. I do not recommend this.

pkg/providers/k8s/endpoint/base.go Outdated Show resolved Hide resolved
pkg/providers/k8s/endpoint/base.go Outdated Show resolved Hide resolved
pkg/providers/k8s/endpoint/base.go Outdated Show resolved Hide resolved
pkg/types/apisix/v1/types.go Show resolved Hide resolved
@AlinsRan AlinsRan requested review from lingsamuel and removed request for tokers and gxthrj September 9, 2022 09:29
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.

None yet

4 participants