Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kinesis): fix bug related with the use of external-name #1890

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

nilde
Copy link
Contributor

@nilde nilde commented Oct 9, 2023

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 getting the correct stream status.

Signed-off-by: Domene Esteban, Nil
[email protected]

Description of your changes

Fixes #1751

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested locally using Localstack creating multiple Streams with different configurations.

@nilde nilde force-pushed the kinesis-fix-1751 branch from f786f43 to b7ecb53 Compare October 9, 2023 15:03
@nilde nilde changed the title Fix: Bug related with the creation of doubled resources on Kinesis fix(kinesis): fix bug related with the use of external-name Oct 9, 2023
@@ -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)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have no effect and just writes the value of the field into itself.

Given that in preCreate it is assumed that the external name is already set (and where it is actually needed), there is no need to set in postCreate.

I agree that using cr.Name makes no sense and is against the convention (that external name should be used). If we want to use the external name as default if external name is not set, we should use the managed.NewNameAsExternalName initializer as it is done in other places like https://github.com/crossplane-contrib/provider-aws/blob/master/pkg/controller/batch/computeenvironment/setup.go#L61.

nilde added 2 commits October 10, 2023 13:02
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]>
Signed-off-by: Domene Esteban, Nil {DISB~SANT CUGAT DIA} <[email protected]>
Copy link
Collaborator

@MisterMX MisterMX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you very much @nilde!

@MisterMX MisterMX merged commit 1abd520 into crossplane-contrib:master Oct 10, 2023
10 checks passed
@nilde nilde deleted the kinesis-fix-1751 branch January 13, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kinesis stream resource not working as expected when using 'external-name' annotation
2 participants