-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow updating entities' IDs while keeping their names
This adds an additional step to the diff.Syncer's diff producer - deleteDuplicates. Its purpose is to clean up the entities in the current state that have duplicates with the same names in the target state before proceeding with updates/creates and regular deletes. Without that additional step, it's not possible to perform sync in which the IDs of entities are changed while their names are kept between syncs. An actual use-case that is the motivation for this change is Kong Ingress Controller where we recently started assigning entities' IDs explicitly. Without this change, existing setups break when KIC is upgraded from the version not setting the IDs to the new one because of breaking the uniqueness constraints of Services, Routes, and Consumers. The added test cases represent the complete use case with all the affected entities: Services, Routes, and Consumers. We change their IDs, keeping the names and we expect the final state on the Kong side to be using the new IDs.
- Loading branch information
Showing
12 changed files
with
560 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/integration/testdata/sync/020-same-names-altered-ids/1-before.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
_format_version: "3.0" | ||
services: | ||
- id: 18076db2-28b6-423b-ba39-a797193017f7 # Changing ID, | ||
name: s1 # leaving the same name. | ||
host: "mockbin.org" | ||
routes: | ||
- id: 17b6a97e-f3f7-4c47-857a-7464cb9e202b # Changing ID, | ||
name: r1 # leaving the same name. | ||
paths: | ||
- /r1 | ||
consumers: | ||
- id: 5a1e49a8-2536-41fa-a4e9-605bf218a4fa # Changing ID, | ||
username: c1 # leaving the same name. | ||
plugins: | ||
- name: rate-limiting | ||
config: | ||
second: 1 | ||
service: s1 | ||
- name: rate-limiting | ||
config: | ||
second: 1 | ||
route: r1 | ||
- name: rate-limiting | ||
config: | ||
second: 1 | ||
consumer: c1 |
Oops, something went wrong.