-
Notifications
You must be signed in to change notification settings - Fork 333
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
Golang versioned ovn-kube-util #113
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.
Done first pass review. Looks fine mostly. Little concerned about re-entrancy of this util. But can be addressed later.
"strings" | ||
"syscall" | ||
|
||
"github.com/Sirupsen/logrus" |
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.
At some point we should converge on glog or logrus
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'd prefer logrus. WDYT?
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.
logrus is just fine. Just seeking consistency. Pulling out glog in another PR then.
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. will do
go-controller/Makefile
Outdated
@@ -7,6 +7,7 @@ export OUT_DIR | |||
# make all | |||
all build: | |||
hack/build-go.sh cmd/ovnkube/ovnkube.go | |||
hack/build-go.sh cmd/ovn-kube-util/main.go |
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 for now, but maybe we should merge all into single binary
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.
Yep, a unified binary with subcommands if preferred in the future.
|
||
for _, nic := range args { | ||
if err := nicToBridge(nic); err != nil { | ||
return err |
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.
Not quit, but possibly accumulate the errors in ErrorList and try them all out?
We could then report which all failed and one can know which succeeded. Useful since we do not roll back.
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.
ACK. Updated.
} | ||
|
||
bridge := getBridgeName(iface) | ||
stdout, stderr, err := util.RunOVSVsctl("add-br", bridge, |
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.
Is there an '--if-exists' flag to ovs-vsctl add-br? I cannot recall.
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.
do you means --may-exist
?
This does not compile for me. I get the following error: vendor/github.com/vishvananda/netlink/addr_linux.go:10:2: cannot find package "github.com/vishvananda/netlink/nl" in any of: |
Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
3c444a8
to
bb264e4
Compare
@shettyg Added back the missing vendors. PTAL. |
@feiskyer
|
@shettyg Sorry, didn't notice this problem. It is because |
bb264e4
to
7266c65
Compare
Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
66d4e13
to
4ebcf91
Compare
Added a new commit with the fix. Should work properly now. |
LGTM What is the typical strategy when it comes to vendor fixes in golang? Looks like here, you have updated our local vendor code. But, in the future if someone updates the vendor code, we will miss your fix, isn't it? The other option is to have a local function that does the correct code and use it instead of the upstream vendor code. And then remove local code when the upstream has the fix. I am trying to understand what do other projects that use vendoring do? |
We usually fix the problem outside vendors, but I'm expecting the fix could be merged soon in the upstream code, e.g. before this one. Let's wait a while for the upstream fix. If it is too slow, then a local fix is prefered. |
Same strategy in the openshift project. Fix with a specially marked commit and PR (e.g. keyword UPSTREAM) and actually rebase from all upstream when starting a new development release. |
addrList is a workround for also getting broadcast addr. It should be replaced by netlink.AddrList after vishvananda/netlink#226 is merged. Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
@shettyg Added a local version |
This PR adds golang versioned ovs-kube-util.
cc/ @shettyg