Skip to content

feat(self-host): expose dnsConfig/dnsPolicy on component pods#541

Open
fer wants to merge 1 commit into
bitwarden:mainfrom
bitwarden-labs:feat/self-host-expose-dnsconfig
Open

feat(self-host): expose dnsConfig/dnsPolicy on component pods#541
fer wants to merge 1 commit into
bitwarden:mainfrom
bitwarden-labs:feat/self-host-expose-dnsconfig

Conversation

@fer

@fer fer commented Jun 15, 2026

Copy link
Copy Markdown

Problem

On clusters where the kubelet injects the default options ndots:5 and the pod inherits corporate DNS search domains, automatic licensing/billing sync fails. The 2-dot cloud endpoints (identity.bitwarden.eu, api.bitwarden.eu, selfhost.bitwarden.com) get search-expanded first; when the corporate resolver returns SERVFAIL for the bogus expanded name (e.g. identity.bitwarden.eu.corp.example), the Alpine/musl getaddrinfo in our images aborts the entire lookup and never tries the real name. .NET surfaces it as SocketException 0xFFFDFFFF "Name does not resolve"; nslookup/curl use a different resolver path and succeed, which makes it hard to diagnose. glibc does not abort on SERVFAIL during search — this is musl-specific and by design.

Why a chart change

The fix is a standard Pod dnsConfig (options: ndots:2), but the chart exposes no dnsConfig/dnsPolicy field. The only workaround is an out-of-band kubectl patch, which helm upgrade overwrites.

Change

Adds general.dnsPolicy / general.dnsConfig with per-component overrides under component.<name>, rendered into each component Deployment's pod spec — same override pattern as nodeSelector/tolerations. Includes values.schema.json entries and bumps the chart 2.0.1 -> 2.1.0 (appVersion unchanged).

Result:

general:
  dnsConfig:
    options:
      - name: ndots
        value: "2"

Upgrade-safe, supported value instead of a manual patch.

Test plan

  • helm template with and without general.dnsConfig → block present/absent in each Deployment.
  • Per-component override beats general.
  • helm lint passes with the schema entries (validated).
  • Repro: cluster with ndots:5 + a search domain whose resolver SERVFAILs the expanded name → getent hosts identity.bitwarden.eu empty before, resolves after setting ndots:2.

Root-cause references

  • musl src/network/lookup_name.cname_from_dns returns EAI_AGAIN on SERVFAIL (rcode 2), 0 on NXDOMAIN (rcode 3); name_from_dns_search aborts on the non-zero return.
  • dotnet/runtime src/native/libs/System.Native/pal_networking.cSystemNative_GetHostEntryForName calls libc getaddrinfo directly.
  • Kubernetes DNS docs — options ndots:5 default; dnsConfig.options "merged to the options generated from the specified DNS policy. Duplicate entries are removed."

@fer
fer requested a review from a team as a code owner June 15, 2026 13:08
@fer
fer requested review from keithhubner and removed request for a team June 15, 2026 13:08
@bitwarden-bot

Copy link
Copy Markdown

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-39061
Link: https://bitwarden.atlassian.net/browse/PM-39061

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@sonarqubecloud

Copy link
Copy Markdown

@keithhubner keithhubner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

branch now out of date and failed tests, please update branch.

@mimartin12 mimartin12 added the ai-review Request a Claude code review label Jun 17, 2026
Comment thread charts/self-host/Chart.yaml
@fer
fer force-pushed the feat/self-host-expose-dnsconfig branch from dd467d7 to b8715d6 Compare July 2, 2026 15:44
Adds general.dnsConfig/dnsPolicy (with per-component overrides) rendered into
each component Deployment pod spec, same pattern as nodeSelector/tolerations.
Lets self-host clusters override pod DNS (e.g. ndots:2) so deployments with the
kubelet default ndots:5 plus corporate search domains that return SERVFAIL can
resolve cloud endpoints (identity/api.bitwarden.eu) for license/billing sync.
The Alpine/musl getaddrinfo aborts the search on SERVFAIL where glibc would not.

Includes generated values.schema.json and bumps chart 2.0.2 -> 2.1.0.
@fer
fer force-pushed the feat/self-host-expose-dnsconfig branch from b8715d6 to f2f1168 Compare July 2, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants