Fix: extra-dns-labels not being applied to pods #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: NetBird extra-dns-labels not being applied to pods
Problem
The
netbird.io/extra-dns-labelsannotation was not working when applied to pods. Despite the webhook detecting the annotation and adding it to the NetBird container configuration, the extra DNS labels were not appearing in the NetBird UI or being applied to registered peers.Root Cause
The pod webhook had two issues:
Invalid setup key argument: The webhook was passing
--setup-key-file /etc/nbkeyto the NetBird client, but this file path was never created. The setup key was already being passed via theNB_SETUP_KEYenvironment variable, making the file-based approach unnecessary and causing confusion in the client startup.NetBird CLI flag bug: The webhook was using the
--extra-dns-labelscommand line flag, but NetBird has a known issue (netbirdio/netbird#4282) where this flag is not properly processed. The workaround is to use theNB_EXTRA_DNS_LABELSenvironment variable instead.Solution
--setup-key-fileargument entirely since the setup key is provided via environment variableNB_EXTRA_DNS_LABELSenvironment variable when thenetbird.io/extra-dns-labelsannotation is presentChanges
Before:
After:
Testing
netbird.io/setup-keyandnetbird.io/extra-dns-labelsannotations:Check the NetBird UI to confirm the extra DNS labels appear on the registered peer
Verify the NetBird container logs show successful registration without errors
References
This fix ensures that the
netbird.io/extra-dns-labelsannotation works as documented and provides a more robust configuration method by using environment variables consistently across all NetBird deployments in the operator.