[Fix] Use default gateway, when bridge network doesn't have it (#666, @kuritka) #666
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.
What
If there is no default gateway in the bridge network, k3d crashes because it tries to parse the empty gateway string. This PR will use the default gateway if the gateway does not exist. A cluster can be created than.
Why
For some time docker does not create an automatic gateway in case I create a new network. When I create a bridge network without a gateway and try to connect it to k3d, the cluster installation of the latest versions of k3d crashes.
For example, this won't work for me:
Right now we have to do something like this manually:
^^^ passing
Implications
our k3d action worked fine on k3d v4.4.1, until 28.6.2021, when the GitHub runner upgraded to Ubuntu Version: 20210628.1. This forced us to upgrade k3d-action a bit earlier than we had planned. Unfortunately, we found out that the newer implementation can't handle the missing gateway. This change does not affect the CLI or Docker settings. It only handles internally the case when the gateway is missing in docker network settings.
@all-contributors add @kuritka for code, maintenance
Signed-off-by: kuritka kuritka@gmail.com