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

allow configuration of Docker hostnames in bridge mode #11173

Merged
merged 8 commits into from
Sep 16, 2021
Merged

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented Sep 13, 2021

Allow configuration of Docker hostnames when running in bridged networking mode along with the ability to interpolate this field. In order to expose this configuration, a new job specification parameter within the network block has been created as is named "hostname". This change currently only affects the Docker driver; other drivers which use the default Linux network manager will be enhanced in the near future to ensure feature parity between drivers.

closes #11023

In order to have a hostname passed as a configuration param when
creating an allocation network, the CreateNetwork func of the
DriverNetworkManager interface needs to be updated. In order to
minimize the disruption of future changes, rather than add another
string func arg, the function now accepts a request struct. The
struct has the hostname as a field.
The in-tree implementations of DriverNetworkManager.CreateNetwork
have been modified to account for the function signature change.
In updating for the change, the enhancement of adding hostnames to
network namespaces has also been added to the Docker driver, whilst
the default Linux manager does not current impelement it.

The allocrunner includes additional validation of the new parameter
to ensure it is used in the correct situations.
Add a new hostname string parameter to the network block which
allows operators to specify the hostname of the network namespace.

Changing this causes a destructive update to the allocation and it
is omitted if empty from API responses.
@jrasell jrasell self-assigned this Sep 13, 2021
@jrasell jrasell added this to the 1.1.5 milestone Sep 13, 2021
client/allocrunner/network_hook.go Outdated Show resolved Hide resolved
client/allocrunner/network_manager_linux.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
nomad/structs/structs.go Show resolved Hide resolved
plugins/drivers/driver.go Outdated Show resolved Hide resolved
@jrasell jrasell marked this pull request as ready for review September 15, 2021 06:07
jrasell added a commit that referenced this pull request Sep 15, 2021
@jrasell jrasell merged commit e34fa58 into main Sep 16, 2021
@jrasell jrasell deleted the f-gh-11023 branch September 16, 2021 06:13
jrasell added a commit that referenced this pull request Sep 16, 2021
docs: add changelog and website entry for #11173
schmichael pushed a commit that referenced this pull request Sep 20, 2021
Add a new hostname string parameter to the network block which
allows operators to specify the hostname of the network namespace.
Changing this causes a destructive update to the allocation and it
is omitted if empty from API responses. This parameter also supports
interpolation.

In order to have a hostname passed as a configuration param when
creating an allocation network, the CreateNetwork func of the
DriverNetworkManager interface needs to be updated. In order to
minimize the disruption of future changes, rather than add another
string func arg, the function now accepts a request struct along with
the allocID param. The struct has the hostname as a field.

The in-tree implementations of DriverNetworkManager.CreateNetwork
have been modified to account for the function signature change.
In updating for the change, the enhancement of adding hostnames to
network namespaces has also been added to the Docker driver, whilst
the default Linux manager does not current implement it.
schmichael pushed a commit that referenced this pull request Sep 20, 2021
docs: add changelog and website entry for #11173
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

network: allow customisation of namespace hostname when using bridged networking
3 participants