-
Notifications
You must be signed in to change notification settings - Fork 38
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
OCPCLOUD-2500: Update to recognize both upstream and openshift ScaleFromZero annotations #335
base: master
Are you sure you want to change the base?
Conversation
@racheljpg: This pull request references OCPCLOUD-2500 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
Skipping CI for Draft Pull Request. |
Hey @elmiko, just wanted to make a small PR early - is this along the lines of what you were thinking? Thanks! |
10e2b62
to
f76c1b2
Compare
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils_test.go
Outdated
Show resolved
Hide resolved
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils.go
Outdated
Show resolved
Hide resolved
b43d21a
to
12f347c
Compare
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils_test.go
Outdated
Show resolved
Hide resolved
953ddc2
to
1245144
Compare
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.
left a few cleanup comments and a suggestion for the failing unit test. this is looking good though, very close to ready.
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils.go
Outdated
Show resolved
Hide resolved
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils_test.go
Outdated
Show resolved
Hide resolved
49b595c
to
a448aa8
Compare
i think this is looking good, let's wait to see how the tests go then i'm happy to add an approve. let's get someone else to review as well if we can. |
/retest |
Updating the value of the
Is it me, or are these values the same? 😬 Will look deeper into updating this suite, but @elmiko (and maybe @JoelSpeed) any thoughts, when you have a moment? :) Thanks! |
// Checking both sets of annotations. If the upstream annotation doesn't exist, | ||
// get the value of the deprecated one. If neither exist, return nil. | ||
if val, err := parseKey(annotations, cpuKey); val != zeroQuantity && err == nil { | ||
return val, err |
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.
If err is nil here, return nil explicitly please
return val, err | |
return val, nil |
if val, err := parseKey(annotations, cpuKey); val != zeroQuantity && err == nil { | ||
return val, err | ||
} else if err != nil { | ||
return zeroQuantity.DeepCopy(), err |
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.
Can we wrap the error with context to make it easy to find which line produced the error?
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.
Thanks - did some tidying up on the errors being returned
the test failures are happening due to our corrections for the original upstream unit test, https://github.com/openshift/kubernetes-autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured_test.go#L379-L382 if we remove the logic that converts the mem value to bytes then it will work properly. |
this made it work
|
0822cdd
to
20bfa3e
Compare
Thanks @elmiko, that's fixed it for the upstream annotation - but after updating the units so that they test both sets of annotations, it's still failing for the same reason with the downstream value, so the problem has just moved 😬 |
t.Fatal(err) | ||
} else if deprecatedMemQuantityAsBytes.Cmp(deprecatedMem) != 0 { | ||
t.Errorf("expected %v, got %v", deprecatedMemQuantity, deprecatedMem) | ||
} */ |
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.
@elmiko I am talking about here! it's still failing with expected {i:{value:1024 scale:0} d:{Dec:<nil>} s:1024 Format:DecimalSI}, got {i:{value:1024 scale:0} d:{Dec:<nil>} s:1024 Format:DecimalSI}
. Going to step away from it briefly and take a look again shortly
20bfa3e
to
86e5935
Compare
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.
i think this looks good, i inspected the test failures and they don't seem to be related to this change.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: elmiko 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 |
@racheljpg: The following tests failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
if val, err := parseKey(annotations, cpuKey); val != zeroQuantity && err == nil { | ||
return val, nil | ||
} else if err != nil { | ||
//return zeroQuantity.DeepCopy(), err |
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.
Why is this a comment? I think you meant to remove it
// Checking both sets of annotations. If the upstream annotation doesn't exist, | ||
// get the value of the deprecated one. If neither exist, return nil. | ||
if val, err := parseKey(annotations, memoryKey); val != zeroQuantity && err == nil { | ||
return val, err |
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.
Err should be nil here
What type of PR is this?
What this PR does / why we need it:
Hello! This is a PR to update the autoscaler to recognize both the upstream and openshift ScaleFromZero annotations, while favouring the upstream annotations if they exist. Thanks!
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: