-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kong ensures the backward compatibility through the logic of `remove_fields` that CP with higher verion can removes fields which are not supported by DPs in lower version before sending the configuration to DPs. In detail, CP checks the version reporting by DP. If the version from DP is less than the version defined in `remove_fields`, the fields will be removed. So the logic is just a simple comparison. **Issue:** This logic works well for most of the cases. However, after serval backports to various version series, the comparsion should become more complex as there would be several incontinous ranges where the fields should be removed due to multiple backports. **Solution:** In this PR, a lower bound is added to the comparison when necessary rather than only a upper bound previously. The new logic is that the comparison should punch through the range of the minor version for the earliest version since the field is supported, otherwise, the comparsion should be limited with the range of minor version. **Example** Let say a new field is initially introduced since 3.7.7. At this monent, an entry defined in `removed_fields.lua` should be: ``` -- Any dataplane older than 3.7.7 [3007007000] = { some_plugin = { "new_field", }, }, ``` And then it is backported into 3.5.5, 3.6.6. After that, the ranges where it's going to be removed or not turns into the followings: - (-infinite, 3.5.5 ), remove - [ 3.5.5, 3.6.0 ), don't remove - [ 3.6.0, 3.6.6 ), remove - [ 3.6.6, 3.7.0 ), don't remove - [ 3.7.0, 3.7.7 ), remove - [ 3.7.7, +infinite), don't remove At this monent, in terms of the new logic, the `removed_fields.lua` should be: ``` -- Any dataplane older than 3.5.5 [3005005000] = { some_plugin = { "new_field", }, }, -- Any dataplane older than 3.6.6 [3006006000] = { some_plugin = { "new_field", }, }, -- Any dataplane older than 3.7.7 [3007007000] = { some_plugin = { "new_field", }, }, ``` The comparsion should be `dp_version < 3005005000` for the first entry as it is the earliest version it is supported and it should punch through the minor version. The other two comparsions should be: `dp_version < 3006006000 and dp_version >= 3006000000` and `dp_version < 3007007000 and dp_version >= 3007000000` respectively as it is not the earliest version it is supported and the comparison should be limited within the minor version. With the help of this change, the `removed_fields.lua` can be consistent across version series, and we can easily append a new entry correspondingly when there is a backport.
- Loading branch information
1 parent
58fc97d
commit 7fccf6e
Showing
3 changed files
with
115 additions
and
77 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