community
community copied to clipboard
Critical error in FlowLog code
Describe the bug Any time a FlowLog. resource is created, the controller crashes with the following error message:
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 1860 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119 +0x1e5
panic({0x2061360?, 0xc0007ac1f8?})
/usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/aws-controllers-k8s/ec2-controller/pkg/resource/flow_log.(*resourceManager).sdkCreate(0xc001625ce0, {0x26a14a0, 0xc000ffa330}, 0xc001620120)
/github.com/aws-controllers-k8s/ec2-controller/pkg/resource/flow_log/sdk.go:251 +0x594
github.com/aws-controllers-k8s/ec2-controller/pkg/resource/flow_log.(*resourceManager).Create(0xc000ffa300?, {0x26a14a0?, 0xc000ffa330?}, {0x26a99d8?, 0xc001620120})
/github.com/aws-controllers-k8s/ec2-controller/pkg/resource/flow_log/manager.go:127 +0x4b
github.com/aws-controllers-k8s/runtime/pkg/runtime.(*resourceReconciler).createResource(0xc001124d00, {0x26a14a0, 0xc000ffa330}, {0x26a9970, 0xc001625ce0}, {0x26a99d8, 0xc001620120})
/go/pkg/mod/github.com/aws-controllers-k8s/[email protected]/pkg/runtime/reconciler.go:417 +0x33f
github.com/aws-controllers-k8s/runtime/pkg/runtime.(*resourceReconciler).Sync(0xc001124d00, {0x26a14a0, 0xc000ffa330}, {0x26a9970, 0xc001625ce0}, {0x26a99d8, 0xc001620120})
/go/pkg/mod/github.com/aws-controllers-k8s/[email protected]/pkg/runtime/reconciler.go:275 +0x645
github.com/aws-controllers-k8s/runtime/pkg/runtime.(*resourceReconciler).reconcile(0xc001124d00, {0x26a14a0, 0xc000ffa330}, {0x26a9970, 0xc001625ce0}, {0x26a99d8, 0xc001620120})
/go/pkg/mod/github.com/aws-controllers-k8s/[email protected]/pkg/runtime/reconciler.go:215 +0x1cd
github.com/aws-controllers-k8s/runtime/pkg/runtime.(*resourceReconciler).Reconcile(0xc001124d00, {0x26a14a0, 0xc000a20db0}, {{{0xc000594210?, 0x0?}, {0xc000594200?, 0x4105a5?}}})
/go/pkg/mod/github.com/aws-controllers-k8s/[email protected]/pkg/runtime/reconciler.go:186 +0x75b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x26a14a0?, {0x26a14a0?, 0xc000a20db0?}, {{{0xc000594210?, 0x1ca8ee0?}, {0xc000594200?, 0x0?}}})
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:122 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0011f8820, {0x26a14d8, 0xc000910280}, {0x1f297c0?, 0xc0000a2440?})
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:323 +0x345
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0011f8820, {0x26a14d8, 0xc000910280})
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:274 +0x1c9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:235 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 1216
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:231 +0x565
I can propose a change in the ec2-controller repository pointing out the problem
Steps to reproduce Create a FlowLog with basic spec
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: FlowLog
metadata:
name: flowlog-test
namespace: test
spec:
logDestination: "arn:aws:s3:::vpc-flowlogs-test"
logDestinationType: s3
resourceID: vpc-03b59daf7264a79c7
resourceType: VPC
trafficType: ALL
Expected outcome A FlowLog created successfully
Environment Openshift 4.13.12
- Kubernetes version 1.26
- Using EKS (yes/no), if so version? No
- AWS service targeted (S3, RDS, etc.) E2