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

Pick default OCI Runtime from containers.conf #2926

Merged
merged 1 commit into from
Jan 22, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jan 21, 2021

Currently we have a weird situation where the user sets the default
runtime in his containers.conf for podman but Buildah is still falling
back to use runc because it was hard coded as the default for Buildah.

I would like to remove this default, but that would theoretically break
the API promise of Buildah.

This should fix containers/podman#8893

Signed-off-by: Daniel J Walsh [email protected]

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?


@rhatdan
Copy link
Member Author

rhatdan commented Jan 21, 2021

@containers/podman-maintainers PTAL

util/types.go Outdated
DefaultRuntime = "runc"
// DefaultRuntime should no longer be used.
// Default runtime should come from containers.conf
DefaultRuntime = "crun"
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be "runc" for now. It's safe for Fedora but who knows in which packages this ends up.

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually think we should remove this altogether or maybe return "". This field should never be used. Basically it would only ever be used if containers/common had a serious issue, where their was a coding mistake in the code, which has already gone through multiple layers of testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

But to get it through, I changed it back. Also fixed the message if containers.conf is screwed up to Warnf level.

util/util.go Outdated
return DefaultRuntime
conf, err := config.Default()
if err != nil {
logrus.Debugf("Error loading container config when searching for local runtime.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logrus.Debugf("Error loading container config when searching for local runtime.")
logrus.Debugf("Error loading container config when searching for local runtime: %v", err)

I wonder whether this error should be fatal. I didn't check the code but I would assume that we don't get an error if the config does not exist ... but if there's some real config/syntax/permission error here, then it would be very hard to figure out.

conf, _ := config.Default()
defaultRuntime := conf.Engine.OCIRuntime
runtime := Runtime()
if runtime != defaultRuntime {
Copy link
Contributor

@eriksjolund eriksjolund Jan 21, 2021

Choose a reason for hiding this comment

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

Maybe this is better?

if runtime != defaultRuntime {
	t.Fatalf("expected %v, got %v", runtime, defaultRuntime)
}

than

if runtime != defaultRuntime {
	t.Fatalf("expected %v, got %v", "crun", defaultRuntime)
}

Another thing, in the commit message "but Buildah is still falling
back to use crun "
=> "but Buildah is still falling
back to use runc
"

util/types.go Outdated Show resolved Hide resolved
util/util.go Outdated Show resolved Hide resolved
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Can you squash the commits?

@rhatdan
Copy link
Member Author

rhatdan commented Jan 22, 2021

Everything commented on was merged and fixed.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, saschagrunert

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

@vrothberg
Copy link
Member

@rhatdan needs a rebase :(

Currently we have a weird situation where the user sets the default
runtime in his containers.conf for podman but Buildah is still falling
back to use runc because it was hard coded as the default for Buildah.

I would like to remove this default, but that would theoretically break
the API promise of Buildah.

This should fix containers/podman#8893

Signed-off-by: Daniel J Walsh <[email protected]>
@openshift-ci-robot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@TomSweeneyRedHat
Copy link
Member

LGTM
@vrothberg or @nalind, want to add a final lgtm?

@openshift-merge-robot openshift-merge-robot merged commit 1a04337 into containers:master Jan 22, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman build continues to use runc, even if podman run is configured to use crun
7 participants