Skip to content

Commit 3a5a373

Browse files
authored
Fix flowlog crash (#157)
Issue #, if available: [#1931](aws-controllers-k8s/community#1931) Description of changes: While creating FlowLog, if logDestnation does not exist then CreateFlowLogsWithContext does not return the error. However, Unsuccessful field in the response is set. FlowLog is not created in aws. Due to this, controller crashes while accessing the flow log id from the response (resp.FlowLogIds[0]). Fixing the issue by checking if FlowLogIds has valid length before accessing it. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 0bb6c0e commit 3a5a373

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ack_generate_info:
2-
build_date: "2024-09-17T19:14:20Z"
2+
build_date: "2024-09-20T17:31:34Z"
33
build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc
44
go_version: go1.22.6
55
version: v0.38.1

pkg/resource/flow_log/sdk.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
if resp.FlowLogIds[0] != nil {
1+
if len(resp.FlowLogIds) > 0 && resp.FlowLogIds[0] != nil {
22
ko.Status.FlowLogID = resp.FlowLogIds[0]
33
}

0 commit comments

Comments
 (0)