hudl / fargo

Golang client for Netflix Eureka
MIT License
133 stars 53 forks source link

Preserve whether each of an instance's two ports is enabled #58

Closed seh closed 7 years ago

seh commented 7 years ago

When Eureka either accepts an instance registration or offers an instance record back from a query by instance ID, application, or VIP address, the per-instance data structure exchanged describes two ports—the unadorned insecure port, and a secure port—both of which can be either enabled or disabled. The insecure port is enabled by default; the secure port is disabled by default.

At present, fargo can parse the "enabled" field of the composite "port" value in the JSON representation, but it discards the value immediately afterward (see fargo.Instance.UnmarshalJSON). In the XML representation, the "port" element has an "enabled" attribute that fargo ignores completely. The consequence is twofold:

Not all Eureka clients pay attention to this information, but today I confirmed that Ribbon does. I've seen a few other clients that also check whether the secure port is enabled (apparently not caring whether the insecure port is disabled).

Given that fargo already defines the fargo.Instance.PortJ and fargo.Instance.SecurePortJ fields, I'd like to see if we can augment the marshaling procedures to preserve the port's enabled/disabled status round-trip through both the XML and JSON representations. Doing so would be mostly backward compatible, though registrants that were setting the fargo.Instance.PortJ.Enabled and fargo.Instance.SecurePortJ.Enabled field values to false or true respectively would find those values now being sent to the server—likely as originally intended.

seh commented 7 years ago

Though the capability still isn't included in a released version, #59 satisfies the original request.