Documentation ¶
Index ¶
- Variables
- func CheckCacheEvents(store model.ConfigStore, cache model.ConfigStoreCache, namespace string, n int, ...)
- func CheckCacheFreshness(cache model.ConfigStoreCache, namespace string, t *testing.T)
- func CheckCacheSync(store model.ConfigStore, cache model.ConfigStoreCache, namespace string, n int, ...)
- func CheckIstioConfigTypes(store model.ConfigStore, namespace string, t *testing.T)
- func CheckMapInvariant(r model.ConfigStore, t *testing.T, namespace string, n int)
- func Compare(a, b model.Config) bool
- func Make(namespace string, i int) model.Config
- func MakeExternalHTTPSService(hostname, external string, address string) *model.Service
- func MakeExternalHTTPService(hostname, external string, address string) *model.Service
- func MakeIP(service *model.Service, version int) string
- func MakeInstance(service *model.Service, port *model.Port, version int) *model.ServiceInstance
- func MakeService(hostname, address string) *model.Service
- type ServiceDiscovery
- func (sd *ServiceDiscovery) GetIstioServiceAccounts(hostname string, ports []string) []string
- func (sd *ServiceDiscovery) GetService(hostname string) (*model.Service, bool)
- func (sd *ServiceDiscovery) HostInstances(addrs map[string]bool) []*model.ServiceInstance
- func (sd *ServiceDiscovery) Instances(hostname string, ports []string, labels model.LabelsCollection) []*model.ServiceInstance
- func (sd *ServiceDiscovery) ManagementPorts(addr string) model.PortList
- func (sd *ServiceDiscovery) Services() []*model.Service
Constants ¶
This section is empty.
Variables ¶
var ( // Types defines the mock config descriptor Types = model.ConfigDescriptor{model.MockConfig} // ExampleRouteRule is an example route rule ExampleRouteRule = &proxyconfig.RouteRule{ Destination: &proxyconfig.IstioService{ Name: "world", }, Route: []*proxyconfig.DestinationWeight{ {Weight: 80, Labels: map[string]string{"version": "v1"}}, {Weight: 20, Labels: map[string]string{"version": "v2"}}, }, } // ExampleIngressRule is an example ingress rule ExampleIngressRule = &proxyconfig.IngressRule{ Destination: &proxyconfig.IstioService{ Name: "world", }, Port: 80, DestinationServicePort: &proxyconfig.IngressRule_DestinationPort{DestinationPort: 80}, } // ExampleEgressRule is an example egress rule ExampleEgressRule = &proxyconfig.EgressRule{ Destination: &proxyconfig.IstioService{ Service: "*cnn.com", }, Ports: []*proxyconfig.EgressRule_Port{{Port: 80, Protocol: "http"}}, UseEgressProxy: false, } // ExampleDestinationPolicy is an example destination policy ExampleDestinationPolicy = &proxyconfig.DestinationPolicy{ Destination: &proxyconfig.IstioService{ Name: "world", }, LoadBalancing: &proxyconfig.LoadBalancing{ LbPolicy: &proxyconfig.LoadBalancing_Name{Name: proxyconfig.LoadBalancing_RANDOM}, }, } )
var ( HelloService = MakeService("hello.default.svc.cluster.local", "10.1.0.0") WorldService = MakeService("world.default.svc.cluster.local", "10.2.0.0") PortHTTP = &model.Port{ Name: "http", Port: 80, Protocol: model.ProtocolHTTP, } ExtHTTPService = MakeExternalHTTPService("httpbin.default.svc.cluster.local", "httpbin.org", "") ExtHTTPSService = MakeExternalHTTPSService("httpsbin.default.svc.cluster.local", "httpbin.org", "") Discovery = &ServiceDiscovery{ services: map[string]*model.Service{ HelloService.Hostname: HelloService, WorldService.Hostname: WorldService, ExtHTTPService.Hostname: ExtHTTPService, ExtHTTPSService.Hostname: ExtHTTPSService, }, versions: 2, } HelloInstanceV0 = MakeIP(HelloService, 0) HelloInstanceV1 = MakeIP(HelloService, 1) HelloProxyV0 = proxy.Node{ Type: proxy.Sidecar, IPAddress: HelloInstanceV0, ID: "v0.default", Domain: "default.svc.cluster.local", } HelloProxyV1 = proxy.Node{ Type: proxy.Sidecar, IPAddress: HelloInstanceV1, ID: "v1.default", Domain: "default.svc.cluster.local", } Ingress = proxy.Node{ Type: proxy.Ingress, IPAddress: "10.3.3.3", ID: "ingress.default", Domain: "default.svc.cluster.local", } Egress = proxy.Node{ Type: proxy.Egress, IPAddress: "10.3.3.4", ID: "egress.default", Domain: "default.svc.cluster.local", } Router = proxy.Node{ Type: proxy.Router, IPAddress: "10.3.3.5", ID: "router.default", Domain: "default.svc.cluster.local", } )
Mock values
Functions ¶
func CheckCacheEvents ¶
func CheckCacheEvents(store model.ConfigStore, cache model.ConfigStoreCache, namespace string, n int, t *testing.T)
CheckCacheEvents validates operational invariants of a cache
func CheckCacheFreshness ¶
func CheckCacheFreshness(cache model.ConfigStoreCache, namespace string, t *testing.T)
CheckCacheFreshness validates operational invariants of a cache
func CheckCacheSync ¶
func CheckCacheSync(store model.ConfigStore, cache model.ConfigStoreCache, namespace string, n int, t *testing.T)
CheckCacheSync validates operational invariants of a cache against the non-cached client.
func CheckIstioConfigTypes ¶
func CheckIstioConfigTypes(store model.ConfigStore, namespace string, t *testing.T)
CheckIstioConfigTypes validates that an empty store can ingest Istio config objects
func CheckMapInvariant ¶
CheckMapInvariant validates operational invariants of an empty config registry
func MakeExternalHTTPSService ¶
MakeExternalHTTPSService creates mock external service
func MakeExternalHTTPService ¶
MakeExternalHTTPService creates mock external service
func MakeInstance ¶
MakeInstance creates a mock instance, version enumerates endpoints
func MakeService ¶
MakeService creates a mock service
Types ¶
type ServiceDiscovery ¶
type ServiceDiscovery struct {
// contains filtered or unexported fields
}
ServiceDiscovery is a mock discovery interface
func NewDiscovery ¶
func NewDiscovery(services map[string]*model.Service, versions int) *ServiceDiscovery
NewDiscovery builds a mock ServiceDiscovery
func (*ServiceDiscovery) GetIstioServiceAccounts ¶
func (sd *ServiceDiscovery) GetIstioServiceAccounts(hostname string, ports []string) []string
GetIstioServiceAccounts gets the Istio service accounts for a service hostname.
func (*ServiceDiscovery) GetService ¶
func (sd *ServiceDiscovery) GetService(hostname string) (*model.Service, bool)
GetService implements discovery interface
func (*ServiceDiscovery) HostInstances ¶
func (sd *ServiceDiscovery) HostInstances(addrs map[string]bool) []*model.ServiceInstance
HostInstances implements discovery interface
func (*ServiceDiscovery) Instances ¶
func (sd *ServiceDiscovery) Instances(hostname string, ports []string, labels model.LabelsCollection) []*model.ServiceInstance
Instances implements discovery interface
func (*ServiceDiscovery) ManagementPorts ¶
func (sd *ServiceDiscovery) ManagementPorts(addr string) model.PortList
ManagementPorts implements discovery interface
func (*ServiceDiscovery) Services ¶
func (sd *ServiceDiscovery) Services() []*model.Service
Services implements discovery interface