-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Don't copy gw from IP4.Gateway to Route.GW When converting from 0.2.0 #617
Conversation
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
I tested this change with the plugins repo and it passes the plugins/main/* tests. That's likely because the ConfigureIface() function that they all use does the same operations as this PR removes when actually sending the routes to the kernel.
Could we add a testcase to assert that conversion from 0.2.0 -> 0.3.0 -> 0.2.0 works? |
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.
I agree the previous code looks wrong. Thanks!
I just ended up writing the testcase, @luksa could you apply this diff to your PR and repush? Thanks!
|
When converting from 0.2.0 to 0.3.x, we used to copy the Gateway defined under IP4.Gateway to each route that had GW set to nil. This is wrong because the result of converting from 0.2.0 to 0.3.x and back to 0.2.0 doesn't match the original config. Also, the spec says the following about routes.gw: "IP of the gateway. If omitted, a default gateway is assumed (as determined by the CNI plugin)." So, it should be up to the CNI plugin to determine what to do when the gateway in a route isn't specified. Therefore, when converting from 0.2.0 to 0.3.x, we should NOT populate the gateway field.
45743ec
to
83ed245
Compare
@dcbw Added your tests & rebased to latest master |
/lgtm |
When converting from 0.2.0 to 0.3.x, we used to copy the Gateway defined
under IP4.Gateway to each route that had GW set to nil. This is wrong
because the result of converting from 0.2.0 to 0.3.x and back to 0.2.0
doesn't match the original config.
Also, the spec says the following about routes.gw: "IP of the gateway.
If omitted, a default gateway is assumed (as determined by the CNI
plugin)."
So, it should be up to the CNI plugin to determine what to do when the
gateway in a route isn't specified. Therefore, when converting from
0.2.0 to 0.3.x, we should NOT populate the gateway field.