Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Improve detection of containerized environments - fix issue #1732 #1879

Merged
merged 1 commit into from
Jul 12, 2018

Conversation

flavio
Copy link
Member

@flavio flavio commented Jul 10, 2018

The code determining if Portus is running containerized is broken on Kubernetes because in this case PID 1 doesn't belong to the docker cgroup slice.

That causes the code to invoke hostnamectl, that tries to access kdbus from within a container. That causes Rails to fail immediately.

fixes #1732

The code determining if Portus is running containerized is broken on
Kubernetes because in this case PID 1 doesn't belong to the `docker`
cgroup slice.

That causes the code to invoke `hostnamectl`, that tries to access
kdbus from within a container. That causes Rails to fail immediately.

Signed-off-by: Flavio Castelli <[email protected]>
@flavio
Copy link
Member Author

flavio commented Jul 10, 2018

@mssola the code is gone from master. However I think we should fix it inside of the v2.3 branch.

Copy link
Member

@jordimassaguerpla jordimassaguerpla left a comment

Choose a reason for hiding this comment

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

I can't test it right now but given the detailed bug report, this makes a lot of sense , hence I am approving this. Thanks for this fix.

@mssola mssola merged commit eaab41d into v2.3 Jul 12, 2018
@mssola mssola deleted the v2.3-fix-1732 branch July 12, 2018 09:22
@mssola
Copy link
Collaborator

mssola commented Jul 12, 2018

Thanks a lot 👏

@Monnoroch
Copy link

@flavio also, docker is not the only container runtime. There's also containerd, rkt and probably more. Checking for kubepods is great for kubernetes, but this check has to be redesigned to handle more runtimes.

@flavio
Copy link
Member Author

flavio commented Jul 16, 2018

@Monnoroch by default kubernetes places all the user PODs under this cgroup namespace, despite of the CRI in use.

@Monnoroch
Copy link

There is life outside kubernetes too. Besides, what if they change the cgroup name? Current implementation looks like a hack, really. I think there should be a way for a user to force assuming a containerized environment. Or, better yet, making the software environment-agnostic.

@flavio
Copy link
Member Author

flavio commented Aug 7, 2018

As far as I've seen this code is gone from the master branch of Portus. I see this just as a temporary fix.

@mssola can you confirm what I've said, we are not going to have to deal with this code anymore. Am I right?

@mssola
Copy link
Collaborator

mssola commented Aug 8, 2018

As far as I've seen this code is gone from the master branch of Portus. I see this just as a temporary fix.

That's correct. This fix only applied to the v2.3 branch. For the master branch we are using this portusctl, which does not need this kind of check.

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

Successfully merging this pull request may close these issues.

4 participants