util.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. Copyright 2017 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 testing
  14. import (
  15. utilipset "k8s.io/kubernetes/pkg/util/ipset"
  16. )
  17. // ExpectedVirtualServer is the expected ipvs rules with VirtualServer and RealServer
  18. // VSNum is the expected ipvs virtual server number
  19. // IP:Port protocol is the expected ipvs vs info
  20. // RS is the RealServer of this expected VirtualServer
  21. type ExpectedVirtualServer struct {
  22. VSNum int
  23. IP string
  24. Port uint16
  25. Protocol string
  26. RS []ExpectedRealServer
  27. }
  28. // ExpectedRealServer is the expected ipvs RealServer
  29. type ExpectedRealServer struct {
  30. IP string
  31. Port uint16
  32. }
  33. // ExpectedIptablesChain is a map of expected iptables chain and jump rules
  34. type ExpectedIptablesChain map[string][]ExpectedIptablesRule
  35. // ExpectedIptablesRule is the expected iptables rules with jump chain and match ipset name
  36. type ExpectedIptablesRule struct {
  37. JumpChain string
  38. MatchSet string
  39. }
  40. // ExpectedIPSet is the expected ipset with set name and entries name
  41. type ExpectedIPSet map[string][]*utilipset.Entry