[25.0 backport] Remove generated MAC addresses on restart. #47171
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.
Since #45905 - the MAC address of a running container is stored in the same place as the configured address for a container.
So, when starting a stopped container, a generated address was treated as a configured address. If that generated address (based on an IPAM-assigned IP address) had been reused, the containers ended up with duplicate MAC addresses.
- How I did it
Remember whether the MAC address was explicitly configured, and clear it if not.
A similar approach is used for IPAM data (flag
IPAMOperational
). The plan is to refactor, to separate configured and operational state.- How to verify it
New integration test.
- Description for the changelog
Ensure that a MAC address based on a container's IP address is re-generated when the container is stopped and restarted, in case the generated IP/MAC addresses have been reused.
- A picture of a cute animal (not mandatory but encouraged)