You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/07 10:24:21 UTC
[GitHub] [apisix-ingress-controller] gxthrj opened a new pull request #576: feat: add logic for ApisixRoute v2beta1
gxthrj opened a new pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576
Please answer these questions before submitting a pull request
- Why submit this pull request?
- [ ] Bugfix
- [x] New feature provided
- [ ] Improve performance
- [ ] Backport patches
- Related issues
#116 #396
___
### Bugfix
- Description
- How to fix?
___
### New feature or improvement
- Describe the details and related test reports.
___
### Backport patches
- Why need to backport?
- Source branch
- Related commits and pull requests
- Target branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter commented on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a86c0f) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.67%`.
> The diff coverage is `2.66%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.35% -1.68%
==========================================
Files 54 54
Lines 4556 4761 +205
==========================================
- Hits 1596 1588 -8
- Misses 2742 2952 +210
- Partials 218 221 +3
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.12% <0.00%> (-0.01%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `45.88% <ø> (ø)` | |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `23.38% <0.00%> (-1.80%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...5a86c0f](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c3da51b) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.69%`.
> The diff coverage is `9.57%`.
> :exclamation: Current head c3da51b differs from pull request most recent head 843d85d. Consider uploading reports for the commit 843d85d to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.34% -1.70%
==========================================
Files 54 55 +1
Lines 4556 4763 +207
==========================================
- Hits 1596 1588 -8
- Misses 2742 2952 +210
- Partials 218 223 +5
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.11% <0.00%> (-0.02%)` | :arrow_down: |
| [pkg/ingress/endpoint.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvZW5kcG9pbnQuZ28=) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `27.27% <ø> (-3.17%)` | :arrow_down: |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `44.94% <76.47%> (-0.94%)` | :arrow_down: |
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `84.31% <100.00%> (+0.31%)` | :arrow_up: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...843d85d](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667290987
##########
File path: pkg/kube/translation/util.go
##########
@@ -110,6 +111,46 @@ loop:
return svc.Spec.ClusterIP, svcPort, nil
}
+// getStreamServiceClusterIPAndPort is for v2beta1 streamRoute
+func (t *translator) getStreamServiceClusterIPAndPort(backend configv2beta1.ApisixRouteStreamBackend, ns string) (string, int32, error) {
+ svc, err := t.ServiceLister.Services(ns).Get(backend.ServiceName)
+ if err != nil {
+ return "", 0, err
+ }
+ svcPort := int32(-1)
+loop:
+ for _, port := range svc.Spec.Ports {
+ switch backend.ServicePort.Type {
+ case intstr.Int:
+ if backend.ServicePort.IntVal == port.Port {
+ svcPort = port.Port
+ break loop
+ }
+ case intstr.String:
+ if backend.ServicePort.StrVal == port.Name {
+ svcPort = port.Port
+ break loop
+ }
+ }
+ }
+ if svcPort == -1 {
+ log.Errorw("ApisixRoute refers to non-existent Service port",
+ zap.String("ApisixRoute namespace", ns),
+ zap.String("port", backend.ServicePort.String()),
+ )
+ return "", 0, err
+ }
+
+ if backend.ResolveGranularity == "service" && svc.Spec.ClusterIP == "" {
Review comment:
Yep, I moved them to the line before loop, and ditto with the other two versions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (dc70e16) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **increase** coverage by `0.22%`.
> The diff coverage is `11.85%`.
> :exclamation: Current head dc70e16 differs from pull request most recent head 9774a51. Consider uploading reports for the commit 9774a51 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
+ Coverage 35.03% 35.25% +0.22%
==========================================
Files 54 54
Lines 4556 5332 +776
==========================================
+ Hits 1596 1880 +284
- Misses 2742 3227 +485
- Partials 218 225 +7
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.29% <0.00%> (+0.17%)` | :arrow_up: |
| [pkg/ingress/endpoint.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvZW5kcG9pbnQuZ28=) | `0.00% <0.00%> (ø)` | |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `26.15% <0.61%> (-14.65%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `39.84% <23.07%> (-9.62%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `47.00% <80.00%> (+1.11%)` | :arrow_up: |
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `85.71% <100.00%> (+1.71%)` | :arrow_up: |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `31.57% <100.00%> (+1.14%)` | :arrow_up: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/nonexistentclient.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9ub25leGlzdGVudGNsaWVudC5nbw==) | `46.42% <0.00%> (-3.58%)` | :arrow_down: |
| ... and [53 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...9774a51](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d72afdc) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.70%`.
> The diff coverage is `2.60%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.32% -1.71%
==========================================
Files 54 54
Lines 4556 4762 +206
==========================================
- Hits 1596 1587 -9
- Misses 2742 2952 +210
- Partials 218 223 +5
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `84.31% <ø> (+0.31%)` | :arrow_up: |
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.11% <0.00%> (-0.02%)` | :arrow_down: |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `27.27% <ø> (-3.17%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `44.94% <ø> (-0.94%)` | :arrow_down: |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `23.38% <0.00%> (-1.80%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...d72afdc](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r666190322
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx *TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar *configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
Review comment:
I didn’t do this specially, because some fields were modified in the v2beta1 version in the [previous PR](https://github.com/apache/apisix-ingress-controller/pull/572), some pointers in v2alpha1 were removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r665302140
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx *TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar *configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
Review comment:
Can we encapsulate this logic? It's so similar to the one in `v2alpha1`.
##########
File path: pkg/kube/apisix/apis/config/v2beta1/types.go
##########
@@ -53,14 +55,14 @@ type ApisixRouteHTTP struct {
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
Match ApisixRouteHTTPMatch `json:"match,omitempty" yaml:"match,omitempty"`
// Deprecated: Backend will be removed in the future, use Backends instead.
- Backend ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
+ Backend v2alpha1.ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
Review comment:
Looks strange, if we use data structures in `v2alpha1`. Why not just implement them here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1695372) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.72%`.
> The diff coverage is `2.59%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.30% -1.73%
==========================================
Files 54 55 +1
Lines 4556 4762 +206
==========================================
- Hits 1596 1586 -10
- Misses 2742 2955 +213
- Partials 218 221 +3
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `84.00% <ø> (ø)` | |
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.11% <0.00%> (-0.02%)` | :arrow_down: |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `27.27% <ø> (-3.17%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `45.88% <ø> (ø)` | |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `23.38% <0.00%> (-1.80%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...1695372](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj merged pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj merged pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667286604
##########
File path: test/e2e/ingress/stream.go
##########
@@ -25,7 +26,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)
-var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+var _ = ginkgo.FDescribe("ApisixRoute stream Testing with v2beta1", func() {
Review comment:
It has been removed in another commit, please see the latest version of files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667338091
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx *TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar *configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
+ return errors.New("duplicated route rule name")
+ }
+ ruleNameMap[part.Name] = struct{}{}
+ backends := part.Backends
+ backend := part.Backend
+ if len(backends) > 0 {
+ // Use the first backend as the default backend in Route,
+ // others will be configured in traffic-split plugin.
+ backend = backends[0]
+ backends = backends[1:]
+ } // else use the deprecated Backend.
+
+ svcClusterIP, svcPort, err := t.getServiceClusterIPAndPort(&backend, ar.Namespace)
+ if err != nil {
+ log.Errorw("failed to get service port in backend",
+ zap.Any("backend", backend),
+ zap.Any("apisix_route", ar),
+ zap.Error(err),
+ )
+ return err
+ }
+
+ pluginMap := make(apisixv1.Plugins)
+ // 2.add route plugins
Review comment:
Why?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r666181777
##########
File path: pkg/kube/apisix/apis/config/v2beta1/types.go
##########
@@ -53,14 +55,14 @@ type ApisixRouteHTTP struct {
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
Match ApisixRouteHTTPMatch `json:"match,omitempty" yaml:"match,omitempty"`
// Deprecated: Backend will be removed in the future, use Backends instead.
- Backend ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
+ Backend v2alpha1.ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
Review comment:
Just for reusing the structures and the translation logic will be reused too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667286118
##########
File path: test/e2e/ingress/stream.go
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ingress
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+ opts := &scaffold.Options{
+ Name: "default",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath: "testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ APISIXRouteVersion: "apisix.apache.org/v2beta1",
+ }
+ s := scaffold.NewScaffold(opts)
+ ginkgo.It("stream tcp proxy", func() {
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-tcp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: TCP
+ match:
+ ingressPort: 9100
+ backend:
+ serviceName: %s
+ servicePort: %d
+`, backendSvc, backendSvcPort[0])
+
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9100))
+
+ resp := s.NewAPISIXClientWithTCPProxy().GET("/ip").Expect()
+ resp.Body().Contains("origin")
+
+ resp = s.NewAPISIXClientWithTCPProxy().GET("/get").WithHeader("x-my-header", "x-my-value").Expect()
+ resp.Body().Contains("x-my-value")
+ })
+ ginkgo.It("stream udp proxy", func() {
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-udp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: UDP
+ match:
+ ingressPort: 9200
+ backend:
+ serviceName: kube-dns
Review comment:
I have changed the namespace to kube-system before apply to k8s
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667291630
##########
File path: pkg/ingress/pod.go
##########
@@ -64,9 +64,9 @@ func (c *podController) onAdd(obj interface{}) {
if !c.controller.namespaceWatching(key) {
return
}
- log.Debugw("pod add event arrived",
- zap.Any("object", obj),
- )
+ //log.Debugw("pod add event arrived",
Review comment:
Done, I print key (namespace + name) instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667286429
##########
File path: test/e2e/ingress/stream.go
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ingress
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+ opts := &scaffold.Options{
+ Name: "default",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath: "testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ APISIXRouteVersion: "apisix.apache.org/v2beta1",
+ }
+ s := scaffold.NewScaffold(opts)
+ ginkgo.It("stream tcp proxy", func() {
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-tcp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: TCP
+ match:
+ ingressPort: 9100
+ backend:
+ serviceName: %s
+ servicePort: %d
+`, backendSvc, backendSvcPort[0])
+
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9100))
+
+ resp := s.NewAPISIXClientWithTCPProxy().GET("/ip").Expect()
+ resp.Body().Contains("origin")
+
+ resp = s.NewAPISIXClientWithTCPProxy().GET("/get").WithHeader("x-my-header", "x-my-value").Expect()
+ resp.Body().Contains("x-my-value")
+ })
+ ginkgo.It("stream udp proxy", func() {
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-udp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: UDP
+ match:
+ ingressPort: 9200
+ backend:
+ serviceName: kube-dns
Review comment:
OK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667338388
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx *TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar *configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
+ return errors.New("duplicated route rule name")
+ }
+ ruleNameMap[part.Name] = struct{}{}
+ backends := part.Backends
+ backend := part.Backend
+ if len(backends) > 0 {
+ // Use the first backend as the default backend in Route,
+ // others will be configured in traffic-split plugin.
+ backend = backends[0]
+ backends = backends[1:]
+ } // else use the deprecated Backend.
+
+ svcClusterIP, svcPort, err := t.getServiceClusterIPAndPort(&backend, ar.Namespace)
+ if err != nil {
+ log.Errorw("failed to get service port in backend",
+ zap.Any("backend", backend),
+ zap.Any("apisix_route", ar),
+ zap.Error(err),
+ )
+ return err
+ }
+
+ pluginMap := make(apisixv1.Plugins)
+ // 2.add route plugins
Review comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667284694
##########
File path: test/e2e/ingress/stream.go
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ingress
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+ opts := &scaffold.Options{
+ Name: "default",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath: "testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ APISIXRouteVersion: "apisix.apache.org/v2beta1",
+ }
+ s := scaffold.NewScaffold(opts)
+ ginkgo.It("stream tcp proxy", func() {
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-tcp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: TCP
+ match:
+ ingressPort: 9100
+ backend:
+ serviceName: %s
+ servicePort: %d
+`, backendSvc, backendSvcPort[0])
+
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9100))
+
+ resp := s.NewAPISIXClientWithTCPProxy().GET("/ip").Expect()
+ resp.Body().Contains("origin")
+
+ resp = s.NewAPISIXClientWithTCPProxy().GET("/get").WithHeader("x-my-header", "x-my-value").Expect()
+ resp.Body().Contains("x-my-value")
+ })
+ ginkgo.It("stream udp proxy", func() {
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-udp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: UDP
+ match:
+ ingressPort: 9200
+ backend:
+ serviceName: kube-dns
Review comment:
Does APISIX Ingress Controller find this service in the same namespace? kube-dns is in `kube-system`.
##########
File path: pkg/kube/translation/util.go
##########
@@ -110,6 +111,46 @@ loop:
return svc.Spec.ClusterIP, svcPort, nil
}
+// getStreamServiceClusterIPAndPort is for v2beta1 streamRoute
+func (t *translator) getStreamServiceClusterIPAndPort(backend configv2beta1.ApisixRouteStreamBackend, ns string) (string, int32, error) {
+ svc, err := t.ServiceLister.Services(ns).Get(backend.ServiceName)
+ if err != nil {
+ return "", 0, err
+ }
+ svcPort := int32(-1)
+loop:
+ for _, port := range svc.Spec.Ports {
+ switch backend.ServicePort.Type {
+ case intstr.Int:
+ if backend.ServicePort.IntVal == port.Port {
+ svcPort = port.Port
+ break loop
+ }
+ case intstr.String:
+ if backend.ServicePort.StrVal == port.Name {
+ svcPort = port.Port
+ break loop
+ }
+ }
+ }
+ if svcPort == -1 {
+ log.Errorw("ApisixRoute refers to non-existent Service port",
+ zap.String("ApisixRoute namespace", ns),
+ zap.String("port", backend.ServicePort.String()),
+ )
+ return "", 0, err
+ }
+
+ if backend.ResolveGranularity == "service" && svc.Spec.ClusterIP == "" {
Review comment:
This check can be put before the for loop?
##########
File path: pkg/ingress/pod.go
##########
@@ -64,9 +64,9 @@ func (c *podController) onAdd(obj interface{}) {
if !c.controller.namespaceWatching(key) {
return
}
- log.Debugw("pod add event arrived",
- zap.Any("object", obj),
- )
+ //log.Debugw("pod add event arrived",
Review comment:
We may still preserve this logging but don't show the object (just adding the name).
##########
File path: test/e2e/ingress/stream.go
##########
@@ -25,7 +26,7 @@ import (
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)
-var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+var _ = ginkgo.FDescribe("ApisixRoute stream Testing with v2beta1", func() {
Review comment:
Please remove the `F` prefix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (98bc2d2) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **increase** coverage by `0.37%`.
> The diff coverage is `5.11%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
+ Coverage 35.03% 35.40% +0.37%
==========================================
Files 54 54
Lines 4556 5332 +776
==========================================
+ Hits 1596 1888 +292
- Misses 2742 3222 +480
- Partials 218 222 +4
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `85.71% <ø> (+1.71%)` | :arrow_up: |
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.29% <0.00%> (+0.17%)` | :arrow_up: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `47.00% <ø> (+1.11%)` | :arrow_up: |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `26.15% <0.61%> (-14.65%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `39.84% <23.07%> (-9.62%)` | :arrow_down: |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `31.57% <100.00%> (+1.14%)` | :arrow_up: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/nonexistentclient.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9ub25leGlzdGVudGNsaWVudC5nbw==) | `46.42% <0.00%> (-3.58%)` | :arrow_down: |
| [pkg/metrics/prometheus.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL21ldHJpY3MvcHJvbWV0aGV1cy5nbw==) | `81.57% <0.00%> (-0.24%)` | :arrow_down: |
| ... and [52 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...98bc2d2](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667337963
##########
File path: test/e2e/ingress/stream.go
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ingress
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+ opts := &scaffold.Options{
+ Name: "default",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath: "testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ APISIXRouteVersion: "apisix.apache.org/v2beta1",
+ }
+ s := scaffold.NewScaffold(opts)
+ ginkgo.It("stream tcp proxy", func() {
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-tcp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: TCP
+ match:
+ ingressPort: 9100
+ backend:
+ serviceName: %s
+ servicePort: %d
+`, backendSvc, backendSvcPort[0])
+
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9100))
+
+ resp := s.NewAPISIXClientWithTCPProxy().GET("/ip").Expect()
+ resp.Body().Contains("origin")
+
+ resp = s.NewAPISIXClientWithTCPProxy().GET("/get").WithHeader("x-my-header", "x-my-value").Expect()
+ resp.Body().Contains("x-my-value")
+ })
+ ginkgo.It("stream udp proxy", func() {
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-udp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: UDP
+ match:
+ ingressPort: 9200
+ backend:
+ serviceName: kube-dns
+ servicePort: 53
+`)
+ // update namespace only for this case
+ s.UpdateNamespace("kube-system")
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9200))
+ // test dns query
+ r := s.DNSResolver()
+ host := "httpbin.org"
+ _, err = r.LookupIPAddr(context.Background(), host)
Review comment:
I think we do not need to check the IP of `httpbin.org` which will be changed in the future. And we only check the onnectivity of UDP stream.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c3da51b) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.70%`.
> The diff coverage is `9.57%`.
> :exclamation: Current head c3da51b differs from pull request most recent head 843d85d. Consider uploading reports for the commit 843d85d to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.32% -1.71%
==========================================
Files 54 54
Lines 4556 4762 +206
==========================================
- Hits 1596 1587 -9
- Misses 2742 2952 +210
- Partials 218 223 +5
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.11% <0.00%> (-0.02%)` | :arrow_down: |
| [pkg/ingress/endpoint.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvZW5kcG9pbnQuZ28=) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `27.27% <ø> (-3.17%)` | :arrow_down: |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `44.94% <76.47%> (-0.94%)` | :arrow_down: |
| [pkg/config/config.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbmZpZy9jb25maWcuZ28=) | `84.31% <100.00%> (+0.31%)` | :arrow_up: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...843d85d](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#issuecomment-875487585
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#576](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a86c0f) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/4b16e289073ad88dc6be49ae621294ecf6c92cb4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4b16e28) will **decrease** coverage by `1.66%`.
> The diff coverage is `2.66%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #576 +/- ##
==========================================
- Coverage 35.03% 33.36% -1.67%
==========================================
Files 54 55 +1
Lines 4556 4762 +206
==========================================
- Hits 1596 1589 -7
- Misses 2742 2952 +210
- Partials 218 221 +3
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/ingress/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvYXBpc2l4X3JvdXRlLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.12% <0.00%> (-0.01%)` | :arrow_down: |
| [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdHJhbnNsYXRvci5nbw==) | `45.88% <ø> (ø)` | |
| [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `25.69% <0.67%> (-15.11%)` | :arrow_down: |
| [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `38.33% <10.00%> (-11.13%)` | :arrow_down: |
| [pkg/kube/translation/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vcGx1Z2luLmdv) | `100.00% <100.00%> (ø)` | |
| [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `33.08% <0.00%> (-2.21%)` | :arrow_down: |
| [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `23.38% <0.00%> (-1.80%)` | :arrow_down: |
| [test/e2e/e2e.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-dGVzdC9lMmUvZTJlLmdv) | `100.00% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4b16e28...5a86c0f](https://codecov.io/gh/apache/apisix-ingress-controller/pull/576?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] tao12345666333 commented on a change in pull request #576: feat: add logic for ApisixRoute v2beta1
Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on a change in pull request #576:
URL: https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r667337452
##########
File path: test/e2e/ingress/stream.go
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ingress
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
+)
+
+var _ = ginkgo.Describe("ApisixRoute stream Testing with v2beta1", func() {
+ opts := &scaffold.Options{
+ Name: "default",
+ Kubeconfig: scaffold.GetKubeconfig(),
+ APISIXConfigPath: "testdata/apisix-gw-config.yaml",
+ IngressAPISIXReplicas: 1,
+ HTTPBinServicePort: 80,
+ APISIXRouteVersion: "apisix.apache.org/v2beta1",
+ }
+ s := scaffold.NewScaffold(opts)
+ ginkgo.It("stream tcp proxy", func() {
+ backendSvc, backendSvcPort := s.DefaultHTTPBackend()
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-tcp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: TCP
+ match:
+ ingressPort: 9100
+ backend:
+ serviceName: %s
+ servicePort: %d
+`, backendSvc, backendSvcPort[0])
+
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9100))
+
+ resp := s.NewAPISIXClientWithTCPProxy().GET("/ip").Expect()
+ resp.Body().Contains("origin")
+
+ resp = s.NewAPISIXClientWithTCPProxy().GET("/get").WithHeader("x-my-header", "x-my-value").Expect()
+ resp.Body().Contains("x-my-value")
+ })
+ ginkgo.It("stream udp proxy", func() {
+ apisixRoute := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta1
+kind: ApisixRoute
+metadata:
+ name: httpbin-udp-route
+spec:
+ stream:
+ - name: rule1
+ protocol: UDP
+ match:
+ ingressPort: 9200
+ backend:
+ serviceName: kube-dns
+ servicePort: 53
+`)
+ // update namespace only for this case
+ s.UpdateNamespace("kube-system")
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(apisixRoute))
+ time.Sleep(9 * time.Second)
+
+ err := s.EnsureNumApisixStreamRoutesCreated(1)
+ assert.Nil(ginkgo.GinkgoT(), err, "Checking number of routes")
+
+ sr, err := s.ListApisixStreamRoutes()
+ assert.Nil(ginkgo.GinkgoT(), err)
+ assert.Len(ginkgo.GinkgoT(), sr, 1)
+ assert.Equal(ginkgo.GinkgoT(), sr[0].ServerPort, int32(9200))
+ // test dns query
+ r := s.DNSResolver()
+ host := "httpbin.org"
+ _, err = r.LookupIPAddr(context.Background(), host)
Review comment:
Should we check the results?
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx *TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar *configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar *configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
+ return errors.New("duplicated route rule name")
+ }
+ ruleNameMap[part.Name] = struct{}{}
+ backends := part.Backends
+ backend := part.Backend
+ if len(backends) > 0 {
+ // Use the first backend as the default backend in Route,
+ // others will be configured in traffic-split plugin.
+ backend = backends[0]
+ backends = backends[1:]
+ } // else use the deprecated Backend.
+
+ svcClusterIP, svcPort, err := t.getServiceClusterIPAndPort(&backend, ar.Namespace)
+ if err != nil {
+ log.Errorw("failed to get service port in backend",
+ zap.Any("backend", backend),
+ zap.Any("apisix_route", ar),
+ zap.Error(err),
+ )
+ return err
+ }
+
+ pluginMap := make(apisixv1.Plugins)
+ // 2.add route plugins
Review comment:
this comment should be removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org