-
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
Conversation
ci need re-run @tao12345666333 |
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.
Need some test cases to make sure the plugin_config_id is not written now.
ok, I will add more test cases today. |
…onfigName had’n been specified
Codecov Report
@@ Coverage Diff @@
## master #845 +/- ##
==========================================
+ Coverage 32.01% 32.09% +0.07%
==========================================
Files 70 70
Lines 7749 7730 -19
==========================================
Hits 2481 2481
+ Misses 4993 4976 -17
+ Partials 275 273 -2
Continue to review full report at Codecov.
|
e2e test need to re-run @tao12345666333 |
ci error below: • Failure [70.707 seconds]
ApisixRoute Testing
/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/test/e2e/ingress/resourcepushing.go:28
service is referenced by two ApisixRoutes [It]
/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/test/e2e/ingress/resourcepushing.go:502
Error Trace: resourcepushing.go:607
runner.go:113
runner.go:64
it_node.go:26
spec.go:215
spec.go:138
spec_runner.go:200
spec_runner.go:170
spec_runner.go:66
suite.go:79
ginkgo_dsl.go:238
ginkgo_dsl.go:213
e2e_test.go:26
Error: "[%!s(*v1.Upstream=&{{45e6c8e6 ingress-apisix-e2e-tests-default-428202328_httpbin-service-e2e-test_80 Created by apisix-ingress-controller, DO NOT modify it manually map[managed-by:apisix-ingress-controller]} roundrobin vars <nil> [{10.244.2.32 80 100}] http <nil> <nil> <nil>})]" should have 0 item(s), but has 1
Test: ApisixRoute Testing service is referenced by two ApisixRoutes maybe it need to re-run once again. @tao12345666333 |
Signed-off-by: Jintao Zhang <[email protected]>
Wait for #859 to fix CI. |
#859 has been merged. Re-run the CI. |
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.
LGTM
pkg/kube/translation/apisix_route.go
Outdated
route.PluginConfigId = part.PluginConfigName | ||
} | ||
if part.PluginConfigName != "" { | ||
route.PluginConfigId = part.PluginConfigName |
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
Actually, I found I had covert the plugin config name to plugin id in the apisixRouteController. |
It's been a long time and I almost forgot what I had done |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't handle the PluginConfigName
in this method?
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.
That's because when it creates the ApisixRoute and the field PluginConfigName
has been specified, I want to use apisix.Cluster api to check the plugin was whether exist.
And at the same time replace it with the plugin id.
...
Since the method to generate the plugin id is fixed.
I will just remove the replacement and remain checking.
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.
Well, I mean translateHTTPRouteV2beta3NotStrictly
is basically same to translateHTTPRouteV2beta3
, so here you should also set the plugin config id.
if err != nil { | ||
log.Errorw("replacePluginNameWithIdIfNotEmptyV2beta3 error: plugin_config not found", |
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.
Should distinguish the error type, not all errors are "not found".
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
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I mean translateHTTPRouteV2beta3NotStrictly
is basically same to translateHTTPRouteV2beta3
, so here you should also set the plugin config id.
@tao12345666333 |
let me re-run it |
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.
LGTM
CI is green. Wait for @tokers approval |
Type of change:
What this PR does / why we need it:
Pre-submission checklist: