-
Notifications
You must be signed in to change notification settings - Fork 345
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 support for pulling and pushing all images #1061
Conversation
5301e9a
to
02fbd27
Compare
func downloadImages(plugins []string, kubeconfig Kubeconfig, e2eRegistryConfig string) error { | ||
for _, plugin := range plugins { | ||
switch plugin { | ||
case e2ePlugin: |
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 haven't updated this function as I don't know if we should maintain it: #1058
Codecov Report
@@ Coverage Diff @@
## master #1061 +/- ##
=========================================
+ Coverage 49.91% 50.7% +0.79%
=========================================
Files 78 79 +1
Lines 5634 5745 +111
=========================================
+ Hits 2812 2913 +101
- Misses 2654 2659 +5
- Partials 168 173 +5
Continue to review full report at Codecov.
|
return imageClient.DeleteImages(images, numDockerRetries) | ||
func substituteRegistry(image string, customRegistry string) string { | ||
trimmedRegistry := strings.TrimRight(customRegistry, "/") | ||
components := strings.SplitAfter(image, "/") |
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 thought I left a comment on this but it's gotten lost 😕
This is a best attempt at replacing the registry in a full image name. It's possible for the "name" component of an image name to also contain a /
and we see that in some of the E2E test images. In cases like these, this function would substitute everything up to the last /
which could include the registry and part of the image name. I don't think there's a way to identify what is the registry URL component of a FQIN. The images will still tag and push correctly, but it might be confusing for users when replacing images in their plugin definitions.
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.
Its a short function but I think this is a good function to have in a function so that we can visually ensure it handles certain cases.
02fbd27
to
27ee39d
Compare
cmd/sonobuoy/app/args.go
Outdated
@@ -348,6 +351,11 @@ func AddPluginEnvFlag(p *PluginEnvVars, flags *pflag.FlagSet) { | |||
flags.Var(p, "plugin-env", "Set env vars on plugins. Values can be given multiple times and are in the form plugin.env=value") | |||
} | |||
|
|||
// AddPluginListFlag adds the flag to keep track of which built-in plugins to use. | |||
func AddPluginListFlag(p *[]string, flags *pflag.FlagSet) { | |||
flags.StringSliceVarP(p, "plugin", "p", []string{"e2e"}, "Describe which plugin's images to interact (Valid plugins are 'e2e', 'systemd-logs').") |
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.
Should this default to both plugins now? Seems like that would be simpler UX here.
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.
Yes it looks like this is just used for the images command. If we are going to, by default, try to run both of those plugins and the images
commands can support both of them, I agree it should.
27ee39d
to
fad6f45
Compare
if err != nil { | ||
return errors.Wrap(err, "failed to get cluster version") | ||
} | ||
func listImages(plugins []string, kubeconfig Kubeconfig) 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 is another good candidate for a test function; we can add it when we expand to other plugins though. I know the systemd-logs test wouldnt be very significant and the e2e one is a bit awkward to test.
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'll have to try this out a bit more before I want to merge it; no rush. Enjoy the time off.
fad6f45
to
ea10f43
Compare
My only other idea for this is if it would be useful to have a When trying to manually confirm this all works, I can't actually check much manually without actually pushing some images. Otherwise, my only comments were (already commented but adding for clarity):
|
ea10f43
to
7a0296e
Compare
Thanks for the feedback! I've addressed your two comments. I also added a |
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 ❤️ the dry run client you added; it surpasses what I was hoping for. Good to squash/merge
This changes adds support for pulling the Sonobuoy worker image, the systemd-logs image and the Kubernetes conformance image in addition to the images required for the e2e plugin. The individual images to pull cannot be configured. Only the default version for the cluster will be pulled. The images can only be pushed to one registry which is specified with the new flags `--custom-registry`. This currently only works for the default built in plugins. A follow up change will be made to apply the same approach to any image in a plugin definition. Signed-off-by: Bridget McErlean <[email protected]>
7a0296e
to
e928173
Compare
What this PR does / why we need it:
This changes adds support for pulling the Sonobuoy worker image, the
systemd-logs image and the Kubernetes conformance image in addition to
the images required for the e2e plugin.
The individual images to pull cannot be configured. Only the default
version for the cluster will be pulled. The images can only be pushed to
one registry which is specified with the new flags
--custom-registry
.This currently only works for the default built in plugins. A follow up
change will be made to apply the same approach to any image in a plugin
definition.
Signed-off-by: Bridget McErlean [email protected]
Which issue(s) this PR fixes
Special notes for your reviewer:
I've tested the new commands for this manually. I ran the following locally:
And you can see that the images were pushed to my public registry: https://hub.docker.com/u/zubron
Release note: