← Inside orch contents

Chapter 20 — worked answers

1. One node address is not two sockets

Resolve deduplicates IPv4 strings, so two tasks on one node contribute one answer. Their public ports are not represented in A records. The endpoint API retains task IDs and each published port; a client needs that data or an explicitly known common fixed port/gateway.

2. Separate predicates

includeTask returns false when DesiredStatus is not running, so HTTP discovery excludes the task. DNS Resolve checks only actual running/healthy in its task loop, so an otherwise resolvable node IPv4 may remain. This is a source-derived divergence requiring a matching fixture before being called an observed runtime incident.

3. IPv4 conversion is explicit

Resolve uses net.ParseIP(host).To4. A hostname is not resolved and IPv6-only data has no To4 representation, so it contributes no A answer. HTTP endpoint records can still contain the advertise string because their builder does not perform the same conversion. Different surfaces need not produce equivalent sets.

4. Keep three owners visible

Record endpoint API tasks/versions/ports, DNS answer/TTL/query time and exact application connection destination. Compare a fresh resolver query with the client's cached record and inspect whether the client reused an existing connection. Test the correct recorded host port independently. Do not infer an exact staleness bound from TTL alone, and do not change a production resolver to perform the experiment.

Return to Chapter 20.