/kind bug
What steps did you take and what happened:
Trying to apply an AzureMachinePool that uses spot instances and has a maximum price of 0.01.
While templating and applying the following AzureMachinePool resource via kubectl apply, everything works as expected.
'AzureMachinePool' resource
apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3
kind: AzureMachinePool
metadata:
creationTimestamp: null
labels:
cluster.x-k8s.io/cluster-name: qqb7s
name: 4sgq9
namespace: adrian-test
spec:
location: ""
template:
osDisk:
diskSizeGB: 0
managedDisk:
storageAccountType: ""
osType: ""
sshPublicKey: ""
vmSize: Standard_D4s_v3
spotVMOptions:
maxPrice: 0.01
status:
ready: false
replicas: 0
However, if I'm trying to fetch that resource using the Go controller-runtime client (v0.6.3), I get the
following error:
v1alpha3.AzureMachineTemplate.SpotVMOptions: v1alpha3.SpotVMOptions.MaxPrice: ReadString: expects " or n, but found 0
Also, if I want to apply a resource using the same configuration, but using the CAPZ types and the controller-runtime client, I get the following error:
AzureMachinePool.exp.infrastructure.cluster.x-k8s.io "4sgq9" is invalid: spec.template.spotVMOptions.maxPrice: Invalid value: "string": spec.template.spotVMOptions.maxPrice in body must be of type number: "string"
What did you expect to happen:
I expect to be able to apply and fetch the resource in the same way using the Go client as I do by writing/templating the CRD.
Anything else you would like to add:
The field maxPrice in the AzureMachinePool CRD is of type number, but in the Go CAPZ types, it it is a string pointer, that has number validation.
This can be solved by using a *resource.Quantity type in the Go code.
If you agree that this is an issue that needs fixing, I can do the implementation right away.
Environment:
kubectl version): 1.18.10 Server / 1.19.3 Client/etc/os-release): macOS 11.1If you agree that this is an issue that needs fixing, I can do the implementation right away.
Yes, please go for it
/assign @axbarsan
/cc @JoelSpeed - fyi, other providers might have the same issue
Most helpful comment
Yes, please go for it
/assign @axbarsan
/cc @JoelSpeed - fyi, other providers might have the same issue