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] Rename CONFIG_CHANGE action to POLICY_CHANGE #78221

Merged
merged 9 commits into from
Sep 29, 2020

Conversation

jen-huang
Copy link
Contributor

@jen-huang jen-huang commented Sep 22, 2020

Summary

Renames CONFIG_CHANGE action type to POLICY_CHANGE to support the corresponding agent changes in elastic/beats#20779. This also renames the data.config field to data.policy.

To ensure backwards compatibility (BWC) with agent <= v7.9, transforms were added to createAgentActionFromPolicyAction(). If the agent version is <= v7.9, we send CONFIG_CHANGE and data.config instead. Unit tests were added here against various agent versions.

@jen-huang jen-huang added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0 labels Sep 22, 2020
@jen-huang jen-huang self-assigned this Sep 22, 2020
@jen-huang jen-huang marked this pull request as ready for review September 22, 2020 22:20
@jen-huang jen-huang requested a review from a team September 22, 2020 22:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

if (newAgentAction.data.policy) {
newAgentAction.data.policy.outputs.default.api_key = apiKey;
}
// BWC for agent <= 7.9

Choose a reason for hiding this comment

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

what about 7.9.1 and 7.9.2 which are already realeased?

Choose a reason for hiding this comment

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

i see in test it will work,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, <= 7.9.x

// Transform the policy action for agent version <= 7.9 for BWC
const agentVersion = semver.parse((agent.local_metadata?.elastic as any)?.agent?.version);
const agentPolicyAction: AgentPolicyAction | AgentPolicyActionV7_9 =
agentVersion && semver.lt(agentVersion, '7.10.0')
Copy link
Member

Choose a reason for hiding this comment

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

Should we already have an issue to keep of track of these kind of change that need to be removed later?

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 will start a meta issue

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Looks good to me (after functional test are fixed) 🚀

Copy link

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

Tested this with branch elastic/beats#20779 and it received POLICY_CHANGE correctly.

@jen-huang
Copy link
Contributor Author

@elasticmachine merge upstream

@jen-huang
Copy link
Contributor Author

@nchaulet This just came to mind, do you think it is possible to have "in-flight" policy change actions that haven't been acknowledged by the agent yet when the user upgrades to 7.10 Kibana? If so, should I add a SO migration to change the type and data fields for all existing CONFIG_CHANGE action SOs?

@nchaulet
Copy link
Member

@jen-huang Yes it probably possible that happens, 👍 to have the migration to be safe

@jen-huang
Copy link
Contributor Author

@nchaulet Thanks for confirming, I pushed up a change to add migration for agent actions.

@jen-huang
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jen-huang jen-huang merged commit b412b68 into elastic:master Sep 29, 2020
@jen-huang jen-huang deleted the ingest/config-to-policy-action branch September 29, 2020 15:21
jen-huang added a commit to jen-huang/kibana that referenced this pull request Sep 29, 2020
* Initial pass at config->policy change action

* Make policy change action BWC with agent <= 7.9

* Fix test

* Add agent action SO migration for policy change actions

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jen-huang added a commit that referenced this pull request Sep 30, 2020
… (#78798)

* [Fleet] Rename `CONFIG_CHANGE` action to `POLICY_CHANGE` (#78221)

* Initial pass at config->policy change action

* Make policy change action BWC with agent <= 7.9

* Fix test

* Add agent action SO migration for policy change actions

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Add temporary logging for CI debugging

* Fix condition and adjust tests

* Revert "Add temporary logging for CI debugging"

This reverts commit 4b578eb.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants