Skip to content

feat: Add support for loggingConfig field in Function #170

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

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2025-05-02T16:32:03Z"
build_date: "2025-05-09T17:37:50Z"
build_hash: f8dc5330705b3752ce07dce0ac831161fd4cb14f
go_version: go1.24.2
go_version: go1.24.1
version: v0.45.0
api_directory_checksum: b37edb8bba9d3847d4bdf1e842b7a597821c8c37
api_directory_checksum: e0465b8e0cf7076ab51e30604f13a32cdf4957ae
api_version: v1alpha1
aws_sdk_go_version: v1.32.6
generator_config_info:
file_checksum: 5d39bbf411d4c83ce03ff295703199b5c5a215ac
file_checksum: cf02b1eaffba7c5446d3fbfed24ba7496ae1cf4e
original_file_name: generator.yaml
last_modification:
reason: API generation
2 changes: 2 additions & 0 deletions apis/v1alpha1/function.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ ignore:
- CreateEventSourceMappingOutput.MetricsConfig
- CreateEventSourceMappingOutput.ProvisionedPollerConfig
- FunctionCode.SourceKMSKeyArn
- CreateFunctionInput.LoggingConfig
# - CreateFunctionInput.LoggingConfig
- CreateFunctionOutput.RuntimeVersionConfig
- CreateFunctionOutput.LoggingConfig
# - CreateFunctionOutput.LoggingConfig
- CreateFunctionUrlConfigInput.InvokeMode
- CreateFunctionUrlConfigOutput.InvokeMode
- PublishVersionOutput.LoggingConfig
Expand Down
5 changes: 5 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/crd/bases/lambda.services.k8s.aws_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ spec:
items:
type: string
type: array
loggingConfig:
description: The function's Amazon CloudWatch Logs configuration settings.
properties:
applicationLogLevel:
type: string
logFormat:
type: string
logGroup:
type: string
systemLogLevel:
type: string
type: object
memorySize:
description: |-
The amount of memory available to the function (https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console)
Expand Down
4 changes: 2 additions & 2 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ ignore:
- CreateEventSourceMappingOutput.MetricsConfig
- CreateEventSourceMappingOutput.ProvisionedPollerConfig
- FunctionCode.SourceKMSKeyArn
- CreateFunctionInput.LoggingConfig
# - CreateFunctionInput.LoggingConfig
- CreateFunctionOutput.RuntimeVersionConfig
- CreateFunctionOutput.LoggingConfig
# - CreateFunctionOutput.LoggingConfig
- CreateFunctionUrlConfigInput.InvokeMode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: were these ignored as part of Gov2 earlier?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goV2..

- CreateFunctionUrlConfigOutput.InvokeMode
- PublishVersionOutput.LoggingConfig
Expand Down
12 changes: 12 additions & 0 deletions helm/crds/lambda.services.k8s.aws_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ spec:
items:
type: string
type: array
loggingConfig:
description: The function's Amazon CloudWatch Logs configuration settings.
properties:
applicationLogLevel:
type: string
logFormat:
type: string
logGroup:
type: string
systemLogLevel:
type: string
type: object
memorySize:
description: |-
The amount of memory available to the function (https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console)
Expand Down
32 changes: 32 additions & 0 deletions pkg/resource/function/delta.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions pkg/resource/function/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,25 @@ func (rm *resourceManager) updateFunctionConfiguration(
}
}

if delta.DifferentAt("Spec.LoggingConfig") {
if dspec.LoggingConfig != nil {
logConfig := &svcsdktypes.LoggingConfig{}
if dspec.LoggingConfig.ApplicationLogLevel != nil {
logConfig.ApplicationLogLevel = svcsdktypes.ApplicationLogLevel(*dspec.LoggingConfig.ApplicationLogLevel)
}
if dspec.LoggingConfig.LogFormat != nil {
logConfig.LogFormat = svcsdktypes.LogFormat(*dspec.LoggingConfig.LogFormat)
}
if dspec.LoggingConfig.LogGroup != nil {
logConfig.LogGroup = dspec.LoggingConfig.LogGroup
}
if dspec.LoggingConfig.SystemLogLevel != nil {
logConfig.SystemLogLevel = svcsdktypes.SystemLogLevel(*dspec.LoggingConfig.SystemLogLevel)
}
input.LoggingConfig = logConfig
}
}

if delta.DifferentAt("Spec.MemorySize") {
if dspec.MemorySize != nil {
input.MemorySize = aws.Int32(int32(*dspec.MemorySize))
Expand Down
92 changes: 72 additions & 20 deletions pkg/resource/function/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.