1
0
Fork 0

Initial support for Kubernetes ExternalName service type

This commit is contained in:
Regner Blok-Andersen 2017-02-09 17:25:38 -08:00
parent 01e3d7952a
commit 0947aa901e
2 changed files with 80 additions and 19 deletions

View file

@ -31,6 +31,13 @@ func TestLoadIngresses(t *testing.T) {
ServicePort: intstr.FromInt(80),
},
},
{
Path: "/namedthing",
Backend: v1beta1.IngressBackend{
ServiceName: "service4",
ServicePort: intstr.FromString("https"),
},
},
},
},
},
@ -110,6 +117,24 @@ func TestLoadIngresses(t *testing.T) {
},
},
},
{
ObjectMeta: v1.ObjectMeta{
Name: "service4",
UID: "4",
Namespace: "testing",
},
Spec: v1.ServiceSpec{
ClusterIP: "10.0.0.4",
Type: "ExternalName",
ExternalName: "example.com",
Ports: []v1.ServicePort{
{
Name: "https",
Port: 443,
},
},
},
},
}
endpoints := []*v1.Endpoints{
{
@ -221,6 +246,19 @@ func TestLoadIngresses(t *testing.T) {
Method: "wrr",
},
},
"foo/namedthing": {
Servers: map[string]types.Server{
"https://example.com": {
URL: "https://example.com",
Weight: 1,
},
},
CircuitBreaker: nil,
LoadBalancer: &types.LoadBalancer{
Sticky: false,
Method: "wrr",
},
},
"bar": {
Servers: map[string]types.Server{
"2": {
@ -257,6 +295,19 @@ func TestLoadIngresses(t *testing.T) {
},
},
},
"foo/namedthing": {
Backend: "foo/namedthing",
PassHostHeader: true,
Priority: len("/namedthing"),
Routes: map[string]types.Route{
"/namedthing": {
Rule: "PathPrefix:/namedthing",
},
"foo": {
Rule: "Host:foo",
},
},
},
"bar": {
Backend: "bar",
PassHostHeader: true,