-
Notifications
You must be signed in to change notification settings - Fork 23
Adding EventInvokeConfig
support for Function
#92
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
Adding EventInvokeConfig
support for Function
#92
Conversation
/retest |
/test all |
92e8ba0
to
7bd9c3c
Compare
test/e2e/tests/helper.py
Outdated
try: | ||
resp = self.lambda_client.get_function_event_invoke_config( | ||
FunctionName = function_name, | ||
# Qualifier = qualifier | ||
) | ||
return resp | ||
except Exception as e: | ||
logging.debug(e) | ||
return None | ||
|
||
def function_event_invoke_config_exists(self, function_name: str) -> bool: | ||
return self.get_function_event_invoke_config(function_name) is not None |
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.
@Vandita2020 I suggest to test get_function_event_invoke_config
and see how it works - i don't see any specific errors returned by the controller.
Also another route, would be to test the controller locally and see what are the function status.Conditions
when you try to set an EventInvokeConfig
a1c0864
to
758d323
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.
Nice work on this @Vandita2020! Left few comments bellow
test/e2e/service_bootstrap.py
Outdated
), | ||
EICQueueOnSuccess=Queue( | ||
"ack-lambda-controller-queue" |
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.
Should we change this to ack-lambda-controller-function-queue-eic-onsuccess
? and apply same logic for the on failure?
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
test/e2e/tests/test_function.py
Outdated
k8s.patch_custom_resource(ref, cr) | ||
time.sleep(UPDATE_WAIT_AFTER_SECONDS) | ||
|
||
#Check function_snapstart update fields |
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.
#Check function_snapstart update fields | |
#Check function_event_invoke_config |
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.
Oops, corrected it.
reservedConcurrentExecutions: $RESERVED_CONCURRENT_EXECUTIONS | ||
codeSigningConfigARN: "$CODE_SIGNING_CONFIG_ARN" |
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 you're not using this fields you can just remove them and remove the replacements in the pytest as well
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
@@ -547,6 +601,43 @@ func (rm *resourceManager) setResourceAdditionalFields( | |||
} | |||
ko.Spec.ReservedConcurrentExecutions = getFunctionConcurrencyOutput.ReservedConcurrentExecutions | |||
|
|||
var getFunctionEventInvokeConfigOutput *svcsdk.GetFunctionEventInvokeConfigOutput |
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: in the future we can split this function into 3 different functions...
go_version: go1.19 | ||
version: v0.26.1 | ||
api_directory_checksum: a9fcef68210dd72b4b2e37052f2c1a9e971326c6 | ||
version: v0.25.0-9-g811e30b-dirty |
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 you regenerate this using code-generator@v0.26.1
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.
Also we might want to bring your changes to code-generator before merging this
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.
Opened a PR for code-generator
We need the code-generator PR to be merged first |
6aa894b
to
b3403ba
Compare
@Vandita2020: The following test 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/test-infra repository. I understand the commands that are listed here. |
aef1d8c
to
7a3d4e4
Compare
Issue #, if available: This PR is created to support the code-generation for `FunctionEventInvokeConfig` feature in lambda-controller. [PR#92](aws-controllers-k8s/lambda-controller#92) Description of changes: This PR adds functionality to assign whole object to a field, instead of assigning a particular parameter of it. To clarify it further, in the below code, we created a new field `LayerStatuses` which stores the value of `Configuration.Layers` parameter taken from `GetFunction` operation. ``` LayerStatuses: from: operation: GetFunction path: Configuration.Layers ``` In our case we needed to add `FunctionEventInvokeConfig` as an inline property to `Function` resource, for which we needed to assign the whole object returned by `PutFunctionEventInvokeConfig` operation to field `FunctionEventInvokeConfig`. To make this work we added a new condition for it by passing `path` value as `.` , shown below: ``` FunctionEventInvokeConfig: from: operation: PutFunctionEventInvokeConfig path: . ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
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
EventInvokeConfig
EventInvokeConfig
support for Function
aba6123
to
c29968b
Compare
c29968b
to
2f55003
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.
Nice, thank you @Vandita2020
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, RedbackThomson, 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 |
/unhold |
…s#92) Issue #, if available: **Summary** Adding support to configure `EventInvokeConfig` for a `function` in ACK. **Description** This PR adds support for `EventInvokeConfig` permitted by Lambda API operations in ACK. To implement this functionality I added `EventInvokeConfig` as an inline property to a `function`. Thus the user can directly set configurations for async invocation (EventInvokeConfig) while creating a function. The user can edit the following code to create `eventInvokeConfig` along with `function`. ``` apiVersion: lambda.services.k8s.aws/v1alpha1 kind: Function metadata: name: $FUNCTION_NAME annotations: services.k8s.aws/region: $AWS_REGION spec: name: $FUNCTION_NAME code: s3Bucket: $BUCKET_NAME s3Key: $LAMBDA_FILE_NAME functionEventInvokeConfig: destinationConfig: onSuccess: destination: $ON_SUCCESS_DESTINATION onFailure: destination: $ON_FAILURE_DESTINATION maximumEventAgeInSeconds: $MAXIMUM_EVENT_AGE_IN_SECONDS maximumRetryAttempts: $MAXIMUM_RETRY_ATTEMPTS role: $LAMBDA_ROLE runtime: python3.9 handler: main description: function created by ACK lambda-controller e2e tests ``` This PR includes both implementation code and e2e tests. **Acknowledgement** By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: Related PR: #92 #93 **Summary** Fixing deletion part for `EventInvokeConfig` field. **Description:** This PR is related to bug fixes in [previous PR](#97) related to `EventInvokeConfig` implementation. When the user deleted the set configurations for Function/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 `EventInvokeConfig` in Alias resource is given below: ``` if r.ko.Spec.FunctionEventInvokeConfig == nil { input_delete := &svcsdk.DeleteFunctionEventInvokeConfigInput{ FunctionName: aws.String(*r.ko.Spec.FunctionName), Qualifier: aws.String(*r.ko.Spec.Name), } _, err = rm.sdkapi.DeleteFunctionEventInvokeConfigWithContext(ctx, input_delete) rm.metrics.RecordAPICall("DELETE", "DeleteFunctionEventInvokeConfig", err) if err != nil { return nil, err } return r, nil } ``` 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.
Issue #, if available:
Summary
Adding support to configure
EventInvokeConfig
for afunction
in ACK.Description
This PR adds support for
EventInvokeConfig
permitted by Lambda API operations in ACK. To implement this functionality I addedEventInvokeConfig
as an inline property to afunction
. Thus the user can directly set configurations for async invocation (EventInvokeConfig) while creating a function. The user can edit the following code to createeventInvokeConfig
along withfunction
.This PR includes both implementation code and e2e tests.
Acknowledgement
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.