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

[OCI] Cache Login credentials #776

Merged
merged 2 commits into from
Jun 18, 2024
Merged

[OCI] Cache Login credentials #776

merged 2 commits into from
Jun 18, 2024

Conversation

souleb
Copy link
Member

@souleb souleb commented May 27, 2024

This PR add caching to Login function for each Provider.

Depends on #766

@souleb souleb requested review from stefanprodan and a team as code owners May 27, 2024 13:15
@souleb souleb changed the base branch from main to enable-cachin-auth-tokens May 30, 2024 20:43
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

PS. The cache pkg branch is behind main and has old Kubernetes deps. Do you want to merge this into the cache-athn branch and rebase there?

oci/auth/aws/auth.go Outdated Show resolved Hide resolved
@souleb souleb force-pushed the enable-cachin-auth-tokens branch 11 times, most recently from fdefd65 to d838d8a Compare June 14, 2024 14:20
Base automatically changed from enable-cachin-auth-tokens to main June 14, 2024 14:36
@souleb souleb force-pushed the cache-authn branch 3 times, most recently from d43d1bb to ad0d5fa Compare June 16, 2024 20:45
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

We can test this in integration test by updating the test app and setting a cache instance in the ProviderOptions in https://github.com/fluxcd/pkg/blob/oci/v0.37.1/oci/tests/integration/testapp/main.go#L50.

oci/auth/aws/auth.go Outdated Show resolved Hide resolved
oci/auth/aws/auth.go Outdated Show resolved Hide resolved
oci/auth/azure/auth.go Outdated Show resolved Hide resolved
oci/auth/aws/auth_test.go Outdated Show resolved Hide resolved
oci/auth/login/cache.go Outdated Show resolved Hide resolved
oci/auth/login/login.go Outdated Show resolved Hide resolved
oci/auth/login/login.go Outdated Show resolved Hide resolved
oci/auth/login/login.go Outdated Show resolved Hide resolved
oci/auth/gcp/auth.go Outdated Show resolved Hide resolved
@souleb
Copy link
Member Author

souleb commented Jun 18, 2024

I have triggered the integration tests on gcp: https://github.com/fluxcd/pkg/actions/runs/9561954422

Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Thanks for adding the cache to the integration test.
Because the test app runs in the cluster in a separate pod and the test runner runs outside of the cluster, we don't have a nice way to also test the use of data in the cache. The test app can be updated to test this specific scenario to perform another login and check the obtained credential with the previous one. But I guess that's not needed as we test the same in unit tests.

oci/auth/login/cache.go Outdated Show resolved Hide resolved
oci/auth/login/cache.go Outdated Show resolved Hide resolved
oci/auth/login/cache.go Outdated Show resolved Hide resolved
oci/auth/login/login.go Outdated Show resolved Hide resolved
oci/auth/login/login.go Outdated Show resolved Hide resolved
oci/auth/login/cache.go Outdated Show resolved Hide resolved
Switch return type from *time.Time to time.Time.

Signed-off-by: Soule BA <[email protected]>
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!

@souleb souleb merged commit 328e8e9 into main Jun 18, 2024
12 checks passed
@souleb souleb deleted the cache-authn branch June 18, 2024 22:01
@darkowlzz darkowlzz mentioned this pull request Nov 7, 2024
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.

4 participants