-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix the inconsistency handling between infra image and normal task image #9580
fix the inconsistency handling between infra image and normal task image #9580
Conversation
ba95a8f
to
ee8b742
Compare
drivers/docker/config.go
Outdated
// Remove any http | ||
if strings.HasPrefix(d.config.InfraImage, "https://") { | ||
d.config.InfraImage = strings.Replace(d.config.InfraImage, "https://", "", 1) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We perform this operation on the main image just before starting the task. It feels like it'd make sense to either:
- Do this in
driver/docker/network.go
where we pull the infra image. - Do both the main image and infra image in this spot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nomad/drivers/docker/network.go
Line 22 in a40a140
repo, _ := parseDockerImage(d.config.InfraImage) |
I actually tried to put it in
network.go
at beginning haha. But quite some places read *d.config.InfraImage directly
, so if I want those methods to take the change, I need to mutate global struct state. If I mutate the global state, if doesn't feel right to do it every time before pull infra. So I put it here.
@tgross could you help to put it where you think fits most? It's a minor inconsistency, which was causing some confusion to us, but def not a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I mutate the global state, if doesn't feel right to do it every time before pull infra.
Yeah, I'm inclined to agree with you there. I know we had a couple PRs recently around the infrastructure images, so I want to make sure I get the opinion of folks who worked on that. @shoenig what do you think about moving the http://
stripping for the infra images here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. I do feel that both code blocks should be using https://golang.org/pkg/strings/#TrimPrefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. @fredwangwang sorry about the delay in getting back on this but do you think you can make that change? If not, happy to carry this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go for it @tgross, and thanks for getting back to this issue!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that those two sections of code didn't both have access to the same variables, so it doesn't make sense to handle them in the same place after all. I've made @shoenig's suggestion to use TrimPrefix
, rebased this PR on master, and added a changelog entry.
ee8b742
to
0434b9e
Compare
Bah, I meant to squash that. But this is merged and will ship in the next normal patch release. |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
fix a minor inconsistency in how nomad handles image url for task and infra.
basically a duplication of
nomad/drivers/docker/driver.go
Lines 253 to 256 in 2176fbd