File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,11 +200,24 @@ func (ep *Endpoint) UnmarshalJSON(b []byte) (err error) {
200200 json .Unmarshal (ma , & myAliases ) //nolint:errcheck
201201 ep .myAliases = myAliases
202202
203+ _ , hasDNSNames := epMap ["dnsNames" ]
203204 dn , _ := json .Marshal (epMap ["dnsNames" ])
204205 var dnsNames []string
205206 json .Unmarshal (dn , & dnsNames )
206207 ep .dnsNames = dnsNames
207208
209+ if ! hasDNSNames {
210+ // The field dnsNames was introduced in v25.0. If we don't have it, the on-disk state was written by an older
211+ // daemon, thus we need to populate dnsNames based off of myAliases and anonymous values.
212+ var name string
213+ if ! ep .anonymous {
214+ name = ep .name
215+ }
216+ // Hostname and id fields are purposefully left empty here as they should have been put into myAliases when the
217+ // endpoint was originally created.
218+ ep .dnsNames = BuildEndpointDNSNames (name , "" , "" , myAliases )
219+ }
220+
208221 return nil
209222}
210223
You can’t perform that action at this time.
0 commit comments