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

feat(compose/agent): add stack.agent.ports option in config.yml to publish ports for agent #1793

Conversation

pkoutsovasilis
Copy link
Contributor

This PR introduces support for defining inside config.yml of the profile ports for agent service to be published

@pkoutsovasilis pkoutsovasilis changed the title fix(compose/agent): add stack.agent.ports option in config.yml to publish ports for agent feat(compose/agent): add stack.agent.ports option in config.yml to publish ports for agent Apr 18, 2024
@pkoutsovasilis pkoutsovasilis force-pushed the pkoutsovasilis/add_agent_publish_ports branch from 69a9fd5 to 3e061e8 Compare April 18, 2024 16:07
@pkoutsovasilis pkoutsovasilis force-pushed the pkoutsovasilis/add_agent_publish_ports branch from 3e061e8 to d92388d Compare April 18, 2024 16:59
@jsoriano
Copy link
Member

I wonder if #1795 supersedes this one.

@pkoutsovasilis is there any use case that would not be covered by defining the ports in the system test cases?

@pkoutsovasilis
Copy link
Contributor Author

pkoutsovasilis commented Apr 24, 2024

I wonder if #1795 supersedes this one.

@pkoutsovasilis is there any use case that would not be covered by defining the ports in the system test cases?

hmmm interesting 🤔 the answer is yes when you are developing a new integration or testing something about an existing one. Sure this should end up in a system test but before you have a test you have to do certain manual steps to get there. Also, since this PR is now open for 6 days, if you needed support for custom agents deployments as this #1795 (2 days ago) does, wouldn't make sense to ask for it here than open a complete different PR?

@jsoriano
Copy link
Member

the answer is yes when you are developing a new integration or testing something about an existing one.

Makes sense. This is probably also useful in cases where the stack is used for manual testing.

since this PR is now open for 6 days, if you needed support for custom agents deployments as this #1795 (2 days ago) does, wouldn't make sense to ask for it here than open a complete different PR?

Well, they likely come from two different needings, we probably need both approaches. The one here for manual tests, and the other one for testing and CI in the new custom agents.

@pkoutsovasilis
Copy link
Contributor Author

Makes sense. This is probably also useful in cases where the stack is used for manual testing.

and for manual testing/development sometimes we need also custom volume mounts 😄 e.g. for this one we need this /sys/kernel/debug:/sys/kernel/debug

internal/profile/config.go Outdated Show resolved Hide resolved
@@ -141,13 +141,13 @@ type Profile struct {
}

// Path returns an absolute path to the given file
func (profile Profile) Path(names ...string) string {
func (profile *Profile) Path(names ...string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Are these changed to pointer needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so here it depends, it is considered an unusual pattern to have a struct definition that mixes both value and pointer receivers, and from a quick look at the code, profile is widely used as a pointer. Thus I homogenise the struct by making these pointer receivers but if there is a reason behind this divergence happy revert this change

Copy link
Member

Choose a reason for hiding this comment

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

Good point. I think I would rather use the profile by value, but it is true that it is mostly used as pointer now, so as you prefer.

internal/stack/_static/docker-compose-stack.yml.tmpl Outdated Show resolved Hide resolved
internal/stack/resources.go Show resolved Hide resolved
@pkoutsovasilis
Copy link
Contributor Author

Well, they likely come from two different needings, we probably need both approaches. The one here for manual tests, and the other one for testing and CI in the new custom agents.

the more I look the agentdeployer the more it makes sense to me expose this through cli and someone be able to deploy "custom" agents in the stack and focus any extendability effort there, @jsoriano what do you think?

@pkoutsovasilis pkoutsovasilis force-pushed the pkoutsovasilis/add_agent_publish_ports branch from 1cf2b61 to bc55f5d Compare April 25, 2024 07:48
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.

Thanks! I think that with this change and with #1795, we can close #1355.

internal/profile/config.go Outdated Show resolved Hide resolved
@@ -141,13 +141,13 @@ type Profile struct {
}

// Path returns an absolute path to the given file
func (profile Profile) Path(names ...string) string {
func (profile *Profile) Path(names ...string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Good point. I think I would rather use the profile by value, but it is true that it is mostly used as pointer now, so as you prefer.

internal/profile/config.go Show resolved Hide resolved
internal/stack/resources.go Show resolved Hide resolved
@jsoriano
Copy link
Member

the more I look the agentdeployer the more it makes sense to me expose this through cli and someone be able to deploy "custom" agents in the stack and focus any extendability effort there, @jsoriano what do you think?

Yeah, I see the agent deployer as the future to deploy any kind of agents. There is still some work to do in this area though, @mrodm is now working on this.

In any case we have to keep in mind that the purpose of elastic-package is to be the main tool for package developers. We should be cautious about adding features that go beyond package development.

@pkoutsovasilis pkoutsovasilis requested a review from jsoriano April 25, 2024 14:26
…ports

# Conflicts:
#	internal/stack/_static/docker-compose-stack.yml.tmpl
@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 25, 2024

💔 Build Failed

Failed CI Steps

History

@jsoriano
Copy link
Member

/test

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.

👍

@pkoutsovasilis pkoutsovasilis merged commit e4ede83 into elastic:main Apr 25, 2024
3 checks passed
@pkoutsovasilis pkoutsovasilis deleted the pkoutsovasilis/add_agent_publish_ports branch April 26, 2024 04:32
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