Closed fedepaol closed 1 year ago
Hi @fedepaol. Thanks for your PR.
I'm waiting for a nmstate member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
My understanding is, gjson does not allow to have multiple queries. See https://github.com/tidwall/gjson/issues/64
/ok-to-test
/retest
Added, and also I added an e2e as requested offline
@fedepaol: The following test failed, say /retest
to rerun all failed tests or /retest-required
to rerun all mandatory failed tests:
Test name | Commit | Details | Required | Rerun command |
---|---|---|---|---|
pull-kubernetes-nmstate-e2e-handler-k8s-future | 469a435a63f0bc511264ccb6c72c5a69abf7c4eb | link | false | /test pull-kubernetes-nmstate-e2e-handler-k8s-future |
omg, I can't believe that we ran into the same issue with 2 weeks difference and that I didn't find your PR first -_- I did find the syntax for defaultGwGjsonPath , though, so perhaps you can simplify your commit if your fancy: https://github.com/nmstate/kubernetes-nmstate/pull/1159 https://github.com/nmstate/kubernetes-nmstate/pull/1159/commits/d29117392c0a4522bff21b413cadf9a1fafc32df#diff-0c0168aef7c305629b107f3f2b5512406c3baa13146a6cce9463b244012634f1R147
gjson syntax that you were looking for:
a) that matches the first default route from table 254, table 0 or no table-id set (I dunno if table is always set):
defaultGwGjsonPath := fmt.Sprintf("[routes.running.#(table-id==~false)#,routes.running.#(table-id==%d)#].@flatten"+
"|#(destination==\"0.0.0.0/0\").next-hop-address", mainRoutingTableID)
b) To match the first default route from table 254:
defaultGwGjsonPath := fmt.Sprintf("routes.running.#(table-id==%d)#" +
"|#(destination==\"0.0.0.0/0\").next-hop-address", mainRoutingTableID)
/retest-require
/retest-required
@fedepaol is this good to go ?
omg, I can't believe that we ran into the same issue with 2 weeks difference and that I didn't find your PR first -_- I did find the syntax for defaultGwGjsonPath , though, so perhaps you can simplify your commit if your fancy: #1159 d291173#diff-0c0168aef7c305629b107f3f2b5512406c3baa13146a6cce9463b244012634f1R147
gjson syntax that you were looking for:
a) that matches the first default route from table 254, table 0 or no table-id set (I dunno if table is always set):
defaultGwGjsonPath := fmt.Sprintf("[routes.running.#(table-id==~false)#,routes.running.#(table-id==%d)#].@flatten"+ "|#(destination==\"0.0.0.0/0\").next-hop-address", mainRoutingTableID)
b) To match the first default route from table 254:
defaultGwGjsonPath := fmt.Sprintf("routes.running.#(table-id==%d)#" + "|#(destination==\"0.0.0.0/0\").next-hop-address", mainRoutingTableID)
Better keep the loops so we don't depend on gjson syntax (we may ditch it in the future)
/lgtm /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: qinqon
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Is this a BUG FIX or a FEATURE ?:
What this PR does / why we need it:
The current logic relies on the first matching route entry with destination == 0.0.0.0/0, in order to find the default gateway to ping. When multiple routing table exist, we may have multiple entries with that destination, some of them may not be usable and even if they were, pinging that particular gateway doesn't assure the health of the node.
To overcome this, we narrow the filter to pick the next hop of the default route for the "main" routing table.
Special notes for your reviewer:
Release note: