-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AzureMachinePool/AzureMachine spot instances max price failing to serialize when using the client #1157
Fix AzureMachinePool/AzureMachine spot instances max price failing to serialize when using the client #1157
Conversation
…otVMOptions.MaxPrice property By using a quantity type, which is a fixed-point representation of a number, we are able to not lose precision when serializing floats. Also, when applying CRs directly, we have the liberty to use stringified floats, as well as integers or the quantity serialization format.
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Welcome @axbarsan! |
Hi @axbarsan. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I signed it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
/cc @JoelSpeed
apidiff:
|
/retest |
^ Not sure what to do at this point 😅 Is this fine? |
@axbarsan yes, the apidiff test is non-blocking. It helps reviewers catch breaking changes. In this case it's a change we want. I wonder if we should mark it as breaking in the release notes however. What is the user facing impact and does it break existing resources? |
IPV6 LB flake /retest |
This is 100% a breaking change. I marked it in the notes. |
@axbarsan this PR also changes the AzureMachine SpotVMOptions, let's include that in the commit message/PR title description/action required so it's clear that this change does not only affect machine pools |
I updated it, hope everything's ok 👍🏻 |
@devigned @nader-ziada should we accept this breaking change in v1alpha3 and backport it to 0.4 since the feature it is "breaking" is already broken (and not many users must be using it, if any), or should we stick to protocol and move the change to v1alpha4 (possibly with conversion)? |
I think since it broken we should accept it in v1alpha3 |
/retest |
@axbarsan: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Thank you!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: devigned The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank you for taking care of this so quickly! 🚀 |
description: MaxPrice defines the maximum price the user is | ||
willing to pay for Spot VM instances | ||
type: number | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm late to the party, but, I wonder if there's any way we can change this so that it only accepts numbers and doesn't allow the textual suffixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axbarsan any reason you chose to allow textual suffixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation was generated automatically after I changed the type to *resource.Quantity
. I believe the reason for alowing textual suffixes is to also allow writing numbers in the "quantity" way, for not losing precision (e.g. 1.5
=> 1500m
)
More info here:
https://github.com/kubernetes/apimachinery/blob/c93b0f84892eb6bcbc80b312ae70729d8168bc7e/pkg/api/resource/quantity.go#L69
What type of PR is this?
/kind bug
What this PR does / why we need it:
Previously, when trying to deploy a
AzureMachinePool
(orAzureMachine
) resource via the Go client, with spot instances enabled, and a set maximum price, you would get a validation error (please check the issue for more information).This PR changes the type of the
AzureMachinePool.SpotVMOptions.MaxPrice
property to theapimachinery/pkg/resource
*Quantity
type.By using this type we are able to not lose precision when serializing float values, and also able to deploy the resource by applying the CR template, or by using the Go client. You can read more about the type here.
If we're applying a CR template, we can either specify the
maxPrice
property by using a stringified float value ("0.1"
), an integer (1
), or by usingresource.Quantity
's serialization format (100m
).The only drawback is that if we try to specify a float value in the YAML template, we need to put the value in between quotes.
Which issue(s) this PR fixes:
Fixes #1151
Special notes for your reviewer:
Please let me know if there's a better way to achieve this. Thank you.
TODOs:
Release note: