Skip to content

Commit 0f2cb82

Browse files
authored
feat: Add support for loggingConfig field in Function (#170)
Issue [#2122](aws-controllers-k8s/community#2122) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ba500e2 commit 0f2cb82

File tree

10 files changed

+162
-28
lines changed

10 files changed

+162
-28
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-05-02T16:32:03Z"
2+
build_date: "2025-05-09T17:37:50Z"
33
build_hash: f8dc5330705b3752ce07dce0ac831161fd4cb14f
4-
go_version: go1.24.2
4+
go_version: go1.24.1
55
version: v0.45.0
6-
api_directory_checksum: b37edb8bba9d3847d4bdf1e842b7a597821c8c37
6+
api_directory_checksum: e0465b8e0cf7076ab51e30604f13a32cdf4957ae
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: 5d39bbf411d4c83ce03ff295703199b5c5a215ac
10+
file_checksum: cf02b1eaffba7c5446d3fbfed24ba7496ae1cf4e
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/function.go

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

apis/v1alpha1/generator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ ignore:
1919
- CreateEventSourceMappingOutput.MetricsConfig
2020
- CreateEventSourceMappingOutput.ProvisionedPollerConfig
2121
- FunctionCode.SourceKMSKeyArn
22-
- CreateFunctionInput.LoggingConfig
22+
# - CreateFunctionInput.LoggingConfig
2323
- CreateFunctionOutput.RuntimeVersionConfig
24-
- CreateFunctionOutput.LoggingConfig
24+
# - CreateFunctionOutput.LoggingConfig
2525
- CreateFunctionUrlConfigInput.InvokeMode
2626
- CreateFunctionUrlConfigOutput.InvokeMode
2727
- PublishVersionOutput.LoggingConfig

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_functions.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,18 @@ spec:
253253
items:
254254
type: string
255255
type: array
256+
loggingConfig:
257+
description: The function's Amazon CloudWatch Logs configuration settings.
258+
properties:
259+
applicationLogLevel:
260+
type: string
261+
logFormat:
262+
type: string
263+
logGroup:
264+
type: string
265+
systemLogLevel:
266+
type: string
267+
type: object
256268
memorySize:
257269
description: |-
258270
The amount of memory available to the function (https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console)

generator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ ignore:
1919
- CreateEventSourceMappingOutput.MetricsConfig
2020
- CreateEventSourceMappingOutput.ProvisionedPollerConfig
2121
- FunctionCode.SourceKMSKeyArn
22-
- CreateFunctionInput.LoggingConfig
22+
# - CreateFunctionInput.LoggingConfig
2323
- CreateFunctionOutput.RuntimeVersionConfig
24-
- CreateFunctionOutput.LoggingConfig
24+
# - CreateFunctionOutput.LoggingConfig
2525
- CreateFunctionUrlConfigInput.InvokeMode
2626
- CreateFunctionUrlConfigOutput.InvokeMode
2727
- PublishVersionOutput.LoggingConfig

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,18 @@ spec:
253253
items:
254254
type: string
255255
type: array
256+
loggingConfig:
257+
description: The function's Amazon CloudWatch Logs configuration settings.
258+
properties:
259+
applicationLogLevel:
260+
type: string
261+
logFormat:
262+
type: string
263+
logGroup:
264+
type: string
265+
systemLogLevel:
266+
type: string
267+
type: object
256268
memorySize:
257269
description: |-
258270
The amount of memory available to the function (https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console)

pkg/resource/function/delta.go

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

pkg/resource/function/hooks.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,25 @@ func (rm *resourceManager) updateFunctionConfiguration(
252252
}
253253
}
254254

255+
if delta.DifferentAt("Spec.LoggingConfig") {
256+
if dspec.LoggingConfig != nil {
257+
logConfig := &svcsdktypes.LoggingConfig{}
258+
if dspec.LoggingConfig.ApplicationLogLevel != nil {
259+
logConfig.ApplicationLogLevel = svcsdktypes.ApplicationLogLevel(*dspec.LoggingConfig.ApplicationLogLevel)
260+
}
261+
if dspec.LoggingConfig.LogFormat != nil {
262+
logConfig.LogFormat = svcsdktypes.LogFormat(*dspec.LoggingConfig.LogFormat)
263+
}
264+
if dspec.LoggingConfig.LogGroup != nil {
265+
logConfig.LogGroup = dspec.LoggingConfig.LogGroup
266+
}
267+
if dspec.LoggingConfig.SystemLogLevel != nil {
268+
logConfig.SystemLogLevel = svcsdktypes.SystemLogLevel(*dspec.LoggingConfig.SystemLogLevel)
269+
}
270+
input.LoggingConfig = logConfig
271+
}
272+
}
273+
255274
if delta.DifferentAt("Spec.MemorySize") {
256275
if dspec.MemorySize != nil {
257276
input.MemorySize = aws.Int32(int32(*dspec.MemorySize))

pkg/resource/function/sdk.go

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

0 commit comments

Comments
 (0)