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 support to define expose ports for independent agents #1795

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Apr 22, 2024

Part of #787
Relates #1262 #1355

This PR allows users to define which ports should be exposed from the Elastic Agent container.ç
This definition should be added to the system configuration file. Example:

agent:
  ports:
    - "127.0.0.1:3000:3000"

This example is based on agents using docker as a runtime https://docs.docker.com/compose/compose-file/compose-file-v2/#ports

@mrodm mrodm self-assigned this Apr 22, 2024
@mrodm mrodm force-pushed the add_expose_ports_independent_agents branch from 776cded to d9e2124 Compare April 22, 2024 16:37
@mrodm mrodm marked this pull request as ready for review April 23, 2024 09:39
@mrodm mrodm requested a review from a team April 23, 2024 09:39
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

👍

@@ -58,6 +58,7 @@ type testConfig struct {
PidMode string `config:"pid_mode"`
LinuxCapabilities []string `config:"linux_capabilities"`
Runtime string `config:"runtime"`
ExposePorts []string `config:"expose_ports"`
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Have you thought about calling this just ports?

Suggested change
ExposePorts []string `config:"expose_ports"`
ExposePorts []string `config:"ports"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to emphasize that these ports are the ones to be exposed. But re-thinking that idea, if it used ports as the name in those settings, it looks like is clear that it refers to the ports to be exposed (or forwarded from the host like in VMs).

For instance, docker-compose uses ports: https://docs.docker.com/compose/compose-file/compose-file-v3/#ports
But in Vargrantfile, it is used forwarded_ports: https://developer.hashicorp.com/vagrant/docs/networking/forwarded_ports#defining-a-forwarded-port

I think it could be just "ports".

I'll update the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 2af3fac

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm merged commit 9419be6 into elastic:main Apr 25, 2024
3 checks passed
@mrodm mrodm deleted the add_expose_ports_independent_agents branch April 25, 2024 09:44
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.

3 participants