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

[Connector APIs] Enforce index prefix for managed connectors #117778

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented Nov 29, 2024

Changes

For 9.x, Connectors will be deployed in an agentless environment. This means the Fleet service account will now be responsible for generating API keys, enabling the connector to read/write from connector state indices and interact with the content index (where data is synced by connector from the 3rd party data source).

To maintain granular permissions and avoid granting the Fleet service account access to all indices (e.g., *), it has been decided to restrict content index names to those prefixed with content-*.

This PR introduces restrictions and validations to ensure that Elastic-managed connectors (with isNative: true flag) can only attach to indices with the content- prefix. We validate index name on:

  • connector creation
  • index name update (e.g. native connector cannot have index name changed with illegal prefix)
  • isNative property update (we need to first change the attached index to have content- then update the connector to native connector)

Why this is not a significant breaking change for users:

  • In ES serverless, there are no Elastic-managed connectors, so this change will not affect serverless product
  • For the 8.x -> 9.x migration, there is a clear migration path for Elastic-managed connectors
  • The Connector API is still in beta and not yet GA

Additionally, the ConnectorIndexServiceTests have been unmuted. These tests have been stable for about a year. A few flaky tests had caused them to be muted earlier, but they now run successfully. We need to keep them active.

Verification

  • Verified API calls manually.
  • YAML end-to-end tests.
  • unit tests

ConnectorStatus status = getConnectorStatusFromSearchResult(connector);

// If connector was connected already, change its status to CONFIGURED as we need to re-connect
if (status == ConnectorStatus.CONNECTED) {
Copy link
Member Author

@jedrazb jedrazb Nov 29, 2024

Choose a reason for hiding this comment

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

I realised we would always set status CONFIGURED once changing the is_native flag - it's likely wrong, we got here because I copied logic from Kibana initially https://github.com/elastic/kibana/pull/175536/files

- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.id: "connector-b" }
Copy link
Member Author

@jedrazb jedrazb Dec 2, 2024

Choose a reason for hiding this comment

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

content- index is first alphabetically so order of list API results changes (we sort by index_name by default)

@jedrazb jedrazb changed the title [Connector APIs] Enforce manage connector index prefix [Connector APIs] Enforce index prefix for managed connectors Dec 2, 2024
@jedrazb jedrazb marked this pull request as ready for review December 2, 2024 11:11
@elasticsearchmachine elasticsearchmachine added the Team:SearchOrg Meta label for the Search Org (Enterprise Search) label Dec 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-eng (Team:SearchOrg)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-extract-and-transform (Team:Search - Extract & Transform)

@jedrazb
Copy link
Member Author

jedrazb commented Dec 2, 2024

Rest compatibility failing because it's not a backward compatible change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :SearchOrg/Extract&Transform Label for the Search E&T team Team:Search - Extract & Transform Team:SearchOrg Meta label for the Search Org (Enterprise Search) v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants