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/02/23 09:23:39 UTC

[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #845: fix: avoid create pluginconfig in the tranlsation of route (#836)

tokers commented on a change in pull request #845:
URL: https://github.com/apache/apisix-ingress-controller/pull/845#discussion_r812694516



##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -977,13 +964,6 @@ func (t *translator) translateHTTPRouteV2beta3NotStrictly(ctx *TranslateContext,
 		route := apisixv1.NewDefaultRoute()
 		route.Name = apisixv1.ComposeRouteName(ar.Namespace, ar.Name, part.Name)
 		route.ID = id.GenID(route.Name)
-		pluginConfig := apisixv1.NewDefaultPluginConfig()

Review comment:
       Well, I mean `translateHTTPRouteV2beta3NotStrictly` is basically same to `translateHTTPRouteV2beta3`, so here you should also set the plugin config id.

##########
File path: pkg/ingress/apisix_route.go
##########
@@ -237,27 +234,20 @@ func (c *apisixRouteController) sync(ctx context.Context, ev *types.Event) error
 	return c.controller.syncManifests(ctx, added, updated, deleted)
 }
 
-func (c *apisixRouteController) replacePluginNameWithIdIfNotEmptyV2beta3(ctx context.Context, in *v2beta3.ApisixRoute) (*v2beta3.ApisixRoute, error) {
-	clusterName := c.controller.cfg.APISIX.DefaultClusterName
-	news := make([]v2beta3.ApisixRouteHTTP, 0)
+func (c *apisixRouteController) checkPluginNameIfNotEmptyV2beta3(ctx context.Context, in *v2beta3.ApisixRoute) error {
 	for _, v := range in.Spec.HTTP {
-		pluginConfigId := ""
 		if v.PluginConfigName != "" {
-			pc, err := c.controller.apisix.Cluster(clusterName).PluginConfig().Get(ctx, apisixv1.ComposePluginConfigName(in.Namespace, v.PluginConfigName))
+			_, err := c.controller.apisix.Cluster(c.controller.cfg.APISIX.DefaultClusterName).PluginConfig().Get(ctx, apisixv1.ComposePluginConfigName(in.Namespace, v.PluginConfigName))
 			if err != nil {
-				log.Errorw("replacePluginNameWithIdIfNotEmptyV2beta3 error:  plugin_config not found",

Review comment:
       Should distinguish the error type, not all errors are "not found".




-- 
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