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

feat: support falling back to docker inspect data for gleaning mgmt bridge gw address #1482

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

carlmontanari
Copy link
Contributor

title!

similar issue reported in discord here a while back.

tl;dr -- that commit we snag the bridge address so ceos (or presumably others) can set gateway, buuuuuut if you are docker in docker (like me and my little weird launcher tool so i can run this on my mac) then the bridge is not mounted in the "launcher" container so trying to get that bridges address fails.

we already have the output of docker inspect network from earlier on in this func, so this just falls back to attempting to iterate over the ipam section to set v4/v6 addresses. if we still dont get any we just return the original error.

tested this in my dind setup (basically mount docker sock to debian container and launch clab from there but all in docker desktop on Mac) and it worked nicely whereas before it was bombing out due to the error returned from FirstLinkIPs.

lemme know if this makes sense or any changes are needed!

@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #1482 (528ece2) into main (54295f7) will decrease coverage by 0.07%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1482      +/-   ##
==========================================
- Coverage   21.83%   21.77%   -0.07%     
==========================================
  Files          65       65              
  Lines        6809     6830      +21     
==========================================
  Hits         1487     1487              
- Misses       5191     5212      +21     
  Partials      131      131              
Files Changed Coverage Δ
runtime/docker/docker.go 0.13% <0.00%> (-0.01%) ⬇️

@@ -256,7 +256,33 @@ func (d *DockerRuntime) CreateNet(ctx context.Context) (err error) {
// this was added to allow mgmt network gw ip to be available in a startup config templation step (ceos)
var v4, v6 string
if v4, v6, err = utils.FirstLinkIPs(bridgeName); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlmontanari was it painful to look at that err handling line? :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol yes! im too dumb to see it all on the one line!!!!

@hellt hellt merged commit d7e4356 into srl-labs:main Jul 25, 2023
18 of 19 checks passed
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

2 participants