mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-04-12 00:00:26 +08:00
Merge pull request #63565 from roycaihw/bump-kube-openapi-dep
Automatic merge from submit-queue (batch tested with PRs 59034, 63565, 63533). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Bump kube-openapi dependency picks: https://github.com/kubernetes/kube-openapi/pull/67 ref: https://github.com/kubernetes/kubernetes/issues/63494 **Release note**: ```release-note NONE ``` Kubernetes-commit: 3663dc757e05fb79f23a14ad4f2ba832d6e5962c
This commit is contained in:
+11
-6
@@ -73,7 +73,6 @@ var (
|
||||
mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
|
||||
stringType = reflect.TypeOf(string(""))
|
||||
int64Type = reflect.TypeOf(int64(0))
|
||||
uint64Type = reflect.TypeOf(uint64(0))
|
||||
float64Type = reflect.TypeOf(float64(0))
|
||||
boolType = reflect.TypeOf(bool(false))
|
||||
fieldCache = newFieldsCache()
|
||||
@@ -438,13 +437,15 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte
|
||||
}
|
||||
|
||||
// DeepCopyJSON deep copies the passed value, assuming it is a valid JSON representation i.e. only contains
|
||||
// types produced by json.Unmarshal().
|
||||
// types produced by json.Unmarshal() and also int64.
|
||||
// bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil
|
||||
func DeepCopyJSON(x map[string]interface{}) map[string]interface{} {
|
||||
return DeepCopyJSONValue(x).(map[string]interface{})
|
||||
}
|
||||
|
||||
// DeepCopyJSONValue deep copies the passed value, assuming it is a valid JSON representation i.e. only contains
|
||||
// types produced by json.Unmarshal().
|
||||
// types produced by json.Unmarshal() and also int64.
|
||||
// bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil
|
||||
func DeepCopyJSONValue(x interface{}) interface{} {
|
||||
switch x := x.(type) {
|
||||
case map[string]interface{}:
|
||||
@@ -591,10 +592,14 @@ func toUnstructured(sv, dv reflect.Value) error {
|
||||
dv.Set(reflect.ValueOf(sv.Int()))
|
||||
return nil
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(uint64Type))
|
||||
uVal := sv.Uint()
|
||||
if uVal > math.MaxInt64 {
|
||||
return fmt.Errorf("unsigned value %d does not fit into int64 (overflow)", uVal)
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.Uint()))
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(int64Type))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(int64(uVal)))
|
||||
return nil
|
||||
case reflect.Float32, reflect.Float64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
|
||||
Reference in New Issue
Block a user