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

pkg/config: lookup InitPath in HelperBinariesDir #1698

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Oct 17, 2023

Forcing a single upstream default for the init path is bad as some distro use different install locations for various reasons.

To fix this use the existing helper_binaries_dir field to lookup in all directories. To keep backwards compatibility we keep using the old default and both Containers.InitPath and Engine.InitPath. Yes that is right, somehow we ended up with the same config field under the containers and engine section and they are both used in podman! Thus we need to keep supporting both, only the field under the container section was documented and it will now be marked as deprecated.

To make the docs more clear also document what binaries are currently looked up in helper_binaries_dir.

Note this needs further integration in podman.

Fixes #1110

@@ -540,11 +542,6 @@ func (c *Config) Env() []string {
return c.Containers.Env
}

// InitPath returns location where init program added to containers when users specify the --init flag.
Copy link
Member

Choose a reason for hiding this comment

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

This would cause a breaking change, why not still return the init-path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because this is a broken API, nobody should call that, the correct logic is in FindInintBinary(). Returning a single path just causes confusion for users who think this function does return something correct.
We do not guarantee a stable API in c/common so I can just nuke it here and update the only caller in podman.

@@ -205,6 +205,8 @@ Run an init inside the container that forwards signals and reaps processes.

**init_path**="/usr/libexec/podman/catatonit"

Deprecated: It is recommend to place catatonit in a directory listed under the **helper_binaries_dir** option.
Copy link
Member

@vrothberg vrothberg Oct 18, 2023

Choose a reason for hiding this comment

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

What does deprecation mean in this context? Is it a NOP from now on or will it still be used if set? (Didn't read the Podman/full PR yet but I think users may have the same question)

Copy link
Member Author

Choose a reason for hiding this comment

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

It still works fine, same for the other undocumented field under the engine section, see FindInintBinary().
With deprecated I mean that users should instead of setting this field place it under one of the helper binaries directories instead. This field will continue to work and I have no intention of removing it as this will break backwards compat.

Copy link
Member

Choose a reason for hiding this comment

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

Could we rephrase "deprecated" to "We recommend using $the_other_thing instead"? I feel that "deprecated" raises more questions than answers in this specific case.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer to remove deprecated stuff from the man page totally, If the user has a containers.conf with this field, it will be used but we don't need to menetion it in man page or containers.conf.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I went with deprecated because that leaves the door open to remove it at some point. But I guess both fields are simple enough to keep them supported even for future major versions.

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.

Code LGTM

Forcing a single upstream default for the init path is bad as some
distro use different install locations for various reasons.

To fix this use the existing helper_binaries_dir field to lookup in all
directories. To keep backwards compatibility we keep using the old
default and both Containers.InitPath and Engine.InitPath. Yes that is
right, somehow we ended up with the same config field under the
containers and engine section and they are both used in podman!
Thus we need to keep supporting both, only the field under the container
section was documented and now recommends the use of helper_binaries_dir.

To make the docs more clear also document what binaries are currently
looked up in helper_binaries_dir.

Note this needs further integration in podman.

Fixes containers#1110

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, vrothberg

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

@rhatdan
Copy link
Member

rhatdan commented Oct 18, 2023

I would have removed the description in containers.conf, but this is fine.

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Oct 18, 2023
@openshift-ci openshift-ci bot merged commit 493ab45 into containers:main Oct 18, 2023
7 checks passed
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.

podman does not adhere to path set with LIBEXECDIR (e.g. for catatonit)
3 participants