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

[Fleet] Fleet uses the wrong configuration key for agent.download.sourceURI #141470

Closed
cmacknz opened this issue Sep 22, 2022 · 3 comments · Fixed by #146303
Closed

[Fleet] Fleet uses the wrong configuration key for agent.download.sourceURI #141470

cmacknz opened this issue Sep 22, 2022 · 3 comments · Fixed by #146303
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@cmacknz
Copy link
Member

cmacknz commented Sep 22, 2022

Fleet is creating agent policies with agent.download.source_uri when the agent expects it to be agent.download.sourceURI. This has caused several bugs with agent artifact downloads not working correctly, causing the agent to have to handle both formats. See elastic/elastic-agent#1252 for one example.

The agent configuration entry for the download URI is defined here:

	// SourceURI: source of the artifacts, e.g https://artifacts.elastic.co/downloads/
	SourceURI string `json:"sourceURI" config:"sourceURI"`

I am not entirely sure where Fleet defines this, but one reference to source_uri instead of sourceURI can be found at:

agent?: {
monitoring: {
namespace?: string;
use_output?: string;
enabled: boolean;
metrics: boolean;
logs: boolean;
};
download: { source_uri: string };
};

Fixing this would require migrating existing agent policies to the expected configuration key.

I am less interested in fixing this particular instance of Fleet being out of sync with the Agent, and more interested in defining a way to prevent this type of problem in the future.

@cmacknz cmacknz added bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team labels Sep 22, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet
Copy link
Member

@cmacknz is there somewhere a JSON schema of the agent policy that we can maybe use in our test to validate that we always generate a correct agent policy.
I am not sure what will be the best way to share this but if this schema live in the elastic agent repo we could have some automated PR that update kibana with it, (like the one for kubernetes agent manifest)

@cmacknz
Copy link
Member Author

cmacknz commented Sep 23, 2022

Thanks, there isn't a JSON schema for the agent policy unfortunately. Creating something like this has come up a few times, I'll look into creating one.

criamico added a commit that referenced this issue Nov 30, 2022
…6303)

## Summary
Closes #141470

The source_uri parameter in agent policy should actually be `sourceURI`.
I didn't change the parameter everywhere in the code but only where is
exposed to the agent policy/actions, since in other places is only used
internally by fleet.

<img width="748" alt="Screenshot 2022-11-24 at 15 59 54"
src="https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png">


### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Dec 7, 2022
…stic#146303)

## Summary
Closes elastic#141470

The source_uri parameter in agent policy should actually be `sourceURI`.
I didn't change the parameter everywhere in the code but only where is
exposed to the agent policy/actions, since in other places is only used
internally by fleet.

<img width="748" alt="Screenshot 2022-11-24 at 15 59 54"
src="https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png">

### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit fbd040f)
kibanamachine referenced this issue Dec 7, 2022
#146303) (#147204)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Fleet] Rename parameter source_uri to sourceURI in agent policy
(#146303)](#146303)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-11-30T13:46:19Z","message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.7.0"],"number":146303,"url":"https://github.com/elastic/kibana/pull/146303","mergeCommit":{"message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146303","number":146303,"mergeCommit":{"message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants