Skip to content

Commit

Permalink
Fix: Bug related with the creation of doubled resources on Kinesis
Browse files Browse the repository at this point in the history
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
<[email protected]>
Signed-off-by: Domene Esteban, Nil {DISB~SANT CUGAT DIA} <[email protected]>
  • Loading branch information
nilde committed Oct 10, 2023
1 parent 5833eb9 commit 16673d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/kinesis/stream/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 16673d5

Please sign in to comment.