-
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
Parallelize image mirroring and reuse mounted layers #19017
Conversation
b9fbba2
to
1a15970
Compare
@bparees pretty raw but getting close. I'm working through some quay bugs / inconsistencies right now. |
pkg/oc/cli/cmd/registry/info/info.go
Outdated
Example: fmt.Sprintf(loginExample, name+" login"), | ||
Run: func(c *cobra.Command, args []string) { | ||
o.Out = out | ||
o.ErrOut = errOut |
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.
Move these up:
o := &Options{Out: out, ErrOut: errOut}
pkg/oc/cli/cmd/registry/info/info.go
Outdated
if err != nil { | ||
return err | ||
} | ||
o.Namespaces = []string{ns, "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.
Shouldn't that be configurable with openshift
being the default?
pkg/oc/cli/cmd/registry/info/info.go
Outdated
o.Out = out | ||
o.ErrOut = errOut | ||
kcmdutil.CheckErr(o.Complete(f, args)) | ||
kcmdutil.CheckErr(o.Run()) |
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.
You're missing
kcmdutil.CheckErr(o.Validate())
pkg/oc/cli/cmd/registry/info/info.go
Outdated
if o.Check { | ||
ctx := apirequest.NewContext() | ||
if !public && !o.ShowInternal { | ||
fmt.Fprintf(o.ErrOut, "info: Registry does not have a public hostname registered\n") |
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.
s/info/warning
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 not a warning, you can run this inside a cluster successfully.
`) | ||
) | ||
|
||
type Credentials struct { |
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.
Wouldn't it be better to use k8s.io/kubernetes/pkg/credentialprovider.DockerConfigJson
instead? Although it contains only reading bits for dockerfile it's still relevant, imho.
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.
This is about holding credentials from interior code to output, but not actually serializing the data. We direct modify JSON to avoid dropping fields.
Example: fmt.Sprintf(loginExample, name+" login"), | ||
Run: func(c *cobra.Command, args []string) { | ||
o.Out = out | ||
o.ErrOut = errOut |
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.
Run: func(c *cobra.Command, args []string) { | ||
o.Out = out | ||
o.ErrOut = errOut | ||
kcmdutil.CheckErr(o.Complete(f, args)) |
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.
Again missing Validate
call.
test/cmd/image.sh
Outdated
|
||
os::test::junit::declare_suite_start "cmd/registry/info" | ||
os::cmd::expect_success "oc registry info" | ||
os::cmd::expect_failure_and_text "oc registry info --internal --public" "only one of --internal or --public" |
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.
I'd expect a bit more tests, to be honest ;)
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.
These are all in a different PR, but registry info is difficult to test with our existing framework because it requires master reconfig
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.
Comment on #18930
Allows tokens that cover the scope to be reused
/test cross |
/retest |
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.
Left you some comments.
flag.BoolVar(&o.Force, "force", o.Force, "If true, attempt to write all contents.") | ||
flag.BoolVar(&o.Force, "force", o.Force, "Attempt to write all layers and manifests even if they exist in the remote repository.") | ||
flag.IntVar(&o.MaxRegistry, "max-registry", 4, "Number of concurrent registries to connect to at any one time.") | ||
flag.IntVar(&o.MaxPerRegistry, "max-per-registry", 6, "Number of concurrent requests allowed per 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.
req-per-registry
? The current naming is confusing with max-registry
imo.
} | ||
|
||
func (o *pushOptions) Repository(ctx apirequest.Context, context *registryclient.Context, creds auth.CredentialStore, t DestinationType, ref imageapi.DockerImageReference) (distribution.Repository, error) { | ||
func (o *pushOptions) Repository(ctx apirequest.Context, context *registryclient.Context, t DestinationType, ref imageapi.DockerImageReference) (distribution.Repository, error) { |
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.
This looks like a helper function can you make it private?
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 on a private type, which means it's not visible outside the package.
tabw := tabwriter.NewWriter(o.ErrOut, 0, 0, 1, ' ', 0) | ||
for i := range work.phases { | ||
phase := &work.phases[i] | ||
fmt.Fprintf(o.ErrOut, "phase %d:\n", i) |
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.
Debug? If so please use glog
.
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.
No, deliberate output for a human that is exceptional (not the key output)
tabw.Flush() | ||
} | ||
fmt.Fprintln(o.ErrOut) | ||
fmt.Fprintf(o.ErrOut, "info: Planning completed in %s\n", time.Now().Sub(start).Round(10*time.Millisecond)) |
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 you're using ErrOut
for majority of the outputs?
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.
Because these are informational, not structured output intended for the tool.
To offer the best possible bulk upload story, we should look for mount opportunities when we evaluate our mirror targets and send them in order. Also use paralellization and add dry run support.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Linear execution of large mirrors doesn't make sense. Create an execution plan that can be run in parallel and also supports dry run.