Implement bandwidth capabilties
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
This commit is contained in:
9
vendor/github.com/containerd/go-cni/namespace_opts.go
generated
vendored
9
vendor/github.com/containerd/go-cni/namespace_opts.go
generated
vendored
@@ -33,6 +33,15 @@ func WithCapabilityIPRanges(ipRanges []IPRanges) NamespaceOpts {
|
||||
}
|
||||
}
|
||||
|
||||
// WithCapabilityBandWitdh adds support for traffic shaping:
|
||||
// https://github.com/heptio/cni-plugins/tree/master/plugins/meta/bandwidth
|
||||
func WithCapabilityBandWidth(bandWidth BandWidth) NamespaceOpts {
|
||||
return func(c *Namespace) error {
|
||||
c.capabilityArgs["bandwidth"] = bandWidth
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithCapability(name string, capability interface{}) NamespaceOpts {
|
||||
return func(c *Namespace) error {
|
||||
c.capabilityArgs[name] = capability
|
||||
|
||||
8
vendor/github.com/containerd/go-cni/opts.go
generated
vendored
8
vendor/github.com/containerd/go-cni/opts.go
generated
vendored
@@ -86,6 +86,12 @@ func WithLoNetwork(c *libcni) error {
|
||||
// WithConf can be used to load config directly
|
||||
// from byte.
|
||||
func WithConf(bytes []byte) CNIOpt {
|
||||
return WithConfIndex(bytes, 0)
|
||||
}
|
||||
|
||||
// WithConfIndex can be used to load config directly
|
||||
// from byte and set the interface name's index.
|
||||
func WithConfIndex(bytes []byte, index int) CNIOpt {
|
||||
return func(c *libcni) error {
|
||||
conf, err := cnilibrary.ConfFromBytes(bytes)
|
||||
if err != nil {
|
||||
@@ -98,7 +104,7 @@ func WithConf(bytes []byte) CNIOpt {
|
||||
c.networks = append(c.networks, &Network{
|
||||
cni: c.cniConfig,
|
||||
config: confList,
|
||||
ifName: getIfName(c.prefix, 0),
|
||||
ifName: getIfName(c.prefix, index),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
8
vendor/github.com/containerd/go-cni/types.go
generated
vendored
8
vendor/github.com/containerd/go-cni/types.go
generated
vendored
@@ -43,3 +43,11 @@ type IPRanges struct {
|
||||
RangeEnd string
|
||||
Gateway string
|
||||
}
|
||||
|
||||
// BandWidth defines the ingress/egress rate and burst limits
|
||||
type BandWidth struct {
|
||||
IngressRate uint64
|
||||
IngressBurst uint64
|
||||
EgressRate uint64
|
||||
EgressBurst uint64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user