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

fix(image): install psmisc and net-tools to provide fuser and netstat #384

Merged
merged 3 commits into from
Mar 2, 2023

Conversation

fffonion
Copy link
Contributor

fuser as added as a depenndecy in 3.0.0.0 to test opentelemetry plugin,
but as that's a CE plugin, it wasn't using pongo to test before. In 3.2.x.x, a
new EE plugin starts to use the same helper function that calls fuser
(and also netstat) and result in a command not found in pongo test.

@Tieske
Copy link
Member

Tieske commented Feb 14, 2023

This cannot be right. The Pongo image is created from an official Kong image. So if those tools are not in the Pongo image, then they are also not in the official image. So I guess the official image needs to be fixed here?

@fffonion
Copy link
Contributor Author

fffonion commented Feb 14, 2023

@Tieske yes they are not in the official image at the beginning:

docker run --user=0 -it --rm kong/kong-gateway:3.0.0.0 bash
root@0af25f0c3b3d:/# netstat
bash: netstat: command not found
root@0af25f0c3b3d:/# fuser
bash: fuser: command not found
root@0af25f0c3b3d:/#

It's not an issue before because on CI we are not running core tests in a container, and host system have those tools installed; and plus no EE plugins were using the two spec.helper functions that requires the tool utils before.

And we don't want to install a tool that's not a run-time dependency into kong official docker image, for both run-time security and vulnerability scanning reasons.

@Tieske
Copy link
Member

Tieske commented Feb 14, 2023

ok, so I was misunderstanding it seems.

The dependencies on those tools;

  • is it a runtime dependency for the plugin? (eg. the plugin won't work unless they are installed?) --> the tools should be in the base Kong image
  • or is it a test dependency only used by the test helpers to test the plugin functionality? and if that is the case;
    • is it specific for this plugin, --> then the Pongo setup script for the plugin can be used to install it when the plugin tests run (no need to put in in every Pongo image)
    • is it a generic tool for testing and reusable for other tests? --> This PR is right, we add it to the Pongo generated image

So which one is it then?

@fffonion
Copy link
Contributor Author

fffonion commented Feb 15, 2023

@Tieske It's from generic helper functions in spec.helpers.
fuser is for https://github.com/Kong/kong-pongo/blob/master/kong-versions/3.1.1.3/kong/spec/helpers.lua#L1414
and netstat for https://github.com/Kong/kong-pongo/blob/master/kong-versions/3.1.1.3/kong/spec/helpers.lua#L225.
They are reusable by other tests yes, including opentelemetry (it's OSS) plugin and some core tests.

They are not runtime dependency for either core, opentelemtry plugin or the new datadog-tracing plugin (coming in EE 3.2, which requires them in tests).

@Tieske
Copy link
Member

Tieske commented Feb 15, 2023

ok, then the only thing missing seems to be a changelog entry

@fffonion
Copy link
Contributor Author

fffonion commented Mar 2, 2023

changelog added!

@Tieske Tieske force-pushed the docker/install-fuser-netstat branch from e0b520a to c984253 Compare March 2, 2023 13:56
@Tieske Tieske changed the title fix(docker): install psmisc and net-tools to provide fuser and netstat fix(image): install psmisc and net-tools to provide fuser and netstat Mar 2, 2023
@Tieske Tieske merged commit 23cc604 into master Mar 2, 2023
@Tieske Tieske deleted the docker/install-fuser-netstat branch March 2, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants