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/05/31 09:24:40 UTC

[GitHub] [apisix-ingress-controller] lingsamuel opened a new pull request, #1060: e2e: gateway api httproute

lingsamuel opened a new pull request, #1060:
URL: https://github.com/apache/apisix-ingress-controller/pull/1060

   Signed-off-by: Ling Samuel <li...@gmail.com><!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   - [x] Bug fix, new feature provided
   


-- 
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 #1060: e2e: gateway api httproute

Posted by GitBox <gi...@apache.org>.
tao12345666333 merged PR #1060:
URL: https://github.com/apache/apisix-ingress-controller/pull/1060


-- 
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 pull request #1060: e2e: gateway api httproute

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on PR #1060:
URL: https://github.com/apache/apisix-ingress-controller/pull/1060#issuecomment-1143450278

   re-run all jobs


-- 
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 diff in pull request #1060: e2e: gateway api httproute

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on code in PR #1060:
URL: https://github.com/apache/apisix-ingress-controller/pull/1060#discussion_r891388113


##########
pkg/kube/translation/gateway_httproute.go:
##########
@@ -52,25 +52,46 @@ func (t *translator) TranslateGatewayHTTPRouteV1Alpha2(httpRoute *gatewayv1alpha
 		for j, backend := range backends {
 			//TODO: Support filters
 			//filters := backend.Filters
-			kind := strings.ToLower(string(*backend.Kind))
+			var kind string
+			if backend.Kind == nil {
+				kind = "service"
+			} else {
+				kind = strings.ToLower(string(*backend.Kind))
+			}
 			if kind != "service" {
 				log.Warnw(fmt.Sprintf("ignore non-service kind at Rules[%v].BackendRefs[%v]", i, j),
 					zap.String("kind", kind),
 				)
 				continue
 			}
 
-			ns := string(*backend.Namespace)
+			var ns string
+			if backend.Namespace == nil {
+				ns = httpRoute.Namespace
+			} else {
+				ns = string(*backend.Namespace)
+			}
 			//if ns != httpRoute.Namespace {
 			// TODO: check gatewayv1alpha2.ReferencePolicy
 			//}
 
+			if backend.Port == nil {
+				log.Warnw(fmt.Sprintf("ignore nil port at Rules[%v].BackendRefs[%v]", i, j),
+					zap.String("kind", kind),
+				)
+				continue
+			}
+
 			ups, err := t.TranslateUpstream(ns, string(backend.Name), "", int32(*backend.Port))
 			if err != nil {
 				return nil, errors.Wrap(err, fmt.Sprintf("failed to translate Rules[%v].BackendRefs[%v]", i, j))
 			}
 			name := apisixv1.ComposeUpstreamName(ns, string(backend.Name), "", int32(*backend.Port))
-			ups.Labels["id-name"] = name
+
+			ups.Labels["meta_namespace"] = truncate(ns, 64)

Review Comment:
   We can add a comment explaining why 64 is used  https://github.com/apache/apisix/blob/5b95b85faea3094d5e466ee2d39a52f1f805abbb/apisix/schema_def.lua#L85



##########
pkg/kube/translation/util.go:
##########
@@ -261,3 +261,10 @@ func validateRemoteAddrs(remoteAddrs []string) error {
 	}
 	return nil
 }
+
+func truncate(s string, max int) string {

Review Comment:
   we should check max must be non-negative



##########
pkg/kube/translation/translator.go:
##########
@@ -230,7 +232,14 @@ func (t *translator) TranslateUpstream(namespace, name, subset string, port int3
 }
 
 func (t *translator) TranslateUpstreamNodes(endpoint kube.Endpoint, port int32, labels types.Labels) (apisixv1.UpstreamNodes, error) {
-	namespace := endpoint.Namespace()
+	namespace, err := endpoint.Namespace()
+	if err != nil {
+		log.Warnw("failed to get endpoint namespace",

Review Comment:
   ditto, about log level



##########
pkg/ingress/gateway_httproute.go:
##########
@@ -121,7 +123,7 @@ func (c *gatewayHTTPRouteController) sync(ctx context.Context, ev *types.Event)
 	tctx, err := c.controller.translator.TranslateGatewayHTTPRouteV1Alpha2(httpRoute)
 
 	if err != nil {
-		log.Errorw("failed to translate gateway HTTPRoute",
+		log.Warnw("failed to translate gateway HTTPRoute",

Review Comment:
   This is an error, we log it with a higher level, isn't it better?



##########
.gitattributes:
##########
@@ -0,0 +1,3 @@
+# Gateway API CRDs:
+# https://github.com/kubernetes-sigs/gateway-api/tree/66a7c8ffc942a90294612f63c6dedcc73a3de5ca/config/crd/stable
+samples/deploy/gateway-api/* linguist-generated=true

Review Comment:
   good job! I like this configuration item



-- 
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 #1060: e2e: gateway api httproute

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1060:
URL: https://github.com/apache/apisix-ingress-controller/pull/1060#issuecomment-1148194220

   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060?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 [#1060](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (54d5e65) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/6c7452ffab358c47e25882d802e4cc891e95eb37?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6c7452f) will **decrease** coverage by `0.23%`.
   > The diff coverage is `33.33%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1060      +/-   ##
   ==========================================
   - Coverage   31.04%   30.81%   -0.24%     
   ==========================================
     Files          77       77              
     Lines        9070     9174     +104     
   ==========================================
   + Hits         2816     2827      +11     
   - Misses       5951     6038      +87     
   - Partials      303      309       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060?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/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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==) | `0.83% <0.00%> (-0.03%)` | :arrow_down: |
   | [pkg/ingress/endpoint.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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/gateway\_httproute.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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-cGtnL2luZ3Jlc3MvZ2F0ZXdheV9odHRwcm91dGUuZ28=) | `0.00% <0.00%> (ø)` | |
   | [pkg/kube/translation/translator.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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==) | `43.51% <40.00%> (-2.56%)` | :arrow_down: |
   | [pkg/kube/translation/gateway\_httproute.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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-cGtnL2t1YmUvdHJhbnNsYXRpb24vZ2F0ZXdheV9odHRwcm91dGUuZ28=) | `63.87% <45.00%> (-3.53%)` | :arrow_down: |
   | [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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==) | `33.73% <75.00%> (+1.01%)` | :arrow_up: |
   | [pkg/kube/translation/apisix\_pluginconfig.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3BsdWdpbmNvbmZpZy5nbw==) | `36.66% <0.00%> (-36.67%)` | :arrow_down: |
   | [pkg/ingress/apisix\_pluginconfig.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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-cGtnL2luZ3Jlc3MvYXBpc2l4X3BsdWdpbmNvbmZpZy5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [2 more](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060/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/1060?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/1060?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 [6c7452f...54d5e65](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1060?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