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

Use temporary oauth2 tokens for Google registries #93

Merged
merged 19 commits into from
Mar 31, 2022

Conversation

DennisD2
Copy link
Contributor

@DennisD2 DennisD2 commented Mar 22, 2022

Pull Request Description

Describe what this PR does / why we need it

For Google registries (*.gcr.io), an OAUTH2 token can be created from a (base64 encoded) service account token.
Define credentials like this:

username: _oauth2_
password: <base64 encoded permanent service account token>

Does this pull request fix one issue?

Fixes #62

Describe how you did it

Added method for getting the temporary OAUTH2 token from the permanent service account token

Describe how to verify it

Define a google repo (with gcr.io in hostname), with credentials including a permanent service account token as password value, use the string _oauth2_ as username, and use this as image sync target. The sync will work, and use an on-the-fly created OAUTH2 token

Special notes for reviews

@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2022

Codecov Report

Merging #93 (501b042) into master (8a981fe) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #93   +/-   ##
=======================================
  Coverage   53.96%   53.96%           
=======================================
  Files           1        1           
  Lines          63       63           
=======================================
  Hits           34       34           
  Misses         24       24           
  Partials        5        5           
Flag Coverage Δ
unittests 53.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bcc8b5...501b042. Read the comment docs.

.gitignore Outdated Show resolved Hide resolved
pkg/sync/destination.go Outdated Show resolved Hide resolved
@DennisD2 DennisD2 requested a review from hhyasdf March 22, 2022 10:39
pkg/sync/destination.go Outdated Show resolved Hide resolved
pkg/sync/destination.go Outdated Show resolved Hide resolved
pkg/sync/destination.go Outdated Show resolved Hide resolved
@DennisD2 DennisD2 requested a review from hhyasdf March 23, 2022 07:02
@hhyasdf
Copy link
Collaborator

hhyasdf commented Mar 24, 2022

@DennisD2 thanks, we are almost done here! Could you please fix the golangci-lint error?

@DennisD2
Copy link
Contributor Author

Sorry was some days off. Will check the lint issue now.

@DennisD2
Copy link
Contributor Author

All green now :-)

@hhyasdf hhyasdf merged commit 2dc8b55 into AliyunContainerService:master Mar 31, 2022
@hhyasdf
Copy link
Collaborator

hhyasdf commented Mar 31, 2022

Thanks for your contribution!

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.

How could we authenticate with a service account key with image-syncer?
3 participants