Skip to content

feat: add Kubernetes DNS support and unify example setup scripts#21

Merged
miguelgila merged 2 commits intomainfrom
dns-kubernetes
Feb 26, 2026
Merged

feat: add Kubernetes DNS support and unify example setup scripts#21
miguelgila merged 2 commits intomainfrom
dns-kubernetes

Conversation

@miguelgila
Copy link
Owner

@miguelgila miguelgila commented Feb 25, 2026

Summary

  • Kubernetes DNS resolution for Reaper pods: New REAPER_DNS_MODE env var (kubernetes/k8s) writes the kubelet-prepared resolv.conf into the overlay namespace, enabling Reaper workloads to resolve Kubernetes service names (e.g., my-svc.default.svc.cluster.local) via CoreDNS
  • Unified example setup scripts: All 8 example setup.sh scripts now default to downloading published release binaries, with a --build flag for source compilation. Added --help/-h to all scripts.
  • Example 08 updated: Replaced hardcoded clusterIP: 10.96.100.100 with DNS-based service discovery, demonstrating the new DNS feature

Changes

Core (overlay.rs, main.rs)

  • DnsMode enum + read_dns_config() reads REAPER_DNS_MODE env var
  • apply_kubernetes_dns() finds /etc/resolv.conf OCI mount, reads content via /proc/1/root/<source>, writes it into the overlay
  • Called from do_start() after volume mounts, before workload spawn
  • DNS failure is fatal when explicitly opted-in (misconfiguration should not silently fall back)

Ansible (install-reaper.yml)

  • Adds REAPER_DNS_MODE=kubernetes to /etc/default/containerd (default for Ansible-deployed clusters)

Integration tests

  • New test_kubernetes_dns_resolution() verifying Reaper pods can resolve kubernetes.default.svc.cluster.local and a custom ClusterIP service

Examples (01-08)

  • All setup.sh scripts: added --help, --build, release version resolution via scripts/lib/release-utils.sh
  • Example 08: DNS-based LDAP service discovery instead of hardcoded ClusterIP

Test plan

  • cargo test — unit tests pass (DNS config parsing)
  • cargo clippy --target x86_64-unknown-linux-gnu --all-targets — clean
  • bash -n syntax check on all 8 setup.sh scripts
  • ./scripts/run-integration-tests.sh — full suite including new test_kubernetes_dns_resolution
  • Manual: run example 08 with --build flag, verify getent passwd user1 resolves via DNS

🤖 Generated with Claude Code

miguelgila and others added 2 commits February 25, 2026 21:54
Add list marker prefix (- ) to checkbox items so GitHub renders
them as task list checkboxes. Fix typo "ot" → "to".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add REAPER_DNS_MODE env var that, when set to "kubernetes", reads the
kubelet-prepared resolv.conf and writes it into the overlay — enabling
Kubernetes service DNS resolution for Reaper workloads.

- Add DnsMode enum, read_dns_config(), apply_kubernetes_dns() to overlay.rs
- Call apply_kubernetes_dns() from do_start() daemon path (fatal on failure)
- Set REAPER_DNS_MODE=kubernetes in Ansible install playbook
- Add test_kubernetes_dns_resolution() integration test
- Replace hardcoded ClusterIP in example 08 with DNS names
- Unify all example setup.sh: default to published releases, --build for source
- Add --help/-h to all example setup.sh scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.44%. Comparing base (eaa34f4) to head (7b6c75e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   86.20%   86.44%   +0.23%     
==========================================
  Files           4        4              
  Lines         174      177       +3     
==========================================
+ Hits          150      153       +3     
  Misses         24       24              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@miguelgila miguelgila merged commit 3b4b5ff into main Feb 26, 2026
10 checks passed
@miguelgila miguelgila deleted the dns-kubernetes branch February 26, 2026 19:31
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.

1 participant