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] Improve support for Agentless in Fleet UI #183045

Merged
merged 16 commits into from
May 24, 2024

Conversation

criamico
Copy link
Contributor

@criamico criamico commented May 9, 2024

Closes #180375

Summary

Expand support for Agentless in Fleet UI. Implemented on this PR:

Notes

  • In this PR, an integration enabled for serverless is still added to the default agentless policy.
  • Integrations enabled for agentless don't display any specific "agentless" form yet. That part is TBD

Testing

Verify that new settings are honoured in integration policy

  • Use the compiled package with new properties defined in Add support for definitions related to deployment modes package-spec#738 agentless_test_package-1.0.1-rc1.zip (Packages in this comment)
  • Upload it to Kibana:
     curl -k -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' https://localhost:5601/api/fleet/epm/packages -u elastic_serverless:changeme --data-binary @agentless_test_package-0.0.1.zip
  • Check that the variable marked with hide_in_deployment_modes: "agentless" are not visible
  • Check that the agent policies selector is not visible

Screenshot 2024-05-22 at 10 37 42

Verify that agent policies with supports_agentless are marked as managed

  • Create a new policy with supports_agentless
    POST kbn:/api/fleet/agent_policies
    {
      "name": "Test - Agentless policy",
      "namespace": "default",
      "supports_agentless": true
    }
    
  • Check that the created policy has is_managed = true
  • Try to change the value to false - an error is thrown
    PUT kbn:/api/fleet/agent_policies/<policy_id>
    {
      "name": "Test - Agentless policy",
      "namespace": "default",
      "supports_agentless": false
    }
    

Checklist

@criamico criamico self-assigned this May 9, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label May 9, 2024
@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico
Copy link
Contributor Author

/ci

@kfirpeled
Copy link
Contributor

cc: @Omolola-Akinleye , @seanrathier

@criamico
Copy link
Contributor Author

/ci

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico
Copy link
Contributor Author

/ci

@criamico
Copy link
Contributor Author

criamico commented May 22, 2024

I built a test package with some example inputs that has the new fields specified in elastic/package-spec#738 - I built two different versions to make sure that both will work on kibana:

These files can be used to test the above changes.

@criamico criamico marked this pull request as ready for review May 22, 2024 08:45
@criamico criamico requested review from a team as code owners May 22, 2024 08:45
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico criamico added release_note:skip Skip the PR/issue when compiling release notes v8.15.0 labels May 22, 2024
@criamico
Copy link
Contributor Author

I tested the UI with the example integrations in ESS as well to make sure that the variables are shown/hidden as requested:

  • Test with the version 0.0.1 (only new agentless fields):
    Screenshot 2024-05-22 at 11 12 08

  • Test with 1.0.1-rc that has also the default fields:
    Screenshot 2024-05-22 at 11 12 54

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1188 1189 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.3MB 1.3MB +1.1KB
Unknown metric groups

API count

id before after diff
fleet 1309 1310 +1

History

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

cc @criamico

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@kpollich
Copy link
Member

Should the "create agent policy" step be shown for agentless policies? I would expect that an agentless integration would always be placed on the agentless hardcoded policy for now in these changes.

@criamico
Copy link
Contributor Author

criamico commented May 23, 2024

Should the "create agent policy" step be shown for agentless policies? I would expect that an agentless integration would always be placed on the agentless hardcoded policy for now in these changes.

@kpollich It's actually like that already. Here's a screenshot on serverless with agentless flag enabled:

Screenshot 2024-05-22 at 10 37 42

Outside of this conditions (ESS, serverless with agentless not enabled) the agent policy selector is shown, as there is nothing to prevent an agentless integration to be installed.

@kpollich
Copy link
Member

Perfect - thanks for clarifying, @criamico 👍

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

LGTM - happy to see tests on both client + server side here. 🚀

@@ -278,7 +278,7 @@ describe('Agent policy', () => {
);
});

it('should not throw error if support_agentless is set if agentless feature flag is set in serverless', async () => {
it('should create a policy with is_managed true if agentless feature flag is set and in serverless env', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for updating this test case based on the new logic added.

@criamico criamico merged commit 5cdb132 into elastic:main May 24, 2024
19 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 24, 2024
@criamico criamico deleted the 180375_Improve_support_for_agentless branch May 24, 2024 07:18
criamico added a commit that referenced this pull request May 28, 2024
Fixes #184191

## Summary

With merge of #183045 some tests
related to agentless started failing in main. I realized that there was
a missing condition in a form, so this PR adds that condition and fixes
the failing test.

Note: the test wasn't flaky, it was failing on each run after merge. For
some reason it never failed on the branch, however there was a
concurrent merge of [another
PR](b86039e)
that touched the same UI and that could have something to do with it.

### 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Update Fleet UI to handle agentless integrations + policies
9 participants