kobolog / gorb

IPVS on steroids – REST API, heartbeats, service discovery and more
GNU Lesser General Public License v3.0
809 stars 83 forks source link

Request: Allow to use sched-flags of ipvsadm #26

Closed dariovillar closed 6 years ago

dariovillar commented 8 years ago

Hi, I'm trying to make a simple load balance in UDP with source hashing as if created with ipvsadm: ipvsadm -A -u 192.168.0.2:50100 -s sh -b sh-port,sh-fallback ipvsadm -a -u 192.168.0.2:50100 -r 192.168.0.2:40058 -m -w 1 ipvsadm -a -u 192.168.0.2:50100 -r 192.168.0.2:40059 -m -w 1

I can't find if gorb has the support for the sched-flags (-b option) . The sched-flags is a relatively new option for ipvsadm and is not contemplated in the link to the manpage you provide. However, it is present in the lastest source man page and others man pages online, for example in ipvsadm man.

Do you know any other way I can use the sched-flags option?

Thanks in advance. Dario.

kobolog commented 8 years ago

Hey there. Unfortunately, the support for sched-flags and other hot new features depends on the underlying IPVS library I use: https://github.com/tehnerd/gnl2go. It's not really in active development, so I either need to wait for these features to eventually appear in that library (speaking of which, summoning @tehnerd to see whether he's already working on it), fork it or switch to some other implementation.

I was considering switching to Google's own IPVS access layer implementation from Seesaw: https://github.com/google/seesaw/tree/master/ipvs, but it doesn't support sched-flags either and also requires cgo, which is not really a great thing.

tehnerd commented 8 years ago

sched flags are not hot new features (btw any example of any other? havent look into new ipvs features for a while, and the most common ones already there) and, because i've never seen em in a wild, i've just pass em as slice of nuls (https://github.com/tehnerd/gnl2go/blob/master/ipvs.go#L673) but can easily add em as configurable value

dariovillar commented 8 years ago

Hi @kobolog ,

With the awesome fast work of @tehnerd , the gnl2go library now has the ability to handle the sched flags. I wonder if it would be possible to handle them from the gorb side.

One possible implementation could be follow the existent syntax:

{
    "host": "10.0.0.1",
    "port": 12345,
    "protocol": "tcp|udp",
    "method": "rr|wrr|lc|wlc|lblc|lblcr|sh|dh|sed|nq|...",
    "persistent": true

}

But adding an optative field flags in the json which receive a list, because they are no exclusive:

{
    "host": "10.0.0.1",
    "port": 12345,
    "protocol": "tcp|udp",
    "method": "rr|wrr|lc|wlc|lblc|lblcr|sh|dh|sed|nq|...",
    "persistent": true,
    "flags" : ["persistent", "hashed", "onepacket", "sched1", "sched2", "sched3", "sh-fallback", "sh-port"]
}

Thanks in advance.

kobolog commented 8 years ago

Sure, I'll get to it as soon as possible.

sebbonnet commented 6 years ago

@kobolog https://github.com/kobolog/gorb/pull/46 introduced support for scheduler flags, so this can probably be closed now.

kobolog commented 6 years ago

You’re right!