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

Backport of cni: ensure to setup CNI addresses in deterministic order into release/1.5.x #17827

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #17766 to be assessed for backporting due to the inclusion of the label backport/1.5.x.

WARNING automatic cherry-pick of commits failed. Commits will require human attention.

The below text is copied from the body of the original PR.


Currently as commented in the code the go-cni library returns an unordered map
of interfaces. In cases where there are multiple CNI interfaces being created this
creates a problem with service registration and healthchecking because the first
address in the map is being used.

The use case we have where this is an issue is that we run CNI with the macvlan
plugin to isolate workloads, but they still need to be able to access the host on
a static address to be able to perform local resolving and hit host services like
the Consul agent API. To make this work there are 2 options, you either add a
macvlan interface on the host with an assigned address for each VLAN you have or
you create an additional veth bridged interface in the container namespace.
We chose the latter option through a custom CNI plugin but the ordering issue
leaves us with incorrect service registration.

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/cni-ordered-interfaces/rightly-exotic-maggot branch 2 times, most recently from d8fdc48 to eaec4e5 Compare July 6, 2023 20:26
@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/cni-ordered-interfaces/rightly-exotic-maggot branch from eaec4e5 to d8fdc48 Compare July 6, 2023 20:26
@vercel vercel bot temporarily deployed to Preview – nomad July 6, 2023 20:31 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad-storybook-and-ui July 6, 2023 20:35 Inactive
* cni: ensure to setup CNI addresses in deterministic order

  Currently as commented in the code the go-cni library returns an unordered map
  of interfaces. In cases where there are multiple CNI interfaces being created this
  creates a problem with service registration and healthchecking because the first
  address in the map is being used.

  The use case we have where this is an issue is that we run CNI with the macvlan
  plugin to isolate workloads, but they still need to be able to access the host on
  a static address to be able to perform local resolving and hit host services like
  the Consul agent API. To make this work there are 2 options, you either add a
  macvlan interface on the host with an assigned address for each VLAN you have or
  you create an additional veth bridged interface in the container namespace.
  We chose the latter option through a custom CNI plugin but the ordering issue
  leaves us with incorrect service registration.

* Updates after feedback

 * First check for the CNIResult interfaces length, if it's zero we don't need to proceed
   at all.
 * Use sorted interfaces list for the address fallback scenario as well.
 * Remove "found" log message logic, when an address isn't found an error is returned stating
   the allocation could not be configured as an address was missing from the CNIResult. If we
   still need a Warn message then we can add it to the condition that returns the error if no
   address could be found instead of using the "found" bool logic.
@schmichael schmichael force-pushed the backport/cni-ordered-interfaces/rightly-exotic-maggot branch from d8fdc48 to dff6b68 Compare July 7, 2023 22:09
@schmichael schmichael merged commit 548f5cc into release/1.5.x Jul 8, 2023
21 checks passed
@schmichael schmichael deleted the backport/cni-ordered-interfaces/rightly-exotic-maggot branch July 8, 2023 00:09
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.

None yet

3 participants