Skip to content

Commit

Permalink
re-add Kubernetes external services to tests (istio#2789)
Browse files Browse the repository at this point in the history
From commit istio@a5c9030,
the assumption that Kubernetes external services are not treated specially is incorrect.
  • Loading branch information
vadimeisenbergibm authored and rshriram committed Jan 26, 2018
1 parent 8693748 commit aeac7ae
Show file tree
Hide file tree
Showing 64 changed files with 3,536 additions and 6 deletions.
42 changes: 40 additions & 2 deletions pilot/pkg/proxy/envoy/mock/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ var (
Protocol: model.ProtocolHTTP,
AuthenticationPolicy: meshconfig.AuthenticationPolicy_INHERIT,
}
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,
HelloService.Hostname: HelloService,
WorldService.Hostname: WorldService,
ExtHTTPService.Hostname: ExtHTTPService,
// TODO external https is not currently supported - this service
// should NOT be in any of the .golden json files
ExtHTTPSService.Hostname: ExtHTTPSService,
},
versions: 2,
}
Expand Down Expand Up @@ -107,6 +115,36 @@ func MakeService(hostname, address string) *model.Service {
}
}

// MakeExternalHTTPService creates mock external service
func MakeExternalHTTPService(hostname, external string, address string) *model.Service {
return &model.Service{
Hostname: hostname,
Address: address,
ExternalName: external,
Ports: []*model.Port{{
Name: "http",
Port: 80,
Protocol: model.ProtocolHTTP,
AuthenticationPolicy: meshconfig.AuthenticationPolicy_INHERIT,
}},
}
}

// MakeExternalHTTPSService creates mock external service
func MakeExternalHTTPSService(hostname, external string, address string) *model.Service {
return &model.Service{
Hostname: hostname,
Address: address,
ExternalName: external,
Ports: []*model.Port{{
Name: "https",
Port: 443,
Protocol: model.ProtocolHTTPS,
AuthenticationPolicy: meshconfig.AuthenticationPolicy_INHERIT,
}},
}
}

// MakeInstance creates a mock instance, version enumerates endpoints
func MakeInstance(service *model.Service, port *model.Port, version int, az string) *model.ServiceInstance {
if service.External() {
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-circuit-breaker.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-mixerclient-filter.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-redirect-egress.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-router.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|http",
"service_name": "world.default.svc.cluster.local|http",
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-ssl-context-optin.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
36 changes: 36 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-ssl-context-optout.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,42 @@
"verify_subject_alt_name": []
}
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
],
"ssl_context": {
"cert_chain_file": "/etc/certs/cert-chain.pem",
"private_key_file": "/etc/certs/key.pem",
"ca_cert_file": "/etc/certs/root-cert.pem",
"verify_subject_alt_name": []
}
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
],
"ssl_context": {
"cert_chain_file": "/etc/certs/cert-chain.pem",
"private_key_file": "/etc/certs/key.pem",
"ca_cert_file": "/etc/certs/root-cert.pem",
"verify_subject_alt_name": []
}
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
36 changes: 36 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds-ssl-context.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,42 @@
"verify_subject_alt_name": []
}
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
],
"ssl_context": {
"cert_chain_file": "/etc/certs/cert-chain.pem",
"private_key_file": "/etc/certs/key.pem",
"ca_cert_file": "/etc/certs/root-cert.pem",
"verify_subject_alt_name": []
}
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
],
"ssl_context": {
"cert_chain_file": "/etc/certs/cert-chain.pem",
"private_key_file": "/etc/certs/key.pem",
"ca_cert_file": "/etc/certs/root-cert.pem",
"verify_subject_alt_name": []
}
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
24 changes: 24 additions & 0 deletions pilot/pkg/proxy/envoy/testdata/cds.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@
"type": "sds",
"lb_type": "round_robin"
},
{
"name": "out.httpbin.default.svc.cluster.local|http",
"service_name": "httpbin.default.svc.cluster.local|http",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpbin.default.svc.cluster.local:80"
}
]
},
{
"name": "out.httpsbin.default.svc.cluster.local|https",
"service_name": "httpsbin.default.svc.cluster.local|https",
"connect_timeout_ms": 1000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://httpsbin.default.svc.cluster.local:443"
}
]
},
{
"name": "out.world.default.svc.cluster.local|custom",
"service_name": "world.default.svc.cluster.local|custom",
Expand Down
Loading

0 comments on commit aeac7ae

Please sign in to comment.