mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
vendor updates
This commit is contained in:
3
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD
generated
vendored
3
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD
generated
vendored
@ -13,8 +13,7 @@ go_test(
|
||||
"testdata/swagger-merge-item.json",
|
||||
"testdata/swagger-precision-item.json",
|
||||
],
|
||||
importpath = "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||
library = ":go_default_library",
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
|
||||
"//vendor/github.com/ghodss/yaml:go_default_library",
|
||||
|
28
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
generated
vendored
@ -423,7 +423,7 @@ func normalizeElementOrder(patch, serverOnly, patchOrder, serverOrder []interfac
|
||||
// scan from the place of last insertion in `right` to the end of `right`,
|
||||
// the place is before the first item that is greater than the item we want to insert.
|
||||
// example usage: using server-only items as left and patch items as right. We insert server-only items
|
||||
// to patch list. We use the order of live object as record for comparision.
|
||||
// to patch list. We use the order of live object as record for comparison.
|
||||
func mergeSortedSlice(left, right, serverOrder []interface{}, mergeKey string, kind reflect.Kind) []interface{} {
|
||||
// Returns if l is less than r, and if both have been found.
|
||||
// If l and r both present and l is in front of r, l is less than r.
|
||||
@ -1322,23 +1322,23 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
|
||||
// If they're both maps or lists, recurse into the value.
|
||||
switch originalType.Kind() {
|
||||
case reflect.Map:
|
||||
subschema, patchMeta, err := schema.LookupPatchMetadataForStruct(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
subschema, patchMeta, err2 := schema.LookupPatchMetadataForStruct(k)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
original[k], err = mergeMapHandler(original[k], patchV, subschema, patchStrategy, mergeOptions)
|
||||
case reflect.Slice:
|
||||
subschema, patchMeta, err := schema.LookupPatchMetadataForSlice(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
subschema, patchMeta, err2 := schema.LookupPatchMetadataForSlice(k)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
original[k], err = mergeSliceHandler(original[k], patchV, subschema, patchStrategy, patchMeta.GetPatchMergeKey(), isDeleteList, mergeOptions)
|
||||
default:
|
||||
@ -2109,7 +2109,7 @@ func sliceTypeAssertion(original, patch interface{}) ([]interface{}, []interface
|
||||
}
|
||||
|
||||
// extractRetainKeysPatchStrategy process patch strategy, which is a string may contains multiple
|
||||
// patch strategies seperated by ",". It returns a boolean var indicating if it has
|
||||
// patch strategies separated by ",". It returns a boolean var indicating if it has
|
||||
// retainKeys strategies and a string for the other strategy.
|
||||
func extractRetainKeysPatchStrategy(strategies []string) (bool, string, error) {
|
||||
switch len(strategies) {
|
||||
|
15
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go
generated
vendored
15
vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go
generated
vendored
@ -654,6 +654,21 @@ mergingIntList:
|
||||
ExpectedError: "doesn't match",
|
||||
},
|
||||
},
|
||||
{
|
||||
Description: "missing merge key should error out",
|
||||
StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
|
||||
Original: []byte(`
|
||||
mergingList:
|
||||
- name: 1
|
||||
value: a
|
||||
`),
|
||||
TwoWay: []byte(`
|
||||
mergingList:
|
||||
- value: b
|
||||
`),
|
||||
ExpectedError: "does not contain declared merge key",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestCustomStrategicMergePatch(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user