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

Enable Secret Store retries #442

Merged

Conversation

ADustyOldMuffin
Copy link
Contributor

closes #387

This adds the field retrySettings to the SecretStore spec. This also implements the settings for the IBM provider.

I put it in the secret store spec because I didn't see any specific reason why this couldn't be used elsewhere.

Copy link
Contributor

@paul-the-alien paul-the-alien bot left a comment

Choose a reason for hiding this comment

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

Greetings!
Thank you for contributing to this project!
If this is your first time contributing, please make
sure to read the Developer and Contributing Process guides.
Please also mind and follow our Code of Conduct.

@ADustyOldMuffin
Copy link
Contributor Author

If it's alright, I'd like to also implement this for other providers as I think this would be a good to have in general.

@knelasevero
Copy link
Member

I agree that makes sense to be SecretStore field. We just have to be sure to document the providers that would not support this, if we have any.

Also, can you add docs for this one?

@ADustyOldMuffin
Copy link
Contributor Author

Sure thing! I can also implement the logic in each of the providers. Since the underlying connection is HTTP I'm not sure it would be up to the providers to actually "support" it.

@knelasevero
Copy link
Member

Yeah, you are right. I was just thinking that for IBM we have a EnableRetries method already for that. But, yeah, it is trivial to have the logic implemented for the other ones.

For gcp I think they use grpc, and that's why we had to implement the Close method, but I guess it would not be that different.

@ADustyOldMuffin
Copy link
Contributor Author

I can take a look when I get off for the day and see how many I can get, and document the ones I can.

@knelasevero
Copy link
Member

We can do it one PR at a time. With docs for this one we can already merge.

@knelasevero
Copy link
Member

/ok-to-test

I also made sure to notate that it's only in IBM for now
@sonarcloud
Copy link

sonarcloud bot commented Oct 23, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ADustyOldMuffin
Copy link
Contributor Author

👋 Sorry for the delay, added an example in the full-secret-store.yaml let me know if I need to add it anywhere else. I also noted Supported Providers: IBM which we can add to as more are setup.

@gusfcarvalho
Copy link
Member

Hey @ADustyOldMuffin, nice PR! I've seen that no unit tests were added to cover the behavior. Can you do it? 🌟

@ADustyOldMuffin
Copy link
Contributor Author

I can do my best!

@ADustyOldMuffin
Copy link
Contributor Author

@gusfcarvalho So upon further looking, I'm not sure where the tests would go and what we would actually test. Since the functionality is in the IBM http client, not here. @knelasevero Any more feedback or anything you need from me?

@knelasevero
Copy link
Member

knelasevero commented Oct 26, 2021

Yeah, I am not sure how to write tests for retires. For retries to kick in we need the external api to not be reachable for a while and then be back or something like that. Not even in our e2e tests this would be trivial to implement right now, since we are only declaring the testcase structs with no custom behavior.

From my side, this is approved. Gonna leave a /approve here and wait a bit to merge.

@gusfcarvalho please raise any concerns if you have any :)

@knelasevero
Copy link
Member

/approve

@gusfcarvalho
Copy link
Member

I was thinking more of a logic test for invalid inputs. I think we have already a 'weird' behavior if someone types a non-numerical string for the RetryInterval, where the IBMClient would actually exit with error (and I think it could continue without enabling the retry services). So, some unit tests + error handling can be useful =)

@ADustyOldMuffin
Copy link
Contributor Author

ADustyOldMuffin commented Oct 27, 2021

The try interval is not supposed to be numerical its a time duration. And the int on MaxRetries should be enough. I'm also still not sure I understand what there is to unit test.

@knelasevero
Copy link
Member

You can write a test that checks if you pass something that doesn't parse well by ParseDuration you will get the expected error. And then a happy ending test with everything working not returning an error. I think @gusfcarvalho means that you can write unit tests to cover those conditionals in tests

@ADustyOldMuffin
Copy link
Contributor Author

Ah okay, I think I understand now. I'll see what I can get put together.

@knelasevero
Copy link
Member

Hey, @ADustyOldMuffin do you plan on working on this?

@ADustyOldMuffin
Copy link
Contributor Author

I do plan on it, but between school, work, and moving I haven't had much time to write some tests for it.

@knelasevero
Copy link
Member

Ok! No worries, just checking :)

@knelasevero
Copy link
Member

/ok-to-test sha=ce7fb16

@knelasevero
Copy link
Member

@ADustyOldMuffin do you want us to take over the tests? I may have some time soon

@ADustyOldMuffin
Copy link
Contributor Author

ADustyOldMuffin commented Dec 13, 2021

If you can get to it before myself then sure. I'm hoping to look at it today or tomorrow since I have some docs to update as well. I apologize been a hectic end of the year.

@ADustyOldMuffin
Copy link
Contributor Author

ADustyOldMuffin commented Dec 13, 2021

Alright @knelasevero, let me know if that test is what we're looking for. It requires quite a bit of setup and maybe shows some general gaps in test coverage.

@sonarcloud
Copy link

sonarcloud bot commented Dec 13, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@knelasevero
Copy link
Member

/approve

@knelasevero
Copy link
Member

/merge

@paul-the-alien paul-the-alien bot merged commit f8cd59c into external-secrets:main Dec 14, 2021
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.

enable retries in IBM Cloud secrets manager client
3 participants