interfaces.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. Copyright 2015 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package bandwidth
  14. import "k8s.io/kubernetes/pkg/api/resource"
  15. type BandwidthShaper interface {
  16. // Limit the bandwidth for a particular CIDR on a particular interface
  17. // * ingress and egress are in bits/second
  18. // * cidr is expected to be a valid network CIDR (e.g. '1.2.3.4/32' or '10.20.0.1/16')
  19. // 'egress' bandwidth limit applies to all packets on the interface whose source matches 'cidr'
  20. // 'ingress' bandwidth limit applies to all packets on the interface whose destination matches 'cidr'
  21. // Limits are aggregate limits for the CIDR, not per IP address. CIDRs must be unique, but can be overlapping, traffic
  22. // that matches multiple CIDRs counts against all limits.
  23. Limit(cidr string, egress, ingress *resource.Quantity) error
  24. // Remove a bandwidth limit for a particular CIDR on a particular network interface
  25. Reset(cidr string) error
  26. // Reconcile the interface managed by this shaper with the state on the ground.
  27. ReconcileInterface() error
  28. // Reconcile a CIDR managed by this shaper with the state on the ground
  29. ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error
  30. // GetCIDRs returns the set of CIDRs that are being managed by this shaper
  31. GetCIDRs() ([]string, error)
  32. }