Browse code

Merge pull request #23542 from mavenugo/aliases

Use service alias and configure service VIP or dns-rr

Brian Goff authored on 2016/06/16 05:18:50
Showing 16 changed files
... ...
@@ -823,7 +823,7 @@ func (container *Container) BuildCreateEndpointOptions(n libnetwork.Network, epC
823 823
 			})
824 824
 		}
825 825
 
826
-		createOptions = append(createOptions, libnetwork.CreateOptionService(svcCfg.Name, svcCfg.ID, net.ParseIP(vip), portConfigs))
826
+		createOptions = append(createOptions, libnetwork.CreateOptionService(svcCfg.Name, svcCfg.ID, net.ParseIP(vip), portConfigs, svcCfg.Aliases[n.ID()]))
827 827
 	}
828 828
 
829 829
 	if !containertypes.NetworkMode(n.Name()).IsUserDefined() {
... ...
@@ -918,7 +918,7 @@ func populateNetworkID(ctx context.Context, c swarmapi.ControlClient, s *types.S
918 918
 		if err != nil {
919 919
 			return err
920 920
 		}
921
-		s.Networks[i] = types.NetworkAttachmentConfig{Target: apiNetwork.ID}
921
+		s.Networks[i].Target = apiNetwork.ID
922 922
 	}
923 923
 	return nil
924 924
 }
... ...
@@ -126,7 +126,6 @@ func (c *containerAdapter) create(ctx context.Context, backend executorpkg.Backe
126 126
 
127 127
 	if nc != nil {
128 128
 		for n, ep := range nc.EndpointsConfig {
129
-			logrus.Errorf("CONNECT %s : %v", n, ep.IPAMConfig.IPv4Address)
130 129
 			if err := backend.ConnectContainerToNetwork(cr.ID, n, ep); err != nil {
131 130
 				return err
132 131
 			}
... ...
@@ -348,6 +348,7 @@ func (c *containerConfig) serviceConfig() *clustertypes.ServiceConfig {
348 348
 	log.Printf("Creating service config in agent for t = %+v", c.task)
349 349
 	svcCfg := &clustertypes.ServiceConfig{
350 350
 		Name:             c.task.ServiceAnnotations.Name,
351
+		Aliases:          make(map[string][]string),
351 352
 		ID:               c.task.ServiceID,
352 353
 		VirtualAddresses: make(map[string]*clustertypes.VirtualAddress),
353 354
 	}
... ...
@@ -357,6 +358,9 @@ func (c *containerConfig) serviceConfig() *clustertypes.ServiceConfig {
357 357
 			// We support only IPv4 virtual IP for now.
358 358
 			IPv4: c.virtualIP(na.Network.ID),
359 359
 		}
360
+		if len(na.Aliases) > 0 {
361
+			svcCfg.Aliases[na.Network.ID] = na.Aliases
362
+		}
360 363
 	}
361 364
 
362 365
 	if c.task.Endpoint != nil {
... ...
@@ -31,6 +31,7 @@ type PortConfig struct {
31 31
 type ServiceConfig struct {
32 32
 	ID               string
33 33
 	Name             string
34
+	Aliases          map[string][]string
34 35
 	VirtualAddresses map[string]*VirtualAddress
35 36
 	ExposedPorts     []*PortConfig
36 37
 }
... ...
@@ -65,7 +65,7 @@ clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
65 65
 clone git github.com/imdario/mergo 0.2.1
66 66
 
67 67
 #get libnetwork packages
68
-clone git github.com/docker/libnetwork 452dff166e0abd9455b07c835613197f078a34de
68
+clone git github.com/docker/libnetwork 0d517a9e4e5cbdb889b3257eebd2351addcd46d4
69 69
 clone git github.com/docker/go-events 39718a26497694185f8fb58a7d6f31947f3dc42d
70 70
 clone git github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
71 71
 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
... ...
@@ -139,7 +139,7 @@ clone git github.com/docker/docker-credential-helpers v0.3.0
139 139
 clone git github.com/docker/containerd 860f3a94940894ac0a106eff4bd1616a67407ee2
140 140
 
141 141
 # cluster
142
-clone git github.com/docker/swarmkit 25572005febb76c2cc5f7e37d878615e6fe330f9
142
+clone git github.com/docker/swarmkit 682e0b69be208176d6055cba855a5e9cf15c7cb4
143 143
 clone git github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
144 144
 clone git github.com/gogo/protobuf 43a2e0b1c32252bfbbdf81f7faa7a88fb3fa4028
145 145
 clone git github.com/cloudflare/cfssl 92f037e39eb103fb30f9151be40d9ed267fc4ae2
... ...
@@ -353,7 +353,7 @@ func (ep *endpoint) addToCluster() error {
353 353
 				ingressPorts = ep.ingressPorts
354 354
 			}
355 355
 
356
-			if err := c.addServiceBinding(ep.svcName, ep.svcID, n.ID(), ep.ID(), ep.virtualIP, ingressPorts, ep.Iface().Address().IP); err != nil {
356
+			if err := c.addServiceBinding(ep.svcName, ep.svcID, n.ID(), ep.ID(), ep.virtualIP, ingressPorts, ep.svcAliases, ep.Iface().Address().IP); err != nil {
357 357
 				return err
358 358
 			}
359 359
 		}
... ...
@@ -364,6 +364,7 @@ func (ep *endpoint) addToCluster() error {
364 364
 			ServiceID:    ep.svcID,
365 365
 			VirtualIP:    ep.virtualIP.String(),
366 366
 			IngressPorts: ingressPorts,
367
+			Aliases:      ep.svcAliases,
367 368
 			EndpointIP:   ep.Iface().Address().IP.String(),
368 369
 		})
369 370
 
... ...
@@ -399,7 +400,7 @@ func (ep *endpoint) deleteFromCluster() error {
399 399
 				ingressPorts = ep.ingressPorts
400 400
 			}
401 401
 
402
-			if err := c.rmServiceBinding(ep.svcName, ep.svcID, n.ID(), ep.ID(), ep.virtualIP, ingressPorts, ep.Iface().Address().IP); err != nil {
402
+			if err := c.rmServiceBinding(ep.svcName, ep.svcID, n.ID(), ep.ID(), ep.virtualIP, ingressPorts, ep.svcAliases, ep.Iface().Address().IP); err != nil {
403 403
 				return err
404 404
 			}
405 405
 		}
... ...
@@ -554,6 +555,7 @@ func (c *controller) handleEpTableEvent(ev events.Event) {
554 554
 	vip := net.ParseIP(epRec.VirtualIP)
555 555
 	ip := net.ParseIP(epRec.EndpointIP)
556 556
 	ingressPorts := epRec.IngressPorts
557
+	aliases := epRec.Aliases
557 558
 
558 559
 	if name == "" || ip == nil {
559 560
 		logrus.Errorf("Invalid endpoint name/ip received while handling service table event %s", value)
... ...
@@ -562,7 +564,7 @@ func (c *controller) handleEpTableEvent(ev events.Event) {
562 562
 
563 563
 	if isAdd {
564 564
 		if svcID != "" {
565
-			if err := c.addServiceBinding(svcName, svcID, nid, eid, vip, ingressPorts, ip); err != nil {
565
+			if err := c.addServiceBinding(svcName, svcID, nid, eid, vip, ingressPorts, aliases, ip); err != nil {
566 566
 				logrus.Errorf("Failed adding service binding for value %s: %v", value, err)
567 567
 				return
568 568
 			}
... ...
@@ -571,7 +573,7 @@ func (c *controller) handleEpTableEvent(ev events.Event) {
571 571
 		n.addSvcRecords(name, ip, nil, true)
572 572
 	} else {
573 573
 		if svcID != "" {
574
-			if err := c.rmServiceBinding(svcName, svcID, nid, eid, vip, ingressPorts, ip); err != nil {
574
+			if err := c.rmServiceBinding(svcName, svcID, nid, eid, vip, ingressPorts, aliases, ip); err != nil {
575 575
 				logrus.Errorf("Failed adding service binding for value %s: %v", value, err)
576 576
 				return
577 577
 			}
... ...
@@ -72,6 +72,8 @@ type EndpointRecord struct {
72 72
 	EndpointIP string `protobuf:"bytes,5,opt,name=endpoint_ip,json=endpointIp,proto3" json:"endpoint_ip,omitempty"`
73 73
 	// IngressPorts exposed by the service to which this endpoint belongs.
74 74
 	IngressPorts []*PortConfig `protobuf:"bytes,6,rep,name=ingress_ports,json=ingressPorts" json:"ingress_ports,omitempty"`
75
+	// A list of aliases which are alternate names for the service
76
+	Aliases []string `protobuf:"bytes,7,rep,name=aliases" json:"aliases,omitempty"`
75 77
 }
76 78
 
77 79
 func (m *EndpointRecord) Reset()                    { *m = EndpointRecord{} }
... ...
@@ -120,7 +122,7 @@ func (this *EndpointRecord) GoString() string {
120 120
 	if this == nil {
121 121
 		return "nil"
122 122
 	}
123
-	s := make([]string, 0, 10)
123
+	s := make([]string, 0, 11)
124 124
 	s = append(s, "&libnetwork.EndpointRecord{")
125 125
 	s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n")
126 126
 	s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n")
... ...
@@ -130,6 +132,7 @@ func (this *EndpointRecord) GoString() string {
130 130
 	if this.IngressPorts != nil {
131 131
 		s = append(s, "IngressPorts: "+fmt.Sprintf("%#v", this.IngressPorts)+",\n")
132 132
 	}
133
+	s = append(s, "Aliases: "+fmt.Sprintf("%#v", this.Aliases)+",\n")
133 134
 	s = append(s, "}")
134 135
 	return strings.Join(s, "")
135 136
 }
... ...
@@ -228,6 +231,21 @@ func (m *EndpointRecord) MarshalTo(data []byte) (int, error) {
228 228
 			i += n
229 229
 		}
230 230
 	}
231
+	if len(m.Aliases) > 0 {
232
+		for _, s := range m.Aliases {
233
+			data[i] = 0x3a
234
+			i++
235
+			l = len(s)
236
+			for l >= 1<<7 {
237
+				data[i] = uint8(uint64(l)&0x7f | 0x80)
238
+				l >>= 7
239
+				i++
240
+			}
241
+			data[i] = uint8(l)
242
+			i++
243
+			i += copy(data[i:], s)
244
+		}
245
+	}
231 246
 	return i, nil
232 247
 }
233 248
 
... ...
@@ -326,6 +344,12 @@ func (m *EndpointRecord) Size() (n int) {
326 326
 			n += 1 + l + sovAgent(uint64(l))
327 327
 		}
328 328
 	}
329
+	if len(m.Aliases) > 0 {
330
+		for _, s := range m.Aliases {
331
+			l = len(s)
332
+			n += 1 + l + sovAgent(uint64(l))
333
+		}
334
+	}
329 335
 	return n
330 336
 }
331 337
 
... ...
@@ -372,6 +396,7 @@ func (this *EndpointRecord) String() string {
372 372
 		`VirtualIP:` + fmt.Sprintf("%v", this.VirtualIP) + `,`,
373 373
 		`EndpointIP:` + fmt.Sprintf("%v", this.EndpointIP) + `,`,
374 374
 		`IngressPorts:` + strings.Replace(fmt.Sprintf("%v", this.IngressPorts), "PortConfig", "PortConfig", 1) + `,`,
375
+		`Aliases:` + fmt.Sprintf("%v", this.Aliases) + `,`,
375 376
 		`}`,
376 377
 	}, "")
377 378
 	return s
... ...
@@ -602,6 +627,35 @@ func (m *EndpointRecord) Unmarshal(data []byte) error {
602 602
 				return err
603 603
 			}
604 604
 			iNdEx = postIndex
605
+		case 7:
606
+			if wireType != 2 {
607
+				return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType)
608
+			}
609
+			var stringLen uint64
610
+			for shift := uint(0); ; shift += 7 {
611
+				if shift >= 64 {
612
+					return ErrIntOverflowAgent
613
+				}
614
+				if iNdEx >= l {
615
+					return io.ErrUnexpectedEOF
616
+				}
617
+				b := data[iNdEx]
618
+				iNdEx++
619
+				stringLen |= (uint64(b) & 0x7F) << shift
620
+				if b < 0x80 {
621
+					break
622
+				}
623
+			}
624
+			intStringLen := int(stringLen)
625
+			if intStringLen < 0 {
626
+				return ErrInvalidLengthAgent
627
+			}
628
+			postIndex := iNdEx + intStringLen
629
+			if postIndex > l {
630
+				return io.ErrUnexpectedEOF
631
+			}
632
+			m.Aliases = append(m.Aliases, string(data[iNdEx:postIndex]))
633
+			iNdEx = postIndex
605 634
 		default:
606 635
 			iNdEx = preIndex
607 636
 			skippy, err := skipAgent(data[iNdEx:])
... ...
@@ -865,29 +919,30 @@ var (
865 865
 )
866 866
 
867 867
 var fileDescriptorAgent = []byte{
868
-	// 384 bytes of a gzipped FileDescriptorProto
869
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x6f, 0xda, 0x40,
870
-	0x18, 0xc6, 0x31, 0xb8, 0x08, 0xbf, 0xc6, 0x2e, 0x3a, 0x55, 0x95, 0xc5, 0x60, 0x28, 0x52, 0x25,
871
-	0x86, 0xca, 0x48, 0x74, 0x64, 0x03, 0x3a, 0x78, 0xa9, 0x2c, 0xf7, 0xcf, 0x8a, 0x0c, 0xbe, 0xba,
872
-	0xa7, 0xba, 0x3e, 0xeb, 0x7c, 0xd0, 0xb5, 0x63, 0x94, 0x2d, 0x1f, 0x20, 0x53, 0xbe, 0x4c, 0xc6,
873
-	0x8c, 0x99, 0xa2, 0xc0, 0x9a, 0x25, 0x1f, 0x21, 0x77, 0x67, 0x1b, 0x14, 0x89, 0xe1, 0x95, 0x4e,
874
-	0xbf, 0xe7, 0xf7, 0x9e, 0x5e, 0x3d, 0x60, 0x46, 0x09, 0xce, 0xb8, 0x97, 0x33, 0xca, 0x29, 0x82,
875
-	0x94, 0xac, 0x33,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 0x82, 0x4a, 0x0b, 0x8f, 0x0b, 0x68, 0x00, 0x26, 0x8f, 0x58, 0x82, 0xb9, 0xba, 0x4d,
887
-	0x55, 0x65, 0x85, 0x50, 0x22, 0xb9, 0x89, 0x3e, 0x82, 0x9d, 0x6f, 0xd7, 0x29, 0x29, 0x7e, 0xe3,
888
-	0xb8, 0x74, 0x74, 0xe5, 0x58, 0x47, 0x2a, 0xb5, 0xd1, 0x12, 0x3a, 0xf5, 0xef, 0xc8, 0x81, 0xd6,
889
-	0xf7, 0x45, 0xd0, 0x6b, 0xf4, 0xdf, 0x5e, 0x5e, 0x0f, 0xcd, 0x1a, 0x0b, 0x24, 0x93, 0x1f, 0xcb,
890
-	0xa0, 0xa7, 0xbd, 0x4e, 0x04, 0xea, 0xeb, 0x17, 0x37, 0x6e, 0x63, 0xee, 0xdc, 0xef, 0xdd, 0xc6,
891
-	0xf3, 0xde, 0xd5, 0xfe, 0x1f, 0x5c, 0xed, 0x56, 0xcc, 0x9d, 0x98, 0x47, 0x31, 0xeb, 0xb6, 0xba,
892
-	0xf8, 0xf3, 0x4b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x6d, 0x44, 0x68, 0x53, 0x02, 0x00, 0x00,
868
+	// 397 bytes of a gzipped FileDescriptorProto
869
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xbf, 0xae, 0xd3, 0x30,
870
+	0x14, 0xc6, 0x9b, 0xdb, 0x70, 0x6f, 0x73, 0xd2, 0x84, 0xca, 0x42, 0x28, 0xea, 0x90, 0x96, 0x4a,
871
+	0x48, 0x1d, 0x50, 0x2a, 0x95, 0xb1, 0x5b, 0x5b, 0x86, 0x2c, 0x28, 0x32, 0x7f, 0xd6, 0x2a, 0x6d,
872
+	0x4c, 0xb0, 0x08, 0x71, 0x64, 0xbb, 0x65, 0x65, 0x44, 0xbc, 0x03, 0x13, 0x23, 0x2f, 0xc2, 0xc8,
873
+	0xc8, 0x84, 0x68, 0x57, 0x16, 0x1e, 0x01, 0xdb, 0x49, 0x5a, 0x21, 0x75, 0xb0, 0xe4, 0xfc, 0xce,
874
+	0xef, 0x4b, 0x4e, 0x3e, 0x70, 0xd3, 0x9c, 0x94, 0x32, 0xaa, 0x38, 0x93, 0x0c, 0x41, 0x41, 0xb7,
875
+	0x25, 0x91, 0x1f, 0x18, 0x7f, 0x37, 0x7c, 0x90, 0xb3, 0x9c, 0x19, 0x3c, 0xd3, 0xb7, 0xda, 0x98,
876
+	0x7c, 0xbb, 0x01, 0xff, 0x59, 0x99, 0x55, 0x8c, 0x96, 0x12, 0x93, 0x1d, 0xe3, 0x19, 0x42, 0x60,
877
+	0x97, 0xe9, 0x7b, 0x12, 0x58, 0x63, 0x6b, 0xea, 0x60, 0x73, 0x47, 0x8f, 0xa0, 0x2f, 0x08, 0x3f,
878
+	0xd0, 0x1d, 0xd9, 0x98, 0xd9, 0x8d, 0x99, 0xb9, 0x0d, 0x7b, 0xae, 0x95, 0x27, 0x00, 0xad, 0x42,
879
+	0xb3, 0xa0, 0xab, 0x85, 0xa5, 0x77, 0xfa, 0x35, 0x72, 0x5e, 0xd4, 0x34, 0x5e, 0x63, 0xa7, 0x11,
880
+	0xe2, 0x4c, 0xdb, 0x07, 0xca, 0xe5, 0x3e, 0x2d, 0x36, 0xb4, 0x0a, 0xec, 0x8b, 0xfd, 0xba, 0xa6,
881
+	0x71, 0x82, 0x9d, 0x46, 0x88, 0x2b, 0x34, 0x03, 0x97, 0x34, 0x4b, 0x6a, 0xfd, 0x9e, 0xd1, 0x7d,
882
+	0xa5, 0x43, 0xbb, 0xbb, 0xf2, 0xa1, 0x55, 0x54, 0x60, 0x01, 0x1e, 0x2d, 0x73, 0x4e, 0x84, 0xd8,
883
+	0x54, 0x8c, 0x4b, 0x11, 0xdc, 0x8e, 0xbb, 0x53, 0x77, 0xfe, 0x30, 0xba, 0x14, 0x12, 0x25, 0x6a,
884
+	0xb0, 0x62, 0xe5, 0x1b, 0x9a, 0xe3, 0x7e, 0x23, 0x6b, 0x24, 0x50, 0x00, 0x77, 0x69, 0x41, 0x53,
885
+	0x41, 0x44, 0x70, 0xa7, 0x62, 0x0e, 0x6e, 0x1f, 0x27, 0x7f, 0x2c, 0x80, 0x4b, 0xec, 0x6a, 0x53,
886
+	0x0b, 0xe8, 0x99, 0x66, 0x77, 0xac, 0x30, 0x2d, 0xf9, 0xf3, 0xd1, 0xf5, 0x8f, 0x46, 0x49, 0xa3,
887
+	0xe1, 0x73, 0x00, 0x8d, 0xc0, 0x95, 0x29, 0xcf, 0x89, 0x34, 0x5b, 0x9b, 0x12, 0x3d, 0x0c, 0x35,
888
+	0xd2, 0x49, 0xf4, 0x18, 0xfc, 0x6a, 0xbf, 0x2d, 0xa8, 0x78, 0x4b, 0xb2, 0xda, 0xb1, 0x8d, 0xe3,
889
+	0x9d, 0xa9, 0xd6, 0x26, 0x6b, 0xe8, 0xb5, 0x6f, 0x57, 0x7f, 0xd3, 0x7d, 0xb9, 0x4a, 0x06, 0x9d,
890
+	0xe1, 0xfd, 0xcf, 0x5f, 0xc6, 0x6e, 0x8b, 0x15, 0xd2, 0x93, 0x57, 0xeb, 0x64, 0x60, 0xfd, 0x3f,
891
+	0x51, 0x68, 0x68, 0x7f, 0xfa, 0x1a, 0x76, 0x96, 0xc1, 0xcf, 0x63, 0xd8, 0xf9, 0x7b, 0x0c, 0xad,
892
+	0x8f, 0xa7, 0xd0, 0xfa, 0xae, 0xce, 0x0f, 0x75, 0x7e, 0xab, 0xb3, 0xbd, 0x35, 0x1b, 0x3f, 0xfd,
893
+	0x17, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x58, 0xc7, 0xbd, 0x6d, 0x02, 0x00, 0x00,
893 894
 }
... ...
@@ -31,6 +31,9 @@ message EndpointRecord {
31 31
 
32 32
 	// IngressPorts exposed by the service to which this endpoint belongs.
33 33
 	repeated PortConfig ingress_ports = 6;
34
+
35
+	// A list of aliases which are alternate names for the service
36
+	repeated string aliases = 7;
34 37
 }
35 38
 
36 39
 // PortConfig specifies an exposed port which can be
... ...
@@ -83,8 +83,12 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
83 83
 	if link, err := ns.NlHandle().LinkByName(ep.srcName); err == nil {
84 84
 		ns.NlHandle().LinkDel(link)
85 85
 	}
86
+
86 87
 	if err := d.storeDelete(ep); err != nil {
87 88
 		logrus.Warnf("Failed to remove macvlan endpoint %s from store: %v", ep.id[0:7], err)
88 89
 	}
90
+
91
+	n.deleteEndpoint(ep.id)
92
+
89 93
 	return nil
90 94
 }
... ...
@@ -70,6 +70,7 @@ type endpoint struct {
70 70
 	svcID             string
71 71
 	svcName           string
72 72
 	virtualIP         net.IP
73
+	svcAliases        []string
73 74
 	ingressPorts      []*PortConfig
74 75
 	dbIndex           uint64
75 76
 	dbExists          bool
... ...
@@ -98,6 +99,7 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
98 98
 	epMap["svcID"] = ep.svcID
99 99
 	epMap["virtualIP"] = ep.virtualIP.String()
100 100
 	epMap["ingressPorts"] = ep.ingressPorts
101
+	epMap["svcAliases"] = ep.svcAliases
101 102
 
102 103
 	return json.Marshal(epMap)
103 104
 }
... ...
@@ -198,6 +200,11 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
198 198
 		ep.virtualIP = net.ParseIP(vip.(string))
199 199
 	}
200 200
 
201
+	sal, _ := json.Marshal(epMap["svcAliases"])
202
+	var svcAliases []string
203
+	json.Unmarshal(sal, &svcAliases)
204
+	ep.svcAliases = svcAliases
205
+
201 206
 	pc, _ := json.Marshal(epMap["ingressPorts"])
202 207
 	var ingressPorts []*PortConfig
203 208
 	json.Unmarshal(pc, &ingressPorts)
... ...
@@ -231,6 +238,9 @@ func (ep *endpoint) CopyTo(o datastore.KVObject) error {
231 231
 	dstEp.svcID = ep.svcID
232 232
 	dstEp.virtualIP = ep.virtualIP
233 233
 
234
+	dstEp.svcAliases = make([]string, len(ep.svcAliases))
235
+	copy(dstEp.svcAliases, ep.svcAliases)
236
+
234 237
 	dstEp.ingressPorts = make([]*PortConfig, len(ep.ingressPorts))
235 238
 	copy(dstEp.ingressPorts, ep.ingressPorts)
236 239
 
... ...
@@ -935,12 +945,13 @@ func CreateOptionAlias(name string, alias string) EndpointOption {
935 935
 }
936 936
 
937 937
 // CreateOptionService function returns an option setter for setting service binding configuration
938
-func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig) EndpointOption {
938
+func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption {
939 939
 	return func(ep *endpoint) {
940 940
 		ep.svcName = name
941 941
 		ep.svcID = id
942 942
 		ep.virtualIP = vip
943 943
 		ep.ingressPorts = ingressPorts
944
+		ep.svcAliases = aliases
944 945
 	}
945 946
 }
946 947
 
... ...
@@ -37,7 +37,7 @@ func newService(name string, id string, ingressPorts []*PortConfig) *service {
37 37
 	}
38 38
 }
39 39
 
40
-func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, ip net.IP) error {
40
+func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
41 41
 	var (
42 42
 		s          *service
43 43
 		addService bool
... ...
@@ -61,6 +61,9 @@ func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, i
61 61
 	// Add endpoint IP to special "tasks.svc_name" so that the
62 62
 	// applications have access to DNS RR.
63 63
 	n.(*network).addSvcRecords("tasks."+name, ip, nil, false)
64
+	for _, alias := range aliases {
65
+		n.(*network).addSvcRecords("tasks."+alias, ip, nil, false)
66
+	}
64 67
 
65 68
 	// Add service name to vip in DNS, if vip is valid. Otherwise resort to DNS RR
66 69
 	svcIP := vip
... ...
@@ -68,6 +71,9 @@ func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, i
68 68
 		svcIP = ip
69 69
 	}
70 70
 	n.(*network).addSvcRecords(name, svcIP, nil, false)
71
+	for _, alias := range aliases {
72
+		n.(*network).addSvcRecords(alias, svcIP, nil, false)
73
+	}
71 74
 
72 75
 	s.Lock()
73 76
 	defer s.Unlock()
... ...
@@ -107,7 +113,7 @@ func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, i
107 107
 	return nil
108 108
 }
109 109
 
110
-func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, ip net.IP) error {
110
+func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
111 111
 	var rmService bool
112 112
 
113 113
 	n, err := c.NetworkByID(nid)
... ...
@@ -125,6 +131,9 @@ func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, in
125 125
 
126 126
 	// Delete the special "tasks.svc_name" backend record.
127 127
 	n.(*network).deleteSvcRecords("tasks."+name, ip, nil, false)
128
+	for _, alias := range aliases {
129
+		n.(*network).deleteSvcRecords("tasks."+alias, ip, nil, false)
130
+	}
128 131
 
129 132
 	// Make sure to remove the right IP since if vip is
130 133
 	// not valid we would have added a DNS RR record.
... ...
@@ -133,6 +142,9 @@ func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, in
133 133
 		svcIP = ip
134 134
 	}
135 135
 	n.(*network).deleteSvcRecords(name, svcIP, nil, false)
136
+	for _, alias := range aliases {
137
+		n.(*network).deleteSvcRecords(alias, svcIP, nil, false)
138
+	}
136 139
 
137 140
 	s.Lock()
138 141
 	defer s.Unlock()
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"net"
8 8
 )
9 9
 
10
-func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, ip net.IP) error {
10
+func (c *controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
11 11
 	return fmt.Errorf("not supported")
12 12
 }
13 13
 
14
-func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, ip net.IP) error {
14
+func (c *controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
15 15
 	return fmt.Errorf("not supported")
16 16
 }
17 17
 
... ...
@@ -175,6 +175,8 @@ type NetworkAttachment struct {
175 175
 	// List of IPv4/IPv6 addresses that are assigned to the object
176 176
 	// as part of getting attached to this network.
177 177
 	Addresses []string `protobuf:"bytes,2,rep,name=addresses" json:"addresses,omitempty"`
178
+	// List of aliases by which a task is resolved in a network
179
+	Aliases []string `protobuf:"bytes,3,rep,name=aliases" json:"aliases,omitempty"`
178 180
 }
179 181
 
180 182
 func (m *NetworkAttachment) Reset()                    { *m = NetworkAttachment{} }
... ...
@@ -360,6 +362,13 @@ func (m *NetworkAttachment) Copy() *NetworkAttachment {
360 360
 		}
361 361
 	}
362 362
 
363
+	if m.Aliases != nil {
364
+		o.Aliases = make([]string, 0, len(m.Aliases))
365
+		for _, v := range m.Aliases {
366
+			o.Aliases = append(o.Aliases, v)
367
+		}
368
+	}
369
+
363 370
 	return o
364 371
 }
365 372
 
... ...
@@ -514,12 +523,13 @@ func (this *NetworkAttachment) GoString() string {
514 514
 	if this == nil {
515 515
 		return "nil"
516 516
 	}
517
-	s := make([]string, 0, 6)
517
+	s := make([]string, 0, 7)
518 518
 	s = append(s, "&api.NetworkAttachment{")
519 519
 	if this.Network != nil {
520 520
 		s = append(s, "Network: "+fmt.Sprintf("%#v", this.Network)+",\n")
521 521
 	}
522 522
 	s = append(s, "Addresses: "+fmt.Sprintf("%#v", this.Addresses)+",\n")
523
+	s = append(s, "Aliases: "+fmt.Sprintf("%#v", this.Aliases)+",\n")
523 524
 	s = append(s, "}")
524 525
 	return strings.Join(s, "")
525 526
 }
... ...
@@ -995,6 +1005,21 @@ func (m *NetworkAttachment) MarshalTo(data []byte) (int, error) {
995 995
 			i += copy(data[i:], s)
996 996
 		}
997 997
 	}
998
+	if len(m.Aliases) > 0 {
999
+		for _, s := range m.Aliases {
1000
+			data[i] = 0x1a
1001
+			i++
1002
+			l = len(s)
1003
+			for l >= 1<<7 {
1004
+				data[i] = uint8(uint64(l)&0x7f | 0x80)
1005
+				l >>= 7
1006
+				i++
1007
+			}
1008
+			data[i] = uint8(l)
1009
+			i++
1010
+			i += copy(data[i:], s)
1011
+		}
1012
+	}
998 1013
 	return i, nil
999 1014
 }
1000 1015
 
... ...
@@ -1308,6 +1333,12 @@ func (m *NetworkAttachment) Size() (n int) {
1308 1308
 			n += 1 + l + sovObjects(uint64(l))
1309 1309
 		}
1310 1310
 	}
1311
+	if len(m.Aliases) > 0 {
1312
+		for _, s := range m.Aliases {
1313
+			l = len(s)
1314
+			n += 1 + l + sovObjects(uint64(l))
1315
+		}
1316
+	}
1311 1317
 	return n
1312 1318
 }
1313 1319
 
... ...
@@ -1464,6 +1495,7 @@ func (this *NetworkAttachment) String() string {
1464 1464
 	s := strings.Join([]string{`&NetworkAttachment{`,
1465 1465
 		`Network:` + strings.Replace(fmt.Sprintf("%v", this.Network), "Network", "Network", 1) + `,`,
1466 1466
 		`Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`,
1467
+		`Aliases:` + fmt.Sprintf("%v", this.Aliases) + `,`,
1467 1468
 		`}`,
1468 1469
 	}, "")
1469 1470
 	return s
... ...
@@ -2854,6 +2886,35 @@ func (m *NetworkAttachment) Unmarshal(data []byte) error {
2854 2854
 			}
2855 2855
 			m.Addresses = append(m.Addresses, string(data[iNdEx:postIndex]))
2856 2856
 			iNdEx = postIndex
2857
+		case 3:
2858
+			if wireType != 2 {
2859
+				return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType)
2860
+			}
2861
+			var stringLen uint64
2862
+			for shift := uint(0); ; shift += 7 {
2863
+				if shift >= 64 {
2864
+					return ErrIntOverflowObjects
2865
+				}
2866
+				if iNdEx >= l {
2867
+					return io.ErrUnexpectedEOF
2868
+				}
2869
+				b := data[iNdEx]
2870
+				iNdEx++
2871
+				stringLen |= (uint64(b) & 0x7F) << shift
2872
+				if b < 0x80 {
2873
+					break
2874
+				}
2875
+			}
2876
+			intStringLen := int(stringLen)
2877
+			if intStringLen < 0 {
2878
+				return ErrInvalidLengthObjects
2879
+			}
2880
+			postIndex := iNdEx + intStringLen
2881
+			if postIndex > l {
2882
+				return io.ErrUnexpectedEOF
2883
+			}
2884
+			m.Aliases = append(m.Aliases, string(data[iNdEx:postIndex]))
2885
+			iNdEx = postIndex
2857 2886
 		default:
2858 2887
 			iNdEx = preIndex
2859 2888
 			skippy, err := skipObjects(data[iNdEx:])
... ...
@@ -3405,65 +3466,66 @@ var (
3405 3405
 )
3406 3406
 
3407 3407
 var fileDescriptorObjects = []byte{
3408
-	// 949 bytes of a gzipped FileDescriptorProto
3409
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6e, 0x1b, 0x45,
3410
-	0x18, 0xaf, 0x9d, 0x8d, 0xed, 0xfd, 0x9c, 0x44, 0x62, 0xa8, 0x2a, 0x37, 0x84, 0xa4, 0xb8, 0x02,
3408
+	// 965 bytes of a gzipped FileDescriptorProto
3409
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
3410
+	0x14, 0xaf, 0xed, 0xad, 0xed, 0x7d, 0x4e, 0x22, 0x31, 0x54, 0xd5, 0x36, 0x84, 0xa4, 0xb8, 0x02,
3411 3411
 	0x71, 0x40, 0xae, 0x28, 0x05, 0x81, 0xa0, 0x42, 0xb6, 0x13, 0x81, 0x05, 0x81, 0x68, 0x5a, 0x85,
3412
-	0xa3, 0x35, 0xd9, 0x9d, 0xa6, 0x8b, 0xed, 0xdd, 0xd5, 0xcc, 0xc4, 0x55, 0x6e, 0x3c, 0x01, 0x12,
3413
-	0x2f, 0xc0, 0xab, 0x70, 0x8d, 0x38, 0x71, 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 0xa0, 0x1e, 0x85, 0xce, 0x78, 0x7f, 0xd0, 0x78, 0xf9, 0x7c, 0xaf, 0x3e,
3425
-	0xda, 0xe7, 0xb8, 0xc3, 0xee, 0x83, 0x37, 0x43, 0x0f, 0xc9, 0xac, 0x4e, 0x95, 0xb0, 0x8d, 0x00,
3426
-	0xf9, 0xe4, 0xb0, 0xec, 0x13, 0xf0, 0x6c, 0x58, 0xc9, 0x98, 0x9d, 0x2a, 0x8e, 0x3d, 0xf3, 0x11,
3427
-	0x62, 0x72, 0x9e, 0xc5, 0xb3, 0x03, 0x68, 0x87, 0x52, 0x07, 0x2a, 0x4a, 0x8d, 0x8d, 0xa4, 0xe7,
3428
-	0xe8, 0x77, 0x57, 0xd1, 0xf7, 0x17, 0x50, 0x5e, 0xe6, 0x61, 0x44, 0x1a, 0xe8, 0xa7, 0x39, 0xd3,
3429
-	0x9d, 0x75, 0xa7, 0xb0, 0xbb, 0xd2, 0x00, 0x87, 0x22, 0x13, 0x88, 0xc3, 0xbe, 0x86, 0xad, 0x99,
3430
-	0x88, 0xc5, 0xa9, 0x54, 0x63, 0x52, 0x69, 0x38, 0x95, 0x77, 0x2a, 0x5d, 0xcf, 0x90, 0x99, 0x10,
3431
-	0xdf, 0x9c, 0x95, 0x97, 0xe8, 0x0e, 0x08, 0x63, 0x44, 0xf0, 0x74, 0x26, 0x63, 0xd3, 0x69, 0x3a,
3432
-	0x95, 0x77, 0x2b, 0x6d, 0x91, 0xe6, 0x59, 0xa2, 0x26, 0xfd, 0x02, 0xcc, 0x4b, 0x44, 0xf6, 0x15,
3433
-	0xb4, 0x03, 0xa9, 0x4c, 0xf4, 0x24, 0x0a, 0x30, 0x69, 0x9d, 0x96, 0xd3, 0xd9, 0xab, 0xd2, 0x19,
3434
-	0x2e, 0x60, 0xe4, 0x54, 0x99, 0xd9, 0xfd, 0xbd, 0x06, 0xcd, 0x47, 0x52, 0xcd, 0xa3, 0xe0, 0xff,
3435
-	0x4d, 0xf7, 0x67, 0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3457
-	0x66, 0x89, 0x7b, 0x08, 0x5e, 0x94, 0x8a, 0x19, 0xdd, 0x69, 0x95, 0x27, 0x8f, 0x8e, 0xfa, 0x87,
3458
-	0xdf, 0xa7, 0x59, 0x0d, 0xb6, 0xd0, 0x51, 0xcf, 0x6e, 0x70, 0x47, 0xeb, 0xfe, 0x83, 0x01, 0x19,
3459
-	0x4e, 0xcf, 0xb4, 0x91, 0xea, 0xba, 0x03, 0x42, 0xc7, 0x2e, 0x05, 0x64, 0x08, 0x4d, 0x95, 0x24,
3460
-	0x66, 0x1c, 0x88, 0xcb, 0x62, 0xc1, 0x11, 0x32, 0xec, 0x0f, 0xb6, 0x2c, 0xd1, 0xb6, 0x7c, 0xb6,
3461
-	0xe6, 0x0d, 0x4b, 0x1d, 0x0a, 0x1c, 0xc7, 0xb7, 0xf2, 0x41, 0x79, 0x82, 0x3b, 0xda, 0x28, 0x91,
3462
-	0x8e, 0x27, 0xf2, 0xdc, 0x5e, 0xfe, 0x6b, 0xab, 0xae, 0xed, 0x83, 0x38, 0x50, 0xe7, 0x2e, 0x50,
3463
-	0xdf, 0xc8, 0x73, 0x7e, 0x93, 0x04, 0x06, 0x39, 0x1f, 0x37, 0x35, 0xfb, 0x12, 0x76, 0x64, 0x01,
3464
-	0xb3, 0x8a, 0xe3, 0x29, 0xfe, 0x77, 0xc2, 0x2b, 0x60, 0x1c, 0x4c, 0x51, 0xd1, 0x4d, 0x21, 0x8f,
3465
-	0xdf, 0x96, 0x65, 0xa9, 0x6f, 0x33, 0xc4, 0xd0, 0x02, 0x06, 0x3b, 0x17, 0x2f, 0x76, 0x6f, 0xfc,
3466
-	0x89, 0xcf, 0xbf, 0x2f, 0x76, 0x6b, 0x3f, 0xbd, 0xdc, 0xad, 0x5d, 0xe0, 0xf3, 0x07, 0x3e, 0x7f,
3467
-	0xe1, 0x73, 0xd2, 0x70, 0xff, 0x20, 0x3f, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x76, 0xa2, 0xea,
3468
-	0x9b, 0xb1, 0x0a, 0x00, 0x00,
3412
+	0xa3, 0x35, 0xd9, 0x9d, 0x86, 0xc5, 0xf6, 0xee, 0x6a, 0x66, 0xe2, 0x2a, 0x37, 0xc4, 0x07, 0x40,
3413
+	0xe2, 0x0b, 0xf0, 0x55, 0xb8, 0x46, 0x9c, 0x38, 0x72, 0xaa, 0x68, 0x6f, 0x9c, 0xe0, 0x23, 0xf0,
3414
+	0x66, 0xf6, 0xad, 0xbd, 0x95, 0xd7, 0x51, 0x2b, 0xa1, 0x1c, 0x56, 0x9e, 0x3f, 0xbf, 0xdf, 0x6f,
3415
+	0xde, 0x7b, 0xf3, 0xde, 0x1b, 0xc3, 0x66, 0x7a, 0xf2, 0x83, 0x0c, 0x8d, 0xee, 0x65, 0x2a, 0x35,
3416
+	0x29, 0x63, 0x51, 0x1a, 0x4e, 0xa4, 0xea, 0xe9, 0x27, 0x42, 0xcd, 0x26, 0xb1, 0xe9, 0xcd, 0xdf,
3417
+	0xdf, 0xee, 0x98, 0xf3, 0x4c, 0x12, 0x60, 0xbb, 0xa3, 0x33, 0x19, 0x16, 0x93, 0x5b, 0x26, 0x9e,
3418
+	0x49, 0x6d, 0xc4, 0x2c, 0xbb, 0xbb, 0x18, 0xd1, 0xd6, 0x8d, 0xd3, 0xf4, 0x34, 0x75, 0xc3, 0xbb,
3419
+	0x76, 0x94, 0xaf, 0x76, 0x7f, 0xab, 0x81, 0x77, 0x28, 0x8d, 0x60, 0x9f, 0x42, 0x6b, 0x2e, 0x95,
3420
+	0x8e, 0xd3, 0x24, 0xa8, 0xdd, 0xae, 0xbd, 0xdb, 0xb9, 0xf7, 0x46, 0x6f, 0xf5, 0xe4, 0xde, 0x71,
3421
+	0x0e, 0x19, 0x78, 0x17, 0x4f, 0xf7, 0xae, 0xf1, 0x82, 0xc1, 0x3e, 0x03, 0x08, 0x95, 0x14, 0x46,
3422
+	0x46, 0x63, 0x61, 0x82, 0xba, 0xe3, 0xbf, 0x59, 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0x97, 0x0b, 0x2c, 0x80, 0x96, 0x98, 0xc6, 0xc2, 0xee, 0x35, 0xdc, 0x5e, 0x31, 0xed, 0xfe,
3456
+	0x5c, 0x87, 0x16, 0x89, 0x5d, 0x75, 0x1b, 0xa4, 0x63, 0x57, 0xca, 0xe3, 0x01, 0x6c, 0x44, 0x2a,
3457
+	0x9e, 0xd3, 0x93, 0x23, 0xa9, 0x15, 0x6e, 0x57, 0x49, 0xec, 0x3b, 0x1c, 0x3e, 0x78, 0xee, 0x37,
3458
+	0xbf, 0xd3, 0x07, 0xe0, 0xc5, 0x99, 0x98, 0xd1, 0x73, 0x57, 0x79, 0xf2, 0xe8, 0xa8, 0x7f, 0xf8,
3459
+	0x6d, 0x96, 0xa7, 0x67, 0x1b, 0x1d, 0xf5, 0xec, 0x02, 0x77, 0xb4, 0xee, 0x3f, 0x18, 0x90, 0xe1,
3460
+	0xf4, 0x4c, 0x1b, 0xa9, 0xae, 0x3a, 0x20, 0x74, 0xec, 0x4a, 0x40, 0x86, 0xd0, 0x52, 0x69, 0x6a,
3461
+	0xc6, 0xa1, 0xb8, 0x2c, 0x16, 0x1c, 0x21, 0xc3, 0xfe, 0x60, 0xcb, 0x12, 0x6d, 0x37, 0xc8, 0xe7,
3462
+	0xbc, 0x69, 0xa9, 0x43, 0x81, 0x9d, 0xfa, 0x66, 0xd1, 0x43, 0x4f, 0x70, 0x45, 0x1b, 0x25, 0xb2,
3463
+	0xf1, 0x44, 0x9e, 0xdb, 0xff, 0x05, 0x8d, 0x75, 0x2f, 0xfa, 0x41, 0x12, 0xaa, 0x73, 0x17, 0xa8,
3464
+	0xaf, 0xe4, 0x39, 0xbf, 0x41, 0x02, 0x83, 0x82, 0x8f, 0x8b, 0x9a, 0x7d, 0x0e, 0x3b, 0x72, 0x01,
3465
+	0xb3, 0x8a, 0xe3, 0x29, 0xfe, 0xad, 0xc2, 0xd7, 0x61, 0x1c, 0x4e, 0x51, 0xd1, 0x35, 0x28, 0x8f,
3466
+	0xdf, 0x92, 0x65, 0xa9, 0xaf, 0x73, 0xc4, 0xd0, 0x02, 0x06, 0x3b, 0x17, 0xcf, 0x76, 0xaf, 0xfd,
3467
+	0x89, 0xdf, 0xbf, 0xcf, 0x76, 0x6b, 0x3f, 0x3e, 0xdf, 0xad, 0x5d, 0xe0, 0xf7, 0x07, 0x7e, 0x7f,
3468
+	0xe1, 0x77, 0xd2, 0x74, 0x7f, 0x2e, 0x3f, 0xf8, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x55, 0xec,
3469
+	0x86, 0xcc, 0x0a, 0x00, 0x00,
3469 3470
 }
... ...
@@ -168,6 +168,9 @@ message NetworkAttachment {
168 168
 	// List of IPv4/IPv6 addresses that are assigned to the object
169 169
 	// as part of getting attached to this network.
170 170
 	repeated string addresses = 2;
171
+
172
+	// List of aliases by which a task is resolved in a network
173
+	repeated string aliases = 3;
171 174
 }
172 175
 
173 176
 message Network {
... ...
@@ -442,7 +442,11 @@ func (a *Allocator) taskCreateNetworkAttachments(t *api.Task, s *api.Service) {
442 442
 		for _, na := range s.Spec.Networks {
443 443
 			n := store.GetNetwork(tx, na.Target)
444 444
 			if n != nil {
445
-				networks = append(networks, &api.NetworkAttachment{Network: n})
445
+				var aliases []string
446
+				for _, a := range na.Aliases {
447
+					aliases = append(aliases, a)
448
+				}
449
+				networks = append(networks, &api.NetworkAttachment{Network: n, Aliases: aliases})
446 450
 			}
447 451
 		}
448 452
 	})