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

[Connectors] Removing index name should not remove connector #183833

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented May 20, 2024

Summary

In Search indices table, if you delete an index with a connector attached to it, it deletes both of them.
This was the normally accepted behaviour but with 8.13 we decouple the connector and index.

Ideally deleting and index should only delete index and not touch connector attached to it. Similar to the behaviour on Connectors table.

The connector is not deleted, instead the referenced (deleted) index is detached from connector so that user gets the warning that they need to reconfigure the index once they navigate to connectors overview.

We are still removing api keys and connector secrets associated with the deleted index. They need to be regenerated in the connector configuration tab.

Screenshot

deleteindexnoconnector.mov

@jedrazb jedrazb added release_note:skip Skip the PR/issue when compiling release notes v8.14.0 v8.15.0 labels May 20, 2024
@jedrazb jedrazb marked this pull request as ready for review May 20, 2024 13:48
@jedrazb jedrazb requested a review from a team May 20, 2024 13:48
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #2 / dashboard app - group 3 dashboard state Directly modifying url updates dashboard state for embeddable config color parameters on a visualization resets a pie slice color to the original when removed

Metrics [docs]

✅ unchanged

History

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

@jedrazb jedrazb merged commit cb12772 into elastic:main May 21, 2024
20 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 21, 2024
…#183833)

In `Search indices` table, if you delete an index with a connector
attached to it, it deletes both of them.
This was the normally accepted behaviour but with 8.13 we decouple the
connector and index.

Ideally deleting and index should only delete index and not touch
connector attached to it. Similar to the behaviour on `Connectors`
table.

The connector is not deleted, instead the referenced (deleted) index is
detached from connector so that user gets the warning that they need to
reconfigure the index once they navigate to connectors overview.

We are still removing api keys and connector secrets associated with the
deleted index. They need to be regenerated in the connector
configuration tab.

(cherry picked from commit cb12772)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.14

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 21, 2024
…183833) (#183913)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Connectors] Removing index name should not remove connector
(#183833)](#183833)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jedr
Blaszyk","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-05-21T12:50:21Z","message":"[Connectors]
Removing index name should not remove connector (#183833)\n\nIn `Search
indices` table, if you delete an index with a connector\r\nattached to
it, it deletes both of them.\r\nThis was the normally accepted behaviour
but with 8.13 we decouple the\r\nconnector and index.\r\n\r\nIdeally
deleting and index should only delete index and not touch\r\nconnector
attached to it. Similar to the behaviour on
`Connectors`\r\ntable.\r\n\r\nThe connector is not deleted, instead the
referenced (deleted) index is\r\ndetached from connector so that user
gets the warning that they need to\r\nreconfigure the index once they
navigate to connectors overview.\r\n\r\nWe are still removing api keys
and connector secrets associated with the\r\ndeleted index. They need to
be regenerated in the connector\r\nconfiguration
tab.","sha":"cb127727b420f0a5fd19314b67683b0e045d2f5c","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.14.0","v8.15.0"],"title":"[Connectors]
Removing index name should not remove
connector","number":183833,"url":"https://github.com/elastic/kibana/pull/183833","mergeCommit":{"message":"[Connectors]
Removing index name should not remove connector (#183833)\n\nIn `Search
indices` table, if you delete an index with a connector\r\nattached to
it, it deletes both of them.\r\nThis was the normally accepted behaviour
but with 8.13 we decouple the\r\nconnector and index.\r\n\r\nIdeally
deleting and index should only delete index and not touch\r\nconnector
attached to it. Similar to the behaviour on
`Connectors`\r\ntable.\r\n\r\nThe connector is not deleted, instead the
referenced (deleted) index is\r\ndetached from connector so that user
gets the warning that they need to\r\nreconfigure the index once they
navigate to connectors overview.\r\n\r\nWe are still removing api keys
and connector secrets associated with the\r\ndeleted index. They need to
be regenerated in the connector\r\nconfiguration
tab.","sha":"cb127727b420f0a5fd19314b67683b0e045d2f5c"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/183833","number":183833,"mergeCommit":{"message":"[Connectors]
Removing index name should not remove connector (#183833)\n\nIn `Search
indices` table, if you delete an index with a connector\r\nattached to
it, it deletes both of them.\r\nThis was the normally accepted behaviour
but with 8.13 we decouple the\r\nconnector and index.\r\n\r\nIdeally
deleting and index should only delete index and not touch\r\nconnector
attached to it. Similar to the behaviour on
`Connectors`\r\ntable.\r\n\r\nThe connector is not deleted, instead the
referenced (deleted) index is\r\ndetached from connector so that user
gets the warning that they need to\r\nreconfigure the index once they
navigate to connectors overview.\r\n\r\nWe are still removing api keys
and connector secrets associated with the\r\ndeleted index. They need to
be regenerated in the connector\r\nconfiguration
tab.","sha":"cb127727b420f0a5fd19314b67683b0e045d2f5c"}}]}] BACKPORT-->

Co-authored-by: Jedr Blaszyk <[email protected]>
jedrazb added a commit that referenced this pull request Oct 8, 2024
## Summary

The bug is that connector doc can be of `elastic-crawler` service type,
we forgot about this in the logic that handles detaching the index from
connector upon index delation.

This change checks if a connector doc, matching the `index_name` to be
deleted, is of crawler type:
- If yes, delete the connector (crawler) doc, as crawler is always tied
1:1 to an index
- If no, detach the index, leave the connector doc in the connector
index

This bug was likely introduced as a part of:
#183833 (some lazy engineer forgot
to test for this edge case ...)

## Validation

### Delete Crawler case 1: Delete Crawler deletes crawler doc + related
index


https://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1

### Delete Crawler case 2: Delete crawler-related index deletes crawler
doc


https://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 8, 2024
## Summary

The bug is that connector doc can be of `elastic-crawler` service type,
we forgot about this in the logic that handles detaching the index from
connector upon index delation.

This change checks if a connector doc, matching the `index_name` to be
deleted, is of crawler type:
- If yes, delete the connector (crawler) doc, as crawler is always tied
1:1 to an index
- If no, detach the index, leave the connector doc in the connector
index

This bug was likely introduced as a part of:
elastic#183833 (some lazy engineer forgot
to test for this edge case ...)

## Validation

### Delete Crawler case 1: Delete Crawler deletes crawler doc + related
index

https://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1

### Delete Crawler case 2: Delete crawler-related index deletes crawler
doc

https://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208
(cherry picked from commit bf62169)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 8, 2024
## Summary

The bug is that connector doc can be of `elastic-crawler` service type,
we forgot about this in the logic that handles detaching the index from
connector upon index delation.

This change checks if a connector doc, matching the `index_name` to be
deleted, is of crawler type:
- If yes, delete the connector (crawler) doc, as crawler is always tied
1:1 to an index
- If no, detach the index, leave the connector doc in the connector
index

This bug was likely introduced as a part of:
elastic#183833 (some lazy engineer forgot
to test for this edge case ...)

## Validation

### Delete Crawler case 1: Delete Crawler deletes crawler doc + related
index

https://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1

### Delete Crawler case 2: Delete crawler-related index deletes crawler
doc

https://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208
(cherry picked from commit bf62169)
kibanamachine added a commit that referenced this pull request Oct 8, 2024
…195483)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Search] Fix issue with crawler not getting deleted
(#195440)](#195440)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jedr
Blaszyk","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-08T17:30:46Z","message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version","v8.15.3"],"title":"[Search]
Fix issue with crawler not getting
deleted","number":195440,"url":"https://github.com/elastic/kibana/pull/195440","mergeCommit":{"message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195440","number":195440,"mergeCommit":{"message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jedr Blaszyk <[email protected]>
kibanamachine added a commit that referenced this pull request Oct 8, 2024
…195484)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Search] Fix issue with crawler not getting deleted
(#195440)](#195440)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jedr
Blaszyk","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-08T17:30:46Z","message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version","v8.15.3"],"title":"[Search]
Fix issue with crawler not getting
deleted","number":195440,"url":"https://github.com/elastic/kibana/pull/195440","mergeCommit":{"message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195440","number":195440,"mergeCommit":{"message":"[Search]
Fix issue with crawler not getting deleted (#195440)\n\n##
Summary\r\n\r\nThe bug is that connector doc can be of `elastic-crawler`
service type,\r\nwe forgot about this in the logic that handles
detaching the index from\r\nconnector upon index delation.\r\n\r\nThis
change checks if a connector doc, matching the `index_name` to
be\r\ndeleted, is of crawler type:\r\n- If yes, delete the connector
(crawler) doc, as crawler is always tied\r\n1:1 to an index\r\n- If no,
detach the index, leave the connector doc in the
connector\r\nindex\r\n\r\nThis bug was likely introduced as a part
of:\r\nhttps://github.com//pull/183833 (some lazy engineer
forgot\r\nto test for this edge case ...)\r\n\r\n##
Validation\r\n\r\n### Delete Crawler case 1: Delete Crawler deletes
crawler doc +
related\r\nindex\r\n\r\n\r\nhttps://github.com/user-attachments/assets/68ad14f7-4a7f-408c-8731-6ed0465f9ef1\r\n\r\n###
Delete Crawler case 2: Delete crawler-related index deletes
crawler\r\ndoc\r\n\r\n\r\nhttps://github.com/user-attachments/assets/e2995697-32c4-4f8f-90ce-9c06c7e6d208","sha":"bf621693f20b012593ec5fcb84c7386da952aeb3"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jedr Blaszyk <[email protected]>
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 v8.14.0 v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants