-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: avoid create pluginconfig in the tranlsation of route (#836) #845
Changes from 6 commits
05dd483
5aada25
c090ab7
e50920b
3905cd7
fa0443e
6a14979
8d723a7
19748ad
1360c6b
4b6cce0
4547a1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -530,17 +530,8 @@ func (t *translator) translateHTTPRouteV2beta3(ctx *TranslateContext, ar *config | |
route.EnableWebsocket = part.Websocket | ||
route.Plugins = pluginMap | ||
route.Timeout = timeout | ||
pluginConfig := apisixv1.NewDefaultPluginConfig() | ||
if len(pluginMap) > 0 { | ||
pluginConfigName := apisixv1.ComposePluginConfigName(ar.Namespace, backend.ServiceName) | ||
route.PluginConfigId = id.GenID(pluginConfigName) | ||
pluginConfig.ID = route.PluginConfigId | ||
pluginConfig.Name = pluginConfigName | ||
pluginConfig.Plugins = pluginMap | ||
} else { | ||
if part.PluginConfigName != "" { | ||
route.PluginConfigId = part.PluginConfigName | ||
} | ||
if part.PluginConfigName != "" { | ||
route.PluginConfigId = part.PluginConfigName | ||
} | ||
|
||
if len(backends) > 0 { | ||
|
@@ -566,9 +557,6 @@ func (t *translator) translateHTTPRouteV2beta3(ctx *TranslateContext, ar *config | |
} | ||
ctx.addUpstream(ups) | ||
} | ||
if len(pluginMap) > 0 { | ||
ctx.addPluginConfig(pluginConfig) | ||
} | ||
} | ||
return nil | ||
} | ||
|
@@ -851,7 +839,6 @@ func (t *translator) translateStreamRoute(ctx *TranslateContext, ar *configv2bet | |
if !ctx.checkUpstreamExist(ups.Name) { | ||
ctx.addUpstream(ups) | ||
} | ||
|
||
} | ||
return nil | ||
} | ||
|
@@ -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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we don't handle the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because when it creates the ApisixRoute and the field There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I mean |
||
if len(pluginMap) > 0 { | ||
pluginConfigName := apisixv1.ComposePluginConfigName(ar.Namespace, backend.ServiceName) | ||
route.PluginConfigId = id.GenID(pluginConfigName) | ||
pluginConfig.ID = route.PluginConfigId | ||
pluginConfig.Name = pluginConfigName | ||
} | ||
|
||
ctx.addRoute(route) | ||
if !ctx.checkUpstreamExist(upstreamName) { | ||
|
@@ -993,9 +973,6 @@ func (t *translator) translateHTTPRouteV2beta3NotStrictly(ctx *TranslateContext, | |
} | ||
ctx.addUpstream(ups) | ||
} | ||
if len(pluginMap) > 0 { | ||
ctx.addPluginConfig(pluginConfig) | ||
} | ||
} | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use the plugin config name as the id, see https://github.com/apache/apisix-ingress-controller/blob/master/pkg/kube/translation/apisix_pluginconfig.go#L51 for details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, This is what needs to be refactored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will refactor it right now