@@ -12,24 +12,38 @@ Ordering has semantic meaning for Environment variables,
12
12
as later environment variables may reference earlier environment variables,
13
13
but not the other way around.
14
14
15
- An use case is the environment variables. We don't preserve the order which causes
15
+ One use case is the environment variables. We don't preserve the order which causes
16
16
issue [ 40373] ( https://github.com/kubernetes/kubernetes/issues/40373 ) .
17
17
18
18
## Proposed Change
19
19
20
20
Changes are all in strategic merge patch package.
21
21
The proposed solution is similar to the solution used for deleting elements from lists of primitives.
22
22
23
- Add to the current patch, a directive containing a list of element keys -
23
+ Add to the current patch, a directive ($setElementOrder) containing a list of element keys -
24
24
either the patch merge key, or for primitives the value. When applying the patch,
25
- the server we ensure that the relative ordering of elements matches the directive.
25
+ the server ensures that the relative ordering of elements matches the directive.
26
+
27
+ Here is an simple example:
28
+
29
+ Suppose we have a type called list. The patch will look like below.
30
+ The order from the parallel list ($setElementOrder/list) will be respected.
31
+
32
+ ``` yaml
33
+ $setElementOrder/list :
34
+ - A
35
+ - B
36
+ list :
37
+ - B
38
+ - A
39
+ ` ` `
26
40
27
41
All the items in the server's live list but not in the parallel list will be append to the end of the parallel list.
28
42
The relative order between these appended items are kept.
29
- If the relative order of live config in the server is different from the order of the parallel list,
30
- user's patch will always override the order in the server.
43
+ If the relative order of the live config in the server is different from the order of the parallel list,
44
+ the user's patch will always override the order in the server.
31
45
32
- The patched list will looks like:
46
+ The patched list will look like:
33
47
34
48
` ` `
35
49
mergingList :
@@ -144,8 +158,9 @@ list:
144
158
The new version patch is always a superset of the old version patch.
145
159
The new patch has one additional parallel list which will be dropped by the old server.
146
160
147
- The logic for old version patch is still kept,
148
- so the patch from any arbitrary old clients used to work before will continue to function.
161
+ The new directive is optional.
162
+ Patch requests without the directive will retain the behavior from previous releases.
163
+ This will ensure backward compatibility with old clients.
149
164
150
165
This change is fully backward compatible.
151
166
0 commit comments