From 16673d56be966f2dc906cc9cada7c6e609a416e2 Mon Sep 17 00:00:00 2001 From: "Domene Esteban, Nil {DISB~SANT CUGAT DIA}" Date: Mon, 9 Oct 2023 16:53:14 +0200 Subject: [PATCH] Fix: Bug related with the creation of doubled resources on Kinesis When you have a different external-name compared to name and a bug occurres and generates 2 different streams one with the original name and other with the external name, also solves the problem related with the stream status. Signed-off-by: Domene Esteban, Nil Signed-off-by: Domene Esteban, Nil {DISB~SANT CUGAT DIA} --- pkg/controller/kinesis/stream/setup.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/controller/kinesis/stream/setup.go b/pkg/controller/kinesis/stream/setup.go index a649084acd..080883f3bd 100644 --- a/pkg/controller/kinesis/stream/setup.go +++ b/pkg/controller/kinesis/stream/setup.go @@ -124,7 +124,7 @@ func postCreate(_ context.Context, cr *svcapitypes.Stream, obj *svcsdk.CreateStr if err != nil { return managed.ExternalCreation{}, err } - meta.SetExternalName(cr, cr.Name) + meta.SetExternalName(cr, *awsclients.String(meta.GetExternalName(cr))) return managed.ExternalCreation{ExternalNameAssigned: true}, nil } @@ -189,7 +189,7 @@ func (u *updater) update(ctx context.Context, mg resource.Managed) (managed.Exte // we need information from stream for decisions obj, err := u.client.DescribeStreamWithContext(ctx, &svcsdk.DescribeStreamInput{ - StreamName: &cr.Name, + StreamName: awsclients.String(meta.GetExternalName(cr)), }) if err != nil { return managed.ExternalUpdate{}, awsclients.Wrap(err, errCreate) @@ -376,7 +376,7 @@ func (u *updater) ActiveShards(cr *svcapitypes.Stream) (int64, error) { var count int64 shards, err := u.client.ListShards(&svcsdk.ListShardsInput{ - StreamName: &cr.Name, + StreamName: awsclients.String(meta.GetExternalName(cr)), }) if err != nil { return count, err @@ -395,7 +395,7 @@ func (u *updater) ActiveShards(cr *svcapitypes.Stream) (int64, error) { func (u *updater) ListTags(cr *svcapitypes.Stream) (*svcsdk.ListTagsForStreamOutput, error) { tags, err := u.client.ListTagsForStream(&svcsdk.ListTagsForStreamInput{ - StreamName: &cr.Name, + StreamName: awsclients.String(meta.GetExternalName(cr)), }) if err != nil { return nil, err