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

Add HelperBinariesDir field to engine config #758

Merged
merged 1 commit into from Sep 11, 2021

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Sep 8, 2021

This field contains a list of directories which should be used to store
some helper binaries, e.g. gvproxy.

Also add a FindHelperBinary method to the config struct to get the full
path to a helper binary.

Signed-off-by: Paul Holzinger pholzing@redhat.com

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 8, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

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

@openshift-ci openshift-ci bot added the approved label Sep 8, 2021
@Luap99
Copy link
Member Author

Luap99 commented Sep 8, 2021

@baude @rhatdan @vrothberg @mheon @ashley-cui PTAL
I think this is the best solution for the the gvproxy path problem. I think having this in the containers.conf file makes the most sense, given that it is likely that we need more helper binaries in the future (new network stack and also maybe rootlessport).

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.

Two mini nits but LGTM

Nice idea!

# A is a list of directories which are used to search for helper binaries.
#
#helper_binaries_dir = [
# "/usr/local/libexec/podman",
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is off in the first entry.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is intentional, check the other config options in the file.

@@ -15,3 +15,11 @@ func customConfigFile() (string, error) {
func ifRootlessConfigPath() (string, error) {
return rootlessConfigPath()
}

var defaultHelperBinariesDir = []string{
// FIXME: What paths can we use on mac?
Copy link
Member

Choose a reason for hiding this comment

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

/usr/libexec seems to exist on Mac OS, so we could make that the first entry.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I have no idea about what paths can be used for mac or where homebrew install this ATM. That's why I marked this as draft.

Copy link

@jonpspri jonpspri Sep 8, 2021

Choose a reason for hiding this comment

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

At the moment, Homebrew installs gvproxy into /usr/local/bin or /opt/homebrew/bin (depending... long story), but the general consensus seems that we no longer want gvproxy to be in the executable path. The next-best option seems to be to have Homebrew leave it in-key at ${HOMEBREW_PREFIX}/Cellar/podman/${version}/libexec, but you can see that that version in the middle of the keg means we'll just need to put out a containers.conf file with the configured directory as part of the Homebrew install anyway. So, for the moment, I'd not worry about the Mac for the default list -- what's here LGTM for defaults.

Which leads me to the search path for containers.conf ... reviewing that now.

Copy link

@jonpspri jonpspri Sep 8, 2021

Choose a reason for hiding this comment

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

I reread (again) the Homebrew Formula Cookbook and discovered "the opt prefix". If we add /usr/local/opt/podman/libexec, /opt/homebrew/bin, and /opt/homebrew/opt/podman/lib exec to the defaults list, we should be okay.

Copy link

Choose a reason for hiding this comment

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

@Luap99 Are you good to add the 3 directories above or shall I file a PR against your repo?

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 will add them, thanks for the list.

@jonpspri
Copy link

jonpspri commented Sep 8, 2021

We're getting there, but I still have some concerns about hard-coded paths. Looking at

const (
// _configPath is the path to the containers/containers.conf
// inside a given config directory.
_configPath = "containers/containers.conf"
// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/etc/" + _configPath
// UserOverrideContainersConfig holds the containers config path overridden by the rootless user
UserOverrideContainersConfig = ".config/" + _configPath
)
, it seems the System and Override containers.conf locations are hard-coded and do not respect install prefixes. While we could just punt and say the environment variable CONTAINERS_CONF needs to be set on the Mac, I'd prefer to be able to create system configuration files and install them from Homebrew and other package management systems.

Heaven forefend we have to do a patch during that build :)

@Luap99
Copy link
Member Author

Luap99 commented Sep 8, 2021

@jonpspri Can we just put the config file in ~/.config/containers/containers.conf?

@jonpspri
Copy link

jonpspri commented Sep 8, 2021

Homebrew spec says it should got to ${HOMEBREW_PREFIX}/usr/share/containers/containers.conf and to ${HOMEBREW_PREFIX}/etc/containers/containers.conf, which is what I think the installer will support. I need to run out now... I'll do some checking later. I still think we should use a configurable prefix, even if we reverse-engineer it based on where the binary is installed.

@jonpspri
Copy link

jonpspri commented Sep 8, 2021

Given that we can work with the path list in the code (for now), I suggest we defer the "where do the configurations live" conversation to a separate issue.

Copy link

@jonpspri jonpspri left a comment

Choose a reason for hiding this comment

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

Just a problem with /usr/local/bin needing to be there for the current x86_64 Homebrew install. I think it disappeared through a lack of clarity in my comment.

pkg/config/config_darwin.go Show resolved Hide resolved
docs/containers.conf.5.md Show resolved Hide resolved
This field contains a list of directories which should be used to store
some helper binaries, e.g. gvproxy.

Also add a FindHelperBinary method to the config struct to get the full
path to a helper binary.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@Luap99
Copy link
Member Author

Luap99 commented Sep 10, 2021

@jonpspri updated with /usr/local/bin

@rhatdan
Copy link
Member

rhatdan commented Sep 10, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Sep 11, 2021
@openshift-merge-robot openshift-merge-robot merged commit 2d46695 into containers:main Sep 11, 2021
@simnalamburt
Copy link

Once we release a new version of containers/common, both podman main branch and v3.3 branch will be ready to support macOS Apple silicon

@Luap99 Luap99 deleted the helperBinDir branch September 11, 2021 09:26
@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants