Commit 82245a1f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45980 from mengqiy/setElementOrder

Automatic merge from submit-queue support setElementOrder Implement [proposal](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/preserve-order-in-strategic-merge-patch.md). Fixes #40373 ```release-note kubectl edit and kubectl apply will keep the ordering of elements in merged lists ```
parents d3554ac0 c3481b07
{ {
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 82
"port": 81 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 82, "port": 82,
"protocol": "TCP", "protocol": "TCP",
"targetPort": 80 "targetPort": 80
},
{
"$patch": "delete",
"port": 81
} }
] ]
} }
......
{ {
"spec": { "spec": {
"$setElementOrder/ports": [
{
"port": 82
}
],
"clusterIP": "10.0.0.10", "clusterIP": "10.0.0.10",
"ports": [ "ports": [
{ {
......
...@@ -5,16 +5,21 @@ ...@@ -5,16 +5,21 @@
} }
}, },
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 83
"port": 82 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 83, "port": 83,
"protocol": "VHF", "protocol": "VHF",
"targetPort": 81 "targetPort": 81
},
{
"$patch": "delete",
"port": 82
} }
] ]
} }
......
...@@ -5,16 +5,21 @@ ...@@ -5,16 +5,21 @@
} }
}, },
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 83
"port": 82 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 83, "port": 83,
"protocol": "TCP", "protocol": "TCP",
"targetPort": 81 "targetPort": 81
},
{
"$patch": "delete",
"port": 82
} }
] ]
} }
......
...@@ -8,16 +8,21 @@ ...@@ -8,16 +8,21 @@
} }
}, },
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 82
"port": 81 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 82, "port": 82,
"protocol": "TCP", "protocol": "TCP",
"targetPort": 81 "targetPort": 81
},
{
"$patch": "delete",
"port": 81
} }
] ]
} }
......
...@@ -5,16 +5,21 @@ ...@@ -5,16 +5,21 @@
} }
}, },
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 82
"port": 81 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 82, "port": 82,
"protocol": "TCP", "protocol": "TCP",
"targetPort": 81 "targetPort": 81
},
{
"$patch": "delete",
"port": 81
} }
] ]
} }
......
...@@ -5,16 +5,21 @@ ...@@ -5,16 +5,21 @@
} }
}, },
"spec": { "spec": {
"ports": [ "$setElementOrder/ports": [
{ {
"$patch": "delete", "port": 81
"port": 80 }
}, ],
"ports": [
{ {
"name": "80", "name": "80",
"port": 81, "port": 81,
"protocol": "TCP", "protocol": "TCP",
"targetPort": 80 "targetPort": 80
},
{
"$patch": "delete",
"port": 80
} }
] ]
} }
......
...@@ -27,6 +27,7 @@ var ( ...@@ -27,6 +27,7 @@ var (
ErrNoListOfLists = errors.New("lists of lists are not supported") ErrNoListOfLists = errors.New("lists of lists are not supported")
ErrBadPatchFormatForPrimitiveList = errors.New("invalid patch format of primitive list") ErrBadPatchFormatForPrimitiveList = errors.New("invalid patch format of primitive list")
ErrBadPatchFormatForRetainKeys = errors.New("invalid patch format of retainKeys") ErrBadPatchFormatForRetainKeys = errors.New("invalid patch format of retainKeys")
ErrBadPatchFormatForSetElementOrderList = errors.New("invalid patch format of setElementOrder list")
ErrPatchContentNotMatchRetainKeys = errors.New("patch content doesn't match retainKeys list") ErrPatchContentNotMatchRetainKeys = errors.New("patch content doesn't match retainKeys list")
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment