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 2022/12/15 17:11:26 UTC
[GitHub] [apisix-ingress-controller] shreemaan-abhishek opened a new pull request, #1526: feat: sync crd labels to apisix
shreemaan-abhishek opened a new pull request, #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526
<!-- Please answer these questions before submitting a pull request -->
### Type of change:
<!-- Please delete options that are not relevant. -->
- [ ] Bugfix
- [ ] New feature provided
- [ ] Improve performance
- [ ] Backport patches
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
### Pre-submission checklist:
<!--
Please follow the requirements:
1. Use Draft if the PR is not ready to be reviewed
2. Test is required for the feat/fix PR, unless you have a good reason
3. Doc is required for the feat PR
4. Use a new commit to resolve review instead of `push -f`
5. Use "request review" to notify the reviewer once you have resolved the review
-->
* [ ] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [ ] Have you modified the corresponding document?
* [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix-ingress-controller#community) first**
--
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] AlinsRan commented on a diff in pull request #1526: feat: sync crd labels to apisix
Posted by GitBox <gi...@apache.org>.
AlinsRan commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1055033086
##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
}))
})
})
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+ authentication:
+ enable: true
+ type: keyAuth
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ })
+ }
+
+ ginkgo.Describe("suite-ingress-features: scaffold v2", func() {
+ suites(scaffold.NewScaffold(&scaffold.Options{
Review Comment:
Please refer to it https://github.com/apache/apisix-ingress-controller/blob/master/test/e2e/suite-chore/admin_api.go#L29.
`ApisixResourceSyncInterval` is not required here.
##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
}))
})
})
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+ authentication:
Review Comment:
Please remove authentication, it is not used.
##########
test/e2e/suite-ingress/suite-ingress-features/resourcesync.go:
##########
@@ -320,3 +321,54 @@ spec:
}))
})
})
+
+var _ = ginkgo.Describe("suite-ingress-features: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2beta3
Review Comment:
`apiVersion: apisix.apache.org/v2`
--
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] AlinsRan commented on a diff in pull request #1526: feat: sync route crd labels to apisix
Posted by GitBox <gi...@apache.org>.
AlinsRan commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1056019120
##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
})
+
+var _ = ginkgo.Describe("suite-chore: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ // cleanup
Review Comment:
The purpose of this use case is to verify that the labels are consistent. I don't think there's a point in verifying deletion.
--
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] AlinsRan commented on pull request #1526: feat: sync crd labels to apisix
Posted by GitBox <gi...@apache.org>.
AlinsRan commented on PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#issuecomment-1362321109
You need to move the following code: `test/e2e/suite-ingress/suite-ingress-features/resourcesync.go` -> `test/e2e/suite-chore/consistency.go`.
The former is to verify the timing synchronization function, and the latter is to verify the consistency of APISIX and controller.
--
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] shreemaan-abhishek closed pull request #1526: feat: sync crd labels to apisix
Posted by GitBox <gi...@apache.org>.
shreemaan-abhishek closed pull request #1526: feat: sync crd labels to apisix
URL: https://github.com/apache/apisix-ingress-controller/pull/1526
--
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] shreemaan-abhishek commented on a diff in pull request #1526: feat: sync crd labels to apisix
Posted by GitBox <gi...@apache.org>.
shreemaan-abhishek commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1055134392
##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
})
+
+var _ = ginkgo.Describe("suite-chore: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ // cleanup
+ for _, route := range routes {
+ _ = s.DeleteApisixRouteByApisixAdmin(id.GenID(route.Name))
+ }
+ // confirm deletion
Review Comment:
@AlinsRan should I write code for thread sleep to wait for deletion?
##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
})
+
+var _ = ginkgo.Describe("suite-chore: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ // cleanup
Review Comment:
@AlinsRan is clean up after tests necessary?
--
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 merged pull request #1526: feat: sync route crd labels to apisix
Posted by GitBox <gi...@apache.org>.
tao12345666333 merged PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526
--
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] shreemaan-abhishek commented on a diff in pull request #1526: feat: sync route crd labels to apisix
Posted by GitBox <gi...@apache.org>.
shreemaan-abhishek commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1057051049
##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
})
+
+var _ = ginkgo.Describe("suite-chore: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ // cleanup
Review Comment:
@AlinsRan, cool! I just removed this part.
--
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] shreemaan-abhishek commented on a diff in pull request #1526: feat: sync route crd labels to apisix
Posted by GitBox <gi...@apache.org>.
shreemaan-abhishek commented on code in PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#discussion_r1055138655
##########
test/e2e/suite-chore/consistency.go:
##########
@@ -273,3 +275,57 @@ var _ = ginkgo.Describe("suite-chore: Consistency between APISIX and the Ingress
s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.org").Expect().Status(http.StatusOK)
})
})
+
+var _ = ginkgo.Describe("suite-chore: apisix labels sync", func() {
+ suites := func(s *scaffold.Scaffold) {
+ ginkgo.JustBeforeEach(func() {
+ labels := map[string]string{"key": "value", "foo": "bar"}
+ backendSvc, backendPorts := s.DefaultHTTPBackend()
+ ar := fmt.Sprintf(`
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+ labels:
+ key: value
+ foo: bar
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+`, backendSvc, backendPorts[0])
+ assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ar))
+ assert.Nil(ginkgo.GinkgoT(), s.EnsureNumApisixRoutesCreated(1), "Checking number of routes")
+
+ routes, _ := s.ListApisixRoutes()
+ assert.Len(ginkgo.GinkgoT(), routes, 1)
+ // check if labels exists
+ for _, route := range routes {
+ eq := reflect.DeepEqual(route.Metadata.Labels, labels)
+ assert.True(ginkgo.GinkgoT(), eq)
+ }
+ // cleanup
Review Comment:
I added them just in case they are needed, I'll remove them once you review this.
--
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 #1526: feat: sync crd labels to apisix
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1526:
URL: https://github.com/apache/apisix-ingress-controller/pull/1526#issuecomment-1354155858
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1526?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 [#1526](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1526?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (59eec67) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/d22a6fc820f7699af411b8ecaa971307cfc82dbd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d22a6fc) will **decrease** coverage by `0.01%`.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## master #1526 +/- ##
==========================================
- Coverage 41.22% 41.21% -0.02%
==========================================
Files 85 85
Lines 7440 7442 +2
==========================================
Hits 3067 3067
- Misses 4020 4021 +1
- Partials 353 354 +1
```
| [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1526?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/providers/apisix/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1526/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-cGtnL3Byb3ZpZGVycy9hcGlzaXgvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `30.40% <0.00%> (-0.09%)` | :arrow_down: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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