mirror of https://github.com/kubernetes/kops.git
Allow overriding uint values
This commit is contained in:
parent
cad5b69446
commit
d70e6803b4
|
@ -161,6 +161,24 @@ func setType(v reflect.Value, newValue string) error {
|
||||||
default:
|
default:
|
||||||
panic("missing case in switch")
|
panic("missing case in switch")
|
||||||
}
|
}
|
||||||
|
case "uint64", "uint32", "uint":
|
||||||
|
v, err := strconv.Atoi(newValue)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot interpret %q value as unsigned integer", newValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch t {
|
||||||
|
case "uint":
|
||||||
|
newV = reflect.ValueOf(v)
|
||||||
|
case "uint32":
|
||||||
|
v32 := uint32(v)
|
||||||
|
newV = reflect.ValueOf(v32)
|
||||||
|
case "uint64":
|
||||||
|
v64 := uint64(v)
|
||||||
|
newV = reflect.ValueOf(v64)
|
||||||
|
default:
|
||||||
|
panic("missing case in switch")
|
||||||
|
}
|
||||||
case "intstr.IntOrString":
|
case "intstr.IntOrString":
|
||||||
newV = reflect.ValueOf(intstr.Parse(newValue))
|
newV = reflect.ValueOf(intstr.Parse(newValue))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue