Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Runner DNS resolution #566

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Fix Runner DNS resolution #566

merged 1 commit into from
Apr 3, 2024

Conversation

mpass99
Copy link
Contributor

@mpass99 mpass99 commented Mar 28, 2024

Closes #490

The failing DNS resolution was caused by Nomad overwriting the DNS configuration of Docker and the CNI secure bridge. To set valid Nameservers, we have to configure the according Nomad options.

@mpass99 mpass99 self-assigned this Mar 28, 2024
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.12%. Comparing base (39d25d2) to head (27200e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #566      +/-   ##
==========================================
- Coverage   77.13%   77.12%   -0.02%     
==========================================
  Files          41       41              
  Lines        3490     3488       -2     
==========================================
- Hits         2692     2690       -2     
  Misses        586      586              
  Partials      212      212              

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

@mpass99 mpass99 requested a review from MrSerth March 28, 2024 13:32
@mpass99 mpass99 marked this pull request as ready for review March 28, 2024 13:32
@mpass99 mpass99 force-pushed the fix/#490-secure-bridge branch from 1319b8e to af7c57f Compare April 1, 2024 15:32
Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

Many thanks for working on this fix!

To be honest, I have mixed feelings about this PR and the changes. At first, I was very surprised by the approach to fix the secure bridge: I thought (and confirmed) that a fix is also possible by just changing the secure-bridge.conflist. The required changes are shown in the details.

Details

"type": "bridge",
"bridge":"nomad-filtered",
// More options as usual...
"dns":{
    "nameservers":[
        "8.8.8.8",
        "8.8.4.4",
        "2001:4860:4860::8888",
        "2001:4860:4860::8844",
    ],
    "domain": "poseidon.internal", // Probably, can be omitted. It didn't have any effect
    "search": [
        "poseidon.internal"
    ]
}             

Can you please elaborate why you decided to use this mechanism or where you see the advantages / disadvantages?

I think, having everything in the secure-bridge.conflist might be beneficial to have everything in one place (Routing + DNS). Nevertheless, with the config option on Poseidon, we also get some further flexibility.


On a second thought and playing around with this PR, I got more in favour of your changes. I clearly see the benefits to extract the network config to settings, especially on my local machine (finally allowing me to tweak the nomad.network.mode setting, so that I can use another value and get network-enabled instances. And it works even without the CNI plugins, which is also great.

Maybe do both (this PR and the secure-bridge.conflist)? Or is that bad, since we would need to update something in two locations?

configuration.example.yaml Show resolved Hide resolved
@mpass99
Copy link
Contributor Author

mpass99 commented Apr 2, 2024

Can you please elaborate why you decided to use this mechanism

Thanks for bringing that up! After double-checking, it seems the main reason was a deployment issue.
I deployed a similar DNS configuration in the secure-bridge.conflist, but it didn't apply. Then I found the Nomad documentation defining exactly the observed behavior: "By default all task drivers will inherit DNS configuration from the client host. [...] if you are using a mode="cni/*, these values will override any DNS configuration the CNI plugins return". Therefore, the case was clear to me.

At this point, having both options available again, I would put the DNS configuration back to our Deployment repository underlining your argument that we have all the other Routing and DNS configurations also there.

Maybe do both (this PR and the secure-bridge.conflist)? Or is that bad, since we would need to update something in two locations?

Let's use the secure-bridge.conflist to configure the DNS. If you like this "feature" we might keep it but only configure nomad.network.mode in our deployment configuration, so we use the DNS options defined in the secure-bridge.conflist.

@MrSerth
Copy link
Member

MrSerth commented Apr 2, 2024

Alright, I agree with your proposal. And yes, I would actually like to continue having this feature, since it allows me to run the network part on my operating system, too :)

@mpass99 mpass99 force-pushed the fix/#490-secure-bridge branch from af7c57f to f1a19d9 Compare April 2, 2024 15:30
MrSerth
MrSerth previously approved these changes Apr 2, 2024
by adding public nameservers to the CNI secure bridge configuration.
@mpass99 mpass99 force-pushed the fix/#490-secure-bridge branch from cf14e49 to 27200e3 Compare April 2, 2024 15:55
Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

These code changes work like a charm, just tested these locally ✅

@mpass99 mpass99 merged commit 9deee18 into main Apr 3, 2024
12 checks passed
@mpass99 mpass99 deleted the fix/#490-secure-bridge branch April 3, 2024 08:14
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.

Network access becomes unavailable
2 participants