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

Adding support for links and connectors to be used by Kibana #834

Merged
merged 24 commits into from
Dec 5, 2024

Conversation

criamico
Copy link
Contributor

@criamico criamico commented Nov 19, 2024

What does this PR do?

Adding support for links to be displayed in Kibana.

Why is it important?

This change has been requested to immediately support Agentless integrations that need to display "next steps" links in Kibana and it will be hepful for other developers as well.

Checklist

Related issues

#832

@criamico criamico self-assigned this Nov 19, 2024
@criamico criamico marked this pull request as ready for review November 20, 2024 15:14
@criamico criamico requested a review from a team as a code owner November 20, 2024 15:14
@criamico criamico added the Team:Fleet Label for the Fleet team label Nov 20, 2024
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Thanks @criamico !
Added a few comments and questions about this new links field

spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
Comment on lines 428 to 430
url:
description: Link url
type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the issue description, these links could have also some templating. It would be good to add some examples and include that information in the description.

Suggested change
url:
description: Link url
type: string
url:
description: Link url
type: string
examples:
-"kbn:/app/enterprise_search/content/connector/{{connector_id}}/overview"
- "kbn:/app/overview"
- "https://link.to/somewhere" # <- is this possible?

Probably the description should describe the expected format of this URLs? In the description is mentioned like kibana URLs as kbn:..., are other formats allowed?

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 based on the latest discussions we probably don't need to add this templating here anymore. However I'm not 100% sure about the possible url formats. I'll ask in the main issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanstory could you weigh in about the possible url formats to be used here?

spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
spec/changelog.yml Outdated Show resolved Hide resolved
test/packages/kibana_links/manifest.yml Outdated Show resolved Hide resolved
spec/changelog.yml Outdated Show resolved Hide resolved
spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
spec/changelog.yml Outdated Show resolved Hide resolved
@@ -410,6 +410,33 @@ spec:
- access
deployment_modes:
$ref: "#/definitions/deployment_modes"
links:
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to add this new field also for input packages ?

Policy templates can be defined also in that package type:

policy_templates:

If so, this definition can be moved to the definitions key (as for instance how deployment_modes is defined) so it can be reused in input packages:

  • Probably it would be good to change the name under definitions since these are not generic links.

Examples on how to reuse/reference a field from definitions:

# in input manifest:
          links:
            $ref: "../integration/manifest.spec.yml#/definitions/policy_template_links"

# in integration manifest:
          links:
            $ref: "#/definitions/policy_template_links"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mrodm I renamed links to configuration_links and moved it under the definitions field. It's now referenced both under inputs and policy templates.

test/packages/good_v3/manifest.yml Outdated Show resolved Hide resolved
Comment on lines 15 to 17
- description: Add support for configuration links to kibana manifest.
type: enhancement
link: https://github.com/elastic/package-spec/pull/834
Copy link
Contributor

Choose a reason for hiding this comment

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

New changelog entries should be added at the bottom as the latest one in the list for the given version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test package a duplicate of bad_configuration_links ?

If it does not contain other different test cases, I think it could be removed. At least this test package is not added as another case in code/go/pkg/validator/validator_test.go

Copy link
Contributor Author

@criamico criamico Dec 4, 2024

Choose a reason for hiding this comment

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

I had added the "good" case to good_v3, but that test package has version 3.4.0, so when we decided to change the version to 3.3.1 that wasn't correct anymore. Should I remove this test package then? @jsoriano what do you suggest?

Copy link
Member

Choose a reason for hiding this comment

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

I think it is good like this, so we have:

  • Some good uses of links in good_v3, this will ensure that we don't break this in future versions.
  • Some bad uses of links in bad_configuration_links, this will ensure that wrong uses are detected.
  • Some good uses of links in a package that stays in 3.3.1, this ensures that we are actually supporting this on this version.

But from what I see there are still a couple of problems:

  • bad_configuration_links and kibana_configuration_links have good_v3 as their name in their manifests. This should be fixed.
  • kibana_configuration_links package should be also added to validator_test.go, otherwise it won't be used.

test/packages/bad_configuration_links/manifest.yml Outdated Show resolved Hide resolved
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @criamico

@kpollich kpollich merged commit 5325b7e into elastic:main Dec 5, 2024
3 checks passed
criamico added a commit to elastic/kibana that referenced this pull request Dec 17, 2024
…ut (#203824)

## Summary

Display next steps and actions in agentless integrations flyout. This PR
is based off the following changes:

**Agentless flyout**
Introduced with #199567

**package-spec**
The definitions for package-spec have been updated in these two PRs:
- elastic/package-spec#834
- elastic/package-spec#844
Any agentless package can now define internal links with format
`kbn:/app/...` and external links with format `https://...`. This PR
shows a card or a button linking to these urls in the new agentless
flyout

**Connectors**
Agentless integration now expose connectors name and id in the package
policy (see code
[here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62)
for elastic connectors integration).
<img width="1003" alt="Screenshot 2024-12-16 at 16 30 22"
src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26"
/>

This PR creates a dynamic link to the connector configured in the policy
and shows it in the agentless flyout.

### Testing
- First of all, enable agentless following the steps under `Testing` in
[ this PR](#199567). Follow up to
step 3
- Instead of installing CSPM, install this test package
[agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip)
with the upload command
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip
```
- Once appears installed, create a package policy with this new
integration. Make sure to choose `agentless` as deployment mode
<img width="1278" alt="Screenshot 2024-12-16 at 16 22 09"
src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951"
/>

- Enroll an agent to the newly created "agentless" policy by using the
token (it's available in the token page)
- Go back to integrations, you should see a page like this one:
<img width="1569" alt="Screenshot 2024-12-16 at 16 38 18"
src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926"
/>

- Click on the state ("pending"/"healhty"/"unhealthy") and see the
flyout. If the enrollment was successful, you should see some cards and
buttons that link to internal and external links in kibana

<img width="878" alt="Screenshot 2024-12-16 at 16 21 57"
src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e"
/>

### Testing the connector cards
- First create a new connector: go to
`app/elasticsearch/content/connectors` and click on "new connector". For
this purpose there's no need to complete the procedure
- Note down the name and id of the connector
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca"
/>
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db"
/>
- Go back to the integration policy previously installed. Enable the
"Test Connector" input and add the name and id from above.
- The agentless flyout should now have a card that will link the user to
`app/elasticsearch/content/connectors/<id>`


### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 17, 2024
…ut (elastic#203824)

## Summary

Display next steps and actions in agentless integrations flyout. This PR
is based off the following changes:

**Agentless flyout**
Introduced with elastic#199567

**package-spec**
The definitions for package-spec have been updated in these two PRs:
- elastic/package-spec#834
- elastic/package-spec#844
Any agentless package can now define internal links with format
`kbn:/app/...` and external links with format `https://...`. This PR
shows a card or a button linking to these urls in the new agentless
flyout

**Connectors**
Agentless integration now expose connectors name and id in the package
policy (see code
[here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62)
for elastic connectors integration).
<img width="1003" alt="Screenshot 2024-12-16 at 16 30 22"
src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26"
/>

This PR creates a dynamic link to the connector configured in the policy
and shows it in the agentless flyout.

### Testing
- First of all, enable agentless following the steps under `Testing` in
[ this PR](elastic#199567). Follow up to
step 3
- Instead of installing CSPM, install this test package
[agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip)
with the upload command
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip
```
- Once appears installed, create a package policy with this new
integration. Make sure to choose `agentless` as deployment mode
<img width="1278" alt="Screenshot 2024-12-16 at 16 22 09"
src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951"
/>

- Enroll an agent to the newly created "agentless" policy by using the
token (it's available in the token page)
- Go back to integrations, you should see a page like this one:
<img width="1569" alt="Screenshot 2024-12-16 at 16 38 18"
src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926"
/>

- Click on the state ("pending"/"healhty"/"unhealthy") and see the
flyout. If the enrollment was successful, you should see some cards and
buttons that link to internal and external links in kibana

<img width="878" alt="Screenshot 2024-12-16 at 16 21 57"
src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e"
/>

### Testing the connector cards
- First create a new connector: go to
`app/elasticsearch/content/connectors` and click on "new connector". For
this purpose there's no need to complete the procedure
- Note down the name and id of the connector
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca"
/>
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db"
/>
- Go back to the integration policy previously installed. Enable the
"Test Connector" input and add the name and id from above.
- The agentless flyout should now have a card that will link the user to
`app/elasticsearch/content/connectors/<id>`

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 790c589)
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Dec 19, 2024
…ut (elastic#203824)

## Summary

Display next steps and actions in agentless integrations flyout. This PR
is based off the following changes:

**Agentless flyout**
Introduced with elastic#199567

**package-spec**
The definitions for package-spec have been updated in these two PRs:
- elastic/package-spec#834
- elastic/package-spec#844
Any agentless package can now define internal links with format
`kbn:/app/...` and external links with format `https://...`. This PR
shows a card or a button linking to these urls in the new agentless
flyout

**Connectors**
Agentless integration now expose connectors name and id in the package
policy (see code
[here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62)
for elastic connectors integration).
<img width="1003" alt="Screenshot 2024-12-16 at 16 30 22"
src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26"
/>

This PR creates a dynamic link to the connector configured in the policy
and shows it in the agentless flyout.

### Testing
- First of all, enable agentless following the steps under `Testing` in
[ this PR](elastic#199567). Follow up to
step 3
- Instead of installing CSPM, install this test package
[agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip)
with the upload command
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip
```
- Once appears installed, create a package policy with this new
integration. Make sure to choose `agentless` as deployment mode
<img width="1278" alt="Screenshot 2024-12-16 at 16 22 09"
src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951"
/>

- Enroll an agent to the newly created "agentless" policy by using the
token (it's available in the token page)
- Go back to integrations, you should see a page like this one:
<img width="1569" alt="Screenshot 2024-12-16 at 16 38 18"
src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926"
/>

- Click on the state ("pending"/"healhty"/"unhealthy") and see the
flyout. If the enrollment was successful, you should see some cards and
buttons that link to internal and external links in kibana

<img width="878" alt="Screenshot 2024-12-16 at 16 21 57"
src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e"
/>

### Testing the connector cards
- First create a new connector: go to
`app/elasticsearch/content/connectors` and click on "new connector". For
this purpose there's no need to complete the procedure
- Note down the name and id of the connector
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca"
/>
<img width="1789" alt="Screenshot 2024-12-16 at 16 42 00"
src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db"
/>
- Go back to the integration policy previously installed. Enable the
"Test Connector" input and add the name and id from above.
- The agentless flyout should now have a card that will link the user to
`app/elasticsearch/content/connectors/<id>`


### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Label for the Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants