-
Notifications
You must be signed in to change notification settings - Fork 52
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
Tweaking SLES Builder #308
Conversation
Signed-off-by: Logan Bond <[email protected]>
Signed-off-by: Logan Bond <[email protected]>
Signed-off-by: Logan Bond <[email protected]>
Signed-off-by: Logan Bond <[email protected]>
pkg/driverbuilder/docker.go
Outdated
// check if on a sles target type, which requires docker to run with `--net=host` for builder images to work | ||
// for more info, see the suse container connect README: https://github.com/SUSE/container-suseconnect | ||
var netMode = container.NetworkMode("default") | ||
if b.TargetType == "sles" { |
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.
I would add a new builders interface (Network mode() string) and only implement in for sles builder instead.
Here we can just check
if vv, ok := v.(NetworkModder); ok {
NetMode = vv.NetworkMode()
}
I think it is more elegant and future proof this way because all the builder knowledge will belong to the builder specific source file.
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.
This makes way more sense 🙂 I just removed the if and set the default network mode to "default"
, but it can be overridden in an individual builder. Then the hostConfig just has:
NetworkMode: container.NetworkMode(b.BuilderImageNetworkMode),
Let me know if you'd like it a different way or want the functions moved around. I put the default function in builders.go
Signed-off-by: Logan Bond <[email protected]>
Signed-off-by: Logan Bond <[email protected]>
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: EXONER4TED, FedeDP The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM label has been added. Git tree hash: 479e5d2529f69acf0de785c262b0494997ef10ba
|
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area pkg
What this PR does / why we need it:
Tweaking the SLES builder to:
sles
actually, when I thought it was justsle
previously):--net=host
on the docker CLI at runtime to properly connect the container to the host for authentication. It's kind of odd, but more info can be found on it here: https://github.com/SUSE/container-suseconnectFor using "pay as you go" images in public clouds for SUSE, the OS will authenticate to SUSE mirrors automatically. Any container on the host will see this authentication as well automatically with the
containerbuild-regionsrv
service. However, for any of that to work, the container must run in host network mode.Which issue(s) this PR fixes:
Fixes # N/A
Special notes for your reviewer:
I'm only halfway certain this will work, so more PR's may be needed after this one if it doesn't work. Currently in a bit of a trial/error on the authentication for SLES, but this change should be harmless since I'm only catching the SLES target type (which doesn't really work anyway currently).
Does this PR introduce a user-facing change?:
Nope