-
Notifications
You must be signed in to change notification settings - Fork 23
Bug fix for ProvisionedConcurrency
#106
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
Bug fix for ProvisionedConcurrency
#106
Conversation
aa2a5e7
to
c4c0fc4
Compare
ProvisionedConcurrency
and FunctionEventInvokeConfig
ProvisionedConcurrency
test/e2e/tests/test_function.py
Outdated
@@ -395,7 +395,7 @@ def test_function_package_type_image_with_signing_config(self, lambda_client): | |||
|
|||
time.sleep(UPDATE_WAIT_AFTER_SECONDS) | |||
|
|||
cr = k8s.wait_resource_consumed_by_controller(ref) | |||
# cr = k8s.wait_resource_consumed_by_controller(ref) |
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.
Is this okay to be commented out?
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.
Yes, this line of code waits for resource to be consumed after update and store the new status in "cr". We are doing the same thing in Line 407 too. The idea is when the first update is made, we wait and let the controller consume the resource, save the new status in cr
and use it for second update. Either of the place for this line of code would work fine. I just chose to do it right before moving for the second update. Keeping both increases the time of execution and lead to timeout while running the tests.
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 see. In that case, we should delete one instead of commenting 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.
Done
pkg/resource/alias/hooks.go
Outdated
// To set Asynchronous Invocations for the function's alias | ||
err = rm.getFunctionEventInvokeConfig(ctx, ko) | ||
if err != nil { | ||
return 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.
I guess this change doesn't belong into this PR, because it's related to event invoke config. Either we put everything together in one PR, or we actually split in two (both the changes to this file are added in both PRs)
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.
This change was just regarding changing the name of eic_err
and pc_err
field to err
, that's why I made changes for both. I can leave it the same for EventInvokeConfig
in this PR and change only for ProvisionedConcurrency
.
pkg/resource/alias/hooks.go
Outdated
@@ -183,6 +204,8 @@ func (rm *resourceManager) getFunctionEventInvokeConfig( | |||
return nil | |||
} | |||
|
|||
// setResourceAdditionalFields will describe the fields that are not return by |
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 the comment would be more accurate if it said ".. the fields that are not returned by the getFunctionConfiguration API call" (Considering that the info here is still returned by API calls)
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, that makes more sense.
7481094
to
9a6243c
Compare
e76aa73
to
0402545
Compare
test/e2e/tests/test_function.py
Outdated
@@ -395,7 +395,6 @@ def test_function_package_type_image_with_signing_config(self, lambda_client): | |||
|
|||
time.sleep(UPDATE_WAIT_AFTER_SECONDS) | |||
|
|||
cr = k8s.wait_resource_consumed_by_controller(ref) |
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.
nit: we don't need to remove this. Maybe it's safer to keep it?
pkg/resource/alias/hooks.go
Outdated
} | ||
} else { | ||
input.ProvisionedConcurrentExecutions = aws.Int64(0) | ||
if dspec.ProvisionedConcurrencyConfig.ProvisionedConcurrentExecutions != nil { |
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.
What if the user sets dspec.ProvisionedConcurrencyConfig.ProvisionedConcurrentExecutions
to nil ? is that equivalent to setting the value to 0 or 1, or maybe delete it fully ?
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 the user sets ProvisionedConcurrency to 1, they will get the error as ProvisionedConcurrency must be greater than 1. For nil, I added the condition along with nil checking for ProvisionedConcurrency
in the beginning of the updateProvisionedConcurrency
function.
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.
Since you added if desired.ko.Spec.ProvisionedConcurrencyConfig == nil || desired.ko.Spec.ProvisionedConcurrencyConfig.ProvisionedConcurrentExecutions == nil {
can we remove this if
statement now?
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.
Done
func (rm *resourceManager) getProvisionedConcurrencyConfig( | ||
// setProvisionedConcurrencyConfig sets the Provisioned Concurrency | ||
// for the Function's Alias | ||
func (rm *resourceManager) setProvisionedConcurrencyConfig( |
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.
Good function rename
68c25de
to
d7d9d0a
Compare
d7d9d0a
to
cc53cbb
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.
Thanks a lot @Vandita2020! & @valerena !
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, valerena, Vandita2020 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 |
Issue #, if available:
Related PR: #97
Summary
Fixing deletion part for
ProvisionedConcurrency
field.Description:
This PR is related to bug fixes in previous PR related to
ProvisionedConcurrency
implementation. When the user deleted the set configurations for Alias resource, the configurations were not deleted from the Console side, instead it used to throw an error. Fixed the bug by introducing a new condition to check if the desired configurations are nil or not, if yes then call the delete API.Example of changes for
ProvisionedConcurrency
in Alias resource is given below:This PR contains implementation code and E2E test to validate the changes.
Acknowledgment
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.