Skip to content

Commit f18794e

Browse files
authored
Adding EventInvokeConfig support for Alias (#93)
Issue #, if available: **Summary** Adding support to configure EventInvokeConfig for alias 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 `alias`. Thus the user can directly set configurations for async invocation (EventInvokeConfig) while creating alias. The user can edit the following code to create `eventInvokeConfig` along with `alias`. ``` apiVersion: lambda.services.k8s.aws/v1alpha1 kind: Alias metadata: name: $ALIAS_NAME annotations: services.k8s.aws/region: $AWS_REGION spec: name: $ALIAS_NAME functionName: $FUNCTION_NAME functionVersion: $FUNCTION_VERSION functionEventInvokeConfig: destinationConfig: onSuccess: destination: $ON_SUCCESS_DESTINATION onFailure: destination: $ON_FAILURE_DESTINATION maximumEventAgeInSeconds: $MAXIMUM_EVENT_AGE_IN_SECONDS maximumRetryAttempts: $MAXIMUM_RETRY_ATTEMPTS description: alias 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.
1 parent beba0f9 commit f18794e

21 files changed

+524
-11
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-06-27T22:12:27Z"
2+
build_date: "2023-06-28T18:32:11Z"
33
build_hash: e9b68590da73ce9143ba1e4361cebdc1d876c81e
44
go_version: go1.19
55
version: v0.26.1-7-ge9b6859
6-
api_directory_checksum: 5326aa7650a3899230ee809563bea350169fdca4
6+
api_directory_checksum: 5f162746e8495943dae5e96f48f4a3ab887b5be5
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.181
99
generator_config_info:
10-
file_checksum: a9fdc0888330c561da4bf5f21d0f5afe48217935
10+
file_checksum: ed4abfc994c2c47465801d301604c584bd743d41
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/alias.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/function.go

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ resources:
102102
path: Spec.Name
103103
FunctionVersion:
104104
is_required: true
105+
FunctionEventInvokeConfig:
106+
from:
107+
operation: PutFunctionEventInvokeConfig
108+
path: .
109+
hooks:
110+
sdk_update_pre_build_request:
111+
template_path: hooks/alias/sdk_update_pre_build_request.go.tpl
112+
sdk_read_one_post_set_output:
113+
template_path: hooks/alias/sdk_read_one_post_set_output.go.tpl
114+
sdk_create_post_set_output:
115+
template_path: hooks/alias/sdk_create_post_set_output.go.tpl
105116
tags:
106117
ignore: true
107118
CodeSigningConfig:

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/lambda.services.k8s.aws_aliases.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,47 @@ spec:
3737
description:
3838
description: A description of the alias.
3939
type: string
40+
functionEventInvokeConfig:
41+
description: "Configures options for asynchronous invocation on an
42+
alias. \n - DestinationConfig A destination for events after they
43+
have been sent to a function for processing. \n Types of Destinations:
44+
Function - The Amazon Resource Name (ARN) of a Lambda function.
45+
Queue - The ARN of a standard SQS queue. Topic - The ARN of a standard
46+
SNS topic. Event Bus - The ARN of an Amazon EventBridge event bus.
47+
\n - MaximumEventAgeInSeconds The maximum age of a request that
48+
Lambda sends to a function for processing. \n - MaximumRetryAttempts
49+
The maximum number of times to retry when the function returns an
50+
error."
51+
properties:
52+
destinationConfig:
53+
description: A configuration object that specifies the destination
54+
of an event after Lambda processes it.
55+
properties:
56+
onFailure:
57+
description: A destination for events that failed processing.
58+
properties:
59+
destination:
60+
type: string
61+
type: object
62+
onSuccess:
63+
description: A destination for events that were processed
64+
successfully.
65+
properties:
66+
destination:
67+
type: string
68+
type: object
69+
type: object
70+
functionName:
71+
type: string
72+
maximumEventAgeInSeconds:
73+
format: int64
74+
type: integer
75+
maximumRetryAttempts:
76+
format: int64
77+
type: integer
78+
qualifier:
79+
type: string
80+
type: object
4081
functionName:
4182
description: "The name of the Lambda function. \n Name formats \n
4283
* Function name - MyFunction. \n * Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

config/crd/bases/lambda.services.k8s.aws_functions.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ spec:
117117
type: object
118118
type: array
119119
functionEventInvokeConfig:
120+
description: "Configures options for asynchronous invocation on a
121+
function. \n - DestinationConfig A destination for events after
122+
they have been sent to a function for processing. \n Types of Destinations:
123+
Function - The Amazon Resource Name (ARN) of a Lambda function.
124+
Queue - The ARN of a standard SQS queue. Topic - The ARN of a standard
125+
SNS topic. Event Bus - The ARN of an Amazon EventBridge event bus.
126+
\n - MaximumEventAgeInSeconds The maximum age of a request that
127+
Lambda sends to a function for processing. \n - MaximumRetryAttempts
128+
The maximum number of times to retry when the function returns an
129+
error."
120130
properties:
121131
destinationConfig:
122132
description: A configuration object that specifies the destination

documentation.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
resources:
2+
Function:
3+
fields:
4+
FunctionEventInvokeConfig:
5+
prepend: |
6+
Configures options for asynchronous invocation on a function.
7+
8+
- DestinationConfig
9+
A destination for events after they have been sent to a function for processing.
10+
11+
Types of Destinations:
12+
Function - The Amazon Resource Name (ARN) of a Lambda function.
13+
Queue - The ARN of a standard SQS queue.
14+
Topic - The ARN of a standard SNS topic.
15+
Event Bus - The ARN of an Amazon EventBridge event bus.
16+
17+
- MaximumEventAgeInSeconds
18+
The maximum age of a request that Lambda sends to a function for processing.
19+
20+
- MaximumRetryAttempts
21+
The maximum number of times to retry when the function returns an error.
22+
Alias:
23+
fields:
24+
FunctionEventInvokeConfig:
25+
prepend: |
26+
Configures options for asynchronous invocation on an alias.
27+
28+
- DestinationConfig
29+
A destination for events after they have been sent to a function for processing.
30+
31+
Types of Destinations:
32+
Function - The Amazon Resource Name (ARN) of a Lambda function.
33+
Queue - The ARN of a standard SQS queue.
34+
Topic - The ARN of a standard SNS topic.
35+
Event Bus - The ARN of an Amazon EventBridge event bus.
36+
37+
- MaximumEventAgeInSeconds
38+
The maximum age of a request that Lambda sends to a function for processing.
39+
40+
- MaximumRetryAttempts
41+
The maximum number of times to retry when the function returns an error.

generator.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ resources:
102102
path: Spec.Name
103103
FunctionVersion:
104104
is_required: true
105+
FunctionEventInvokeConfig:
106+
from:
107+
operation: PutFunctionEventInvokeConfig
108+
path: .
109+
hooks:
110+
sdk_update_pre_build_request:
111+
template_path: hooks/alias/sdk_update_pre_build_request.go.tpl
112+
sdk_read_one_post_set_output:
113+
template_path: hooks/alias/sdk_read_one_post_set_output.go.tpl
114+
sdk_create_post_set_output:
115+
template_path: hooks/alias/sdk_create_post_set_output.go.tpl
105116
tags:
106117
ignore: true
107118
CodeSigningConfig:

helm/crds/lambda.services.k8s.aws_aliases.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,47 @@ spec:
3737
description:
3838
description: A description of the alias.
3939
type: string
40+
functionEventInvokeConfig:
41+
description: "Configures options for asynchronous invocation on an
42+
alias. \n - DestinationConfig A destination for events after they
43+
have been sent to a function for processing. \n Types of Destinations:
44+
Function - The Amazon Resource Name (ARN) of a Lambda function.
45+
Queue - The ARN of a standard SQS queue. Topic - The ARN of a standard
46+
SNS topic. Event Bus - The ARN of an Amazon EventBridge event bus.
47+
\n - MaximumEventAgeInSeconds The maximum age of a request that
48+
Lambda sends to a function for processing. \n - MaximumRetryAttempts
49+
The maximum number of times to retry when the function returns an
50+
error."
51+
properties:
52+
destinationConfig:
53+
description: A configuration object that specifies the destination
54+
of an event after Lambda processes it.
55+
properties:
56+
onFailure:
57+
description: A destination for events that failed processing.
58+
properties:
59+
destination:
60+
type: string
61+
type: object
62+
onSuccess:
63+
description: A destination for events that were processed
64+
successfully.
65+
properties:
66+
destination:
67+
type: string
68+
type: object
69+
type: object
70+
functionName:
71+
type: string
72+
maximumEventAgeInSeconds:
73+
format: int64
74+
type: integer
75+
maximumRetryAttempts:
76+
format: int64
77+
type: integer
78+
qualifier:
79+
type: string
80+
type: object
4081
functionName:
4182
description: "The name of the Lambda function. \n Name formats \n
4283
- Function name - MyFunction. \n - Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

helm/crds/lambda.services.k8s.aws_functions.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ spec:
117117
type: object
118118
type: array
119119
functionEventInvokeConfig:
120+
description: "Configures options for asynchronous invocation on a
121+
function. \n - DestinationConfig A destination for events after
122+
they have been sent to a function for processing. \n Types of Destinations:
123+
Function - The Amazon Resource Name (ARN) of a Lambda function.
124+
Queue - The ARN of a standard SQS queue. Topic - The ARN of a standard
125+
SNS topic. Event Bus - The ARN of an Amazon EventBridge event bus.
126+
\n - MaximumEventAgeInSeconds The maximum age of a request that
127+
Lambda sends to a function for processing. \n - MaximumRetryAttempts
128+
The maximum number of times to retry when the function returns an
129+
error."
120130
properties:
121131
destinationConfig:
122132
description: A configuration object that specifies the destination

0 commit comments

Comments
 (0)