Skip to content

feat: add DO_IP_ADDR_FAMILIES env var for node address family control#914

Open
lohitkolluri wants to merge 1 commit into
digitalocean:masterfrom
lohitkolluri:fix/555-do-ip-addr-families
Open

feat: add DO_IP_ADDR_FAMILIES env var for node address family control#914
lohitkolluri wants to merge 1 commit into
digitalocean:masterfrom
lohitkolluri:fix/555-do-ip-addr-families

Conversation

@lohitkolluri

Copy link
Copy Markdown

Summary

Adds the DO_IP_ADDR_FAMILIES environment variable to control which IP address families are included in node status. This addresses the remaining ask from issue #555 — the basic IPv6 support was already merged in #898 but without the opt-in/opt-out mechanism requested by the maintainer.

Changes

  • New env var: DO_IP_ADDR_FAMILIES accepts ipv4, ipv6, or ipv4,ipv6 (comma-separated)
  • Defaults: When unset, all available addresses are included (backward compatible)
  • Refactored: nodeAddresses now dispatches to a family-aware discoverAddress helper
  • Validation: Invalid family values are rejected at startup with a clear error
  • Tests: 7 new test cases covering all family combinations
  • Docs: Updated both README.md and node examples README

Root Cause

The stale PR #561 implemented the env var approach but was never merged. Since then, basic IPv6 support was merged unconditionally in PR #898. This PR adds the env var gating on top of the current codebase, allowing operators to restrict to specific families.

Testing

  • make ci passes (go vet, gofmt, unit tests)
  • All existing tests pass unchanged — backward compatible by default
  • New tests verify: default (no env), ipv4-only, ipv6-only, dual-stack, and invalid values

Risks

  • Low — default behavior is identical to current (all families included)
  • Setting DO_IP_ADDR_FAMILIES=ipv4 restricts to IPv4 only, which is the key new capability for dual-stack clusters that need to opt out of IPv6 node addresses

Closes #555
Signed-off-by: Lohit Kolluri lohitkolluri@gmail.com

Add DO_IP_ADDR_FAMILIES environment variable to allow operators to
control which IP address families are included in node status.

- Introduces DO_IP_ADDR_FAMILIES env var (values: ipv4, ipv6, ipv4,ipv6)
- Backward compatible: default includes all available addresses
- Refactors nodeAddresses into family-aware discoverAddress helper
- Adds comprehensive tests for all family configurations
- Updates README and node docs with configuration reference

Closes digitalocean#555
Signed-off-by: Lohit Kolluri <lohitkolluri@gmail.com>
@lohitkolluri

Copy link
Copy Markdown
Author

Hello team just following up on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPv6 address missing in nodes status

1 participant