Repository navigation
chore(oci): migrate to ORAS Golang library v2 - #13382
Conversation
3d9ac74 to
2efec5c
Compare
|
Two of the commits are |
Hmm, since I cant do a PR on Zoran's repo, I'll probably have to merge main instead of rebase. |
Fixed |
|
Hi. Any update in merging this pr? |
There was a problem hiding this comment.
I have managed to get to a partial review. I would like to finish full review next few days.
The sticking point for this PR is still going to be the breaking change. ie. this comment: #13382 (comment)
We might just be better targeting Helm v4 and moving forward?
| func (suite *InsecureTLSRegistryClientTestSuite) Test_4_Logout() { | ||
| err := suite.RegistryClient.Logout("this-host-aint-real:5000") | ||
| suite.NotNil(err, "error logging out of registry that has no entry") | ||
| if err != nil { |
There was a problem hiding this comment.
This is redundant / suite.NotNil(err) will validate that err is not nil?
There was a problem hiding this comment.
Alright, I was confused too, but the comment is actually correct.
On the mac the docker credential backend produces and error for credential not found, but it is silently ignored by other credential providers.
| func (suite *TLSRegistryClientTestSuite) Test_4_Logout() { | ||
| err := suite.RegistryClient.Logout("this-host-aint-real:5000") | ||
| suite.NotNil(err, "error logging out of registry that has no entry") | ||
| if err != nil { |
There was a problem hiding this comment.
On the mac the docker credential backend produces and error for credential not found, but it is silently ignored by other credential providers. I don't think v1 oras-go supported using the native key store, so this change needs to happen. I'm not sure of a more graceful way to handle this.
| registry.LoginOptBasicAuth(username, password), | ||
| registry.LoginOptInsecure(a.insecure), | ||
| registry.LoginOptTLSClientConfig(a.certFile, a.keyFile, a.caFile)) | ||
| registry.LoginOptTLSClientConfig(a.certFile, a.keyFile, a.caFile), |
There was a problem hiding this comment.
Will LoginOptPlainText work with LoginOptTLSClientConfig and LoginOptInsecure?
There was a problem hiding this comment.
I don't see anything in the underlying code that would validate those options. It looks like to me that if you specified plainHTTP, it is going to ignore any TLS options which makes sense.
I don't think there is any mutually exclusive check on insecure/TLS as well.
If PlainHTTP is an issue, I'd almost sooner remove the flag from this PR and throw it in another PR. It is a new feature in this PR.
| } | ||
| func ClientOptResolver(_ remotes.Resolver) ClientOption { | ||
| return func(c *Client) { | ||
| c.err = errDeprecatedRemote |
There was a problem hiding this comment.
I honestly think, converting the previous build time breakage to a runtime error (in the name of maintaining API compatibility) is a much worse idea.
That said, aside from deferring this PR to Helm v4, I'm not sure how to solve this otherwise. The choices are API or functional breakage.
There was a problem hiding this comment.
More discussion on this from Zoran's PR https://github.com/helm/helm/pull/12310/files#r1499833508 I don't love it either, but I'm not seeing a better solution
There was a problem hiding this comment.
Bad for a few, but great for many.
There was a problem hiding this comment.
For Helm 4, we should just remove ClientOptResolver I think
For a Helm 3 backport, what would be the alternative for users? Can we document in a function doc comment?
There was a problem hiding this comment.
I create #13593 to track the removing this from v4, but figured I'd leave this here for now in case we backport this change.
5a6483c to
4f674d5
Compare
|
Upgrading here is good for Helm 4. Backport to Helm 3 I think we should (continue to) think hard about https://github.com/helm/helm/pull/13382/files#r1836977600 |
b7d77b0 to
1dff544
Compare
|
Rebased the changes from the digest PR. |
| authorizer *auth.Client | ||
| registryAuthorizer RemoteClient | ||
| credentialsStore credentials.Store | ||
| resolver func(ref registry.Reference) (remotes.Resolver, error) |
There was a problem hiding this comment.
If I'm not mistaken, this never gets assigned and will probably cause a nil pointer dereference in Client.Resolve on line 837:
Lines 827 to 844 in 6505d41
There was a problem hiding this comment.
@twz123 It appears to be set in NewClient() on lines 147 or 150, depending on dockerStore status.
There was a problem hiding this comment.
@scottrigby I wasn't talking about credentialsStore in line 80, but about resolver in line 81. This is not directly obvious from how GitHub displays this comment. Sorry, I should have been clearer.
Still pretty sure that resolver never gets assigned and will produce a nil pointer dereference in the aforementioned code block.
There was a problem hiding this comment.
@twz123 that makes more sense. Not needed for Helm 4, but to continue attempting a reasonable backwards compatibility for Helm 3 (re this thread #13382 (comment)), we'd need to keep resolver in the struct. For that, out of curiosity, what would you recommend?
There was a problem hiding this comment.
I removed resolver in the latest changes. It is no longer needed.
There was a problem hiding this comment.
resolver was private, so I don't think we need to keep it in the struct, but the latest changes keeps ClientOptResolver with a deprecated message.
There was a problem hiding this comment.
@TerryHowe this is all looking good IMO. Just a few things:
- needs a rebase again
- can you please verify my reply to this question #13382 (comment)
- Since the starting point from this was #12310—and you're a good community player by noting that and linking to a diff— would you mind also please adding @zregvart's co-author commit trailer to your commit message? Like this:
Co-authored-by: Zoran Regvart <[email protected]>
Signed-off-by: Terry Howe <[email protected]> Co-authored-by: Zoran Regvart <[email protected]>
|
|
One more thing with this change, If/When this gets merged to Helm 3, we should probably fallback to http with a warning message. |
|
kudos to your perseverance @TerryHowe let's see if we can find a way to get a backport PR backwards-compatible for Helm 3. This PR is very close already. |
What this PR does / why we need it:
I could not create a PR on Zoran's #12310 so this combines the two with:
Updates from oras.land/oras-go to oras.land/oras-go/v2. The main user facing change is that the --plain-http parameter is now required even when accessing OCI registries running on localhost.
Fixes #11821
Closes #12310
Special notes for your reviewer:
I'm new to this codebase and some tests needed to be adjusted to match the new dependency, please look over the test changes to see if there are any issues with those.
If applicable:
docs neededlabel should be applied if so)