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

client: expose network namespace CNI config as task env vars. #11810

Merged
merged 3 commits into from
May 14, 2024

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented Jan 10, 2022

I forgot I had this stashed locally. Raising it initially as a draft PR
to get early feedback and will modify and add docs etc at a later
date.

This change exposes CNI configuration details of a network
namespace as environment variables. This allows a task to use
these value to configure itself; a potential use case is to run
a Raft application binding to IP and Port details configured using
the bridge network mode.

@jrasell jrasell requested review from lgfa29 and tgross January 10, 2022 16:07
@jrasell jrasell self-assigned this Jan 10, 2022
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

The approach here seems technically sound. We have an existing set of NOMAD_IP, etc. variables described in the network docs... how do we envision these interacting?

client/taskenv/env.go Outdated Show resolved Hide resolved
@jrasell
Copy link
Member Author

jrasell commented Jan 11, 2022

The approach here seems technically sound. We have an existing set of NOMAD_IP, etc. variables described in the network docs... how do we envision these interacting?

iirc these represent the host assignments when running in network.mode = "host". When I have a moment, I'll double check this.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

@sundbry
Copy link
Contributor

sundbry commented May 11, 2024

I've just tested this in a CNI network using calico. It works great and saved a bunch of hassle modding container images to autodetect their IP. Thanks @jrasell.

Copy link

Ember Test Audit comparison

main f86622858b9a03a6bc09f6373b2adad1ba5a4536 change
passes 1559 1559 0
failures 0 0 0
flaky 0 0 0
duration 11m 28s 765ms 11m 32s 527ms +03s 762ms

This change exposes CNI configuration details of a network
namespace as environment variables. This allows a task to use
these value to configure itself; a potential use case is to run
a Raft application binding to IP and Port details configured using
the bridge network mode.
@jrasell jrasell requested review from shoenig and angrycub and removed request for lgfa29 May 13, 2024 11:35
@jrasell jrasell marked this pull request as ready for review May 13, 2024 11:39
@jrasell jrasell requested a review from tgross May 13, 2024 11:39
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

@jrasell jrasell merged commit 04ba358 into main May 14, 2024
21 checks passed
@jrasell jrasell deleted the f-alloc-network-namespace-env-vars branch May 14, 2024 08:02
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.

4 participants