Backport of Add support for Nomad transparent proxy into release/1.4.x #3830
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.
Backport
This PR is auto-generated from #3795 to be assessed for backporting due to the inclusion of the label backport/1.4.x.
The below text is copied from the body of the original PR.
Nomad will implement support for Connect transparent proxy. Unlike in K8s, the
CNI plugin can't contact the Nomad API to read allocation metadata (pod labels)
to get the iptables configuration, and doesn't use the rest of the Consul-K8s
control plane to inject that metadata. Instead, Nomad will pass the iptables
configuration JSON-serialized in the CNI arguments.
This changeset implements the behavior switch by detecting the
IPTABLES_CONFIG
argument in the CNI arguments. This hypothetically allows for non-Nomad
workflows to use the same code path, if desired.
Ref: hashicorp/nomad#10628
How I've tested this PR
In addition to new unit tests, I ran a build of Nomad that includes hashicorp/nomad#20183, deployed as in production via
systemd
, along with a Consul agent configured to support DNS. Run the following Nomad job specification:countdash with tproxy
Configure the following service intentions:
Once the job ran, I visited
http://<nomad_ip_address>:9010
in my browser, and saw the countdash page with the green "connected" badge. All services appear healthy in the Consul UI.How I expect reviewers to test this PR
nomad agent -dev -dev-connect
on Linux along with a Consul agent to get a suitable reproduction.Checklist
Overview of commits