-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add dockerregistry/server.App struct for application-level data #15796
Conversation
/unassign @bparees |
pkg/dockerregistry/server/app.go
Outdated
registryClient RegistryClient | ||
extraConfig *registryconfig.Configuration | ||
|
||
// dockerStorageDriver gives access to the blob store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outdated name
pkg/dockerregistry/server/app.go
Outdated
// cases it is hidden from us. | ||
driver storagedriver.StorageDriver | ||
|
||
// dockerRegistry represents a collection of repositories, addressable by name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before
) | ||
|
||
const ( | ||
AuthOpenShift = "openshift" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
godoc
@@ -0,0 +1,88 @@ | |||
package server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name it register.go
or middlewareinit.go
or just init.go
?
Can we also rename repositorymiddleware
to repository
?
return nil, fmt.Errorf("failed to find an application instance in the context of the registry middleware") | ||
} | ||
|
||
log.Info("OpenShift registry middleware initializing") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we ditch the product name? E.g. replace the OpenShift
with downstream
or origin
or just lowercased openshift
to refer to a config section name instead of product.
@@ -222,6 +196,7 @@ func newRepositoryWithClient( | |||
Repository: repo, | |||
|
|||
ctx: ctx, | |||
app: app, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why making it part of this struct if it is already contained in the context. Accessing the whole app from inside of middleware shouldn't be that easy.
👍 otherwise. I like it. |
/unassign |
/retest |
flake #16248 |
@miminar I rebased this PR, PTAL again. |
/test extended_image_registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's getting close..
pkg/dockerregistry/server/app.go
Outdated
return nil, fmt.Errorf("configuration error: the storage driver middleware %q is not activated", middlewareOpenShift) | ||
} | ||
|
||
if app.registry == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these asserts be moved into NewApp()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, it checks that the middlewares are initialised in the proper order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
pkg/dockerregistry/server/app.go
Outdated
return nil, err | ||
} | ||
|
||
return app.newRepositoryWithClient(ctx, registryOSClient, repo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need second method that just accepts client obtained by the first, which could be obtained by the second as well?
|
||
// Registry extensions endpoint provides extra functionality to handle the image | ||
// signatures. | ||
RegisterSignatureHandler(dockerApp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit/joke: I need to remember to register next special handler using locally defined closure or something more creative.
741eed1
to
6cd605e
Compare
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dmage, legionus, miminar The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
@dmage: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest |
Automatic merge from submit-queue (batch tested with PRs 15725, 16244, 15796, 16328, 16334) |
No description provided.