libnet: remove Endpoint.myAliases
This property is now unused, let's get rid of it. Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
parent
523b907359
commit
7a9b680a9c
4 changed files with 1 additions and 51 deletions
|
@ -652,31 +652,6 @@ func cleanOperationalData(es *network.EndpointSettings) {
|
|||
func (daemon *Daemon) updateNetworkConfig(container *container.Container, n *libnetwork.Network, endpointConfig *networktypes.EndpointSettings, updateSettings bool) error {
|
||||
if containertypes.NetworkMode(n.Name()).IsUserDefined() {
|
||||
endpointConfig.DNSNames = buildEndpointDNSNames(container, endpointConfig.Aliases)
|
||||
|
||||
// TODO(aker): remove this code once endpoint's DNSNames is used for real.
|
||||
addShortID := true
|
||||
shortID := stringid.TruncateID(container.ID)
|
||||
for _, alias := range endpointConfig.Aliases {
|
||||
if alias == shortID {
|
||||
addShortID = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if addShortID {
|
||||
endpointConfig.Aliases = append(endpointConfig.Aliases, shortID)
|
||||
}
|
||||
if container.Name != container.Config.Hostname {
|
||||
addHostname := true
|
||||
for _, alias := range endpointConfig.Aliases {
|
||||
if alias == container.Config.Hostname {
|
||||
addHostname = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if addHostname {
|
||||
endpointConfig.Aliases = append(endpointConfig.Aliases, container.Config.Hostname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := validateEndpointSettings(n, n.Name(), endpointConfig); err != nil {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func TestDNSNamesAreEquivalentToAliases(t *testing.T) {
|
||||
func TestDNSNamesOrder(t *testing.T) {
|
||||
d := &Daemon{}
|
||||
ctr := &container.Container{
|
||||
ID: "35de8003b19e27f636fc6ecbf4d7072558b872a8544f287fd69ad8182ad59023",
|
||||
|
@ -35,7 +35,6 @@ func TestDNSNamesAreEquivalentToAliases(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Check(t, is.DeepEqual(epSettings.Aliases, []string{"myctr", "35de8003b19e", "baz"}))
|
||||
assert.Check(t, is.DeepEqual(epSettings.DNSNames, []string{"foobar", "myctr", "35de8003b19e", "baz"}))
|
||||
}
|
||||
|
||||
|
|
|
@ -818,10 +818,6 @@ func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, e
|
|||
createOptions = append(createOptions, libnetwork.CreateOptionIpam(ip, ip6, ipList, nil))
|
||||
}
|
||||
|
||||
// TODO(aker): remove this loop once endpoint's DNSNames is used for real
|
||||
for _, alias := range epConfig.Aliases {
|
||||
createOptions = append(createOptions, libnetwork.CreateOptionMyAlias(alias))
|
||||
}
|
||||
createOptions = append(createOptions, libnetwork.CreateOptionDNSNames(epConfig.DNSNames))
|
||||
|
||||
for k, v := range epConfig.DriverOpts {
|
||||
|
|
|
@ -41,7 +41,6 @@ type Endpoint struct {
|
|||
prefAddressV6 net.IP
|
||||
ipamOptions map[string]string
|
||||
aliases map[string]string
|
||||
myAliases []string
|
||||
svcID string
|
||||
svcName string
|
||||
virtualIP net.IP
|
||||
|
@ -71,7 +70,6 @@ func (ep *Endpoint) MarshalJSON() ([]byte, error) {
|
|||
epMap["anonymous"] = ep.anonymous
|
||||
epMap["dnsNames"] = ep.dnsNames
|
||||
epMap["disableResolution"] = ep.disableResolution
|
||||
epMap["myAliases"] = ep.myAliases
|
||||
epMap["svcName"] = ep.svcName
|
||||
epMap["svcID"] = ep.svcID
|
||||
epMap["virtualIP"] = ep.virtualIP.String()
|
||||
|
@ -197,7 +195,6 @@ func (ep *Endpoint) UnmarshalJSON(b []byte) (err error) {
|
|||
ma, _ := json.Marshal(epMap["myAliases"])
|
||||
var myAliases []string
|
||||
json.Unmarshal(ma, &myAliases) //nolint:errcheck
|
||||
ep.myAliases = myAliases
|
||||
|
||||
_, hasDNSNames := epMap["dnsNames"]
|
||||
dn, _ := json.Marshal(epMap["dnsNames"])
|
||||
|
@ -262,9 +259,6 @@ func (ep *Endpoint) CopyTo(o datastore.KVObject) error {
|
|||
dstEp.exposedPorts = make([]types.TransportPort, len(ep.exposedPorts))
|
||||
copy(dstEp.exposedPorts, ep.exposedPorts)
|
||||
|
||||
dstEp.myAliases = make([]string, len(ep.myAliases))
|
||||
copy(dstEp.myAliases, ep.myAliases)
|
||||
|
||||
dstEp.dnsNames = make([]string, len(ep.dnsNames))
|
||||
copy(dstEp.dnsNames, ep.dnsNames)
|
||||
|
||||
|
@ -292,13 +286,6 @@ func (ep *Endpoint) Name() string {
|
|||
return ep.name
|
||||
}
|
||||
|
||||
func (ep *Endpoint) MyAliases() []string {
|
||||
ep.mu.Lock()
|
||||
defer ep.mu.Unlock()
|
||||
|
||||
return ep.myAliases
|
||||
}
|
||||
|
||||
// Network returns the name of the network to which this endpoint is attached.
|
||||
func (ep *Endpoint) Network() string {
|
||||
if ep.network == nil {
|
||||
|
@ -1007,13 +994,6 @@ func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig
|
|||
}
|
||||
}
|
||||
|
||||
// CreateOptionMyAlias function returns an option setter for setting endpoint's self alias
|
||||
func CreateOptionMyAlias(alias string) EndpointOption {
|
||||
return func(ep *Endpoint) {
|
||||
ep.myAliases = append(ep.myAliases, alias)
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOptionLoadBalancer function returns an option setter for denoting the endpoint is a load balancer for a network
|
||||
func CreateOptionLoadBalancer() EndpointOption {
|
||||
return func(ep *Endpoint) {
|
||||
|
|
Loading…
Reference in a new issue