Bug 1420976 - Support passing reference-policy in import-image command#13339
Bug 1420976 - Support passing reference-policy in import-image command#13339openshift-bot merged 2 commits intoopenshift:masterfrom
Conversation
|
[test] |
|
@openshift/api-review for the api change, |
|
Forgot about updating completions. |
|
API change approved |
|
I've rebased and re-pushed. I can't reproduce that |
| cmd.Flags().StringVar(&opts.From, "from", "", "A Docker image repository to import images from") | ||
| cmd.Flags().BoolVar(&opts.Confirm, "confirm", false, "If true, allow the image stream import location to be set or changed") | ||
| cmd.Flags().BoolVar(&opts.All, "all", false, "If true, import all tags from the provided source on creation or if --from is specified") | ||
| cmd.Flags().StringVar(&opts.ReferencePolicy, "reference-policy", sourceReferencePolicy, "Allow to request pullthrough for external image when set to 'local'. Defaults to 'source'.") |
There was a problem hiding this comment.
These should be constants, i.e. Local and Source
pkg/image/api/v1/types.go
Outdated
| ReferencePolicy TagReferencePolicy `json:"referencePolicy,omitempty" protobuf:"bytes,4,opt,name=referencePolicy"` | ||
| // IncludeManifest determines if the manifest for each image is returned in the response | ||
| IncludeManifest bool `json:"includeManifest,omitempty" protobuf:"varint,4,opt,name=includeManifest"` | ||
| IncludeManifest bool `json:"includeManifest,omitempty" protobuf:"varint,5,opt,name=includeManifest"` |
There was a problem hiding this comment.
Yo can't do this - you just broke the protobuf serialization. Never change the tag number on a field.
There was a problem hiding this comment.
Oooops... my bad. Fixing right away.
|
Comments addressed. |
pkg/cmd/cli/cmd/importimage.go
Outdated
| return kcmdutil.UsageError(cmd, "you must specify the name of an image stream") | ||
| } | ||
|
|
||
| if len(o.ReferencePolicy) > 0 && o.All { |
There was a problem hiding this comment.
open an issue about adding support for this in the future
There was a problem hiding this comment.
How would you wanted to work? It's not a problem to support this right away. The thing is that all tags will get the same reference policy, including overwriting current ones.
There was a problem hiding this comment.
The thing is that all tags will get the same reference policy, including overwriting current ones.
@soltysh I believe that's how it's supposed to work. Can you make it happen in this PR?
There was a problem hiding this comment.
Sure, that's not a problem. Will update.
pkg/cmd/cli/cmd/importimage.go
Outdated
| Kind: "DockerImage", | ||
| Name: from, | ||
| }, | ||
| ReferencePolicy: imageapi.TagReferencePolicy{ |
There was a problem hiding this comment.
i guess this should not be set at all if the reference policy is not set...
i would check below this and generate the ReferencePolicy only if len(referencePolicy) > 0
pkg/cmd/cli/cmd/importimage.go
Outdated
| }, | ||
| To: &kapi.LocalObjectReference{Name: tag}, | ||
| ImportPolicy: imageapi.TagImportPolicy{Insecure: insecure}, | ||
| ReferencePolicy: imageapi.TagReferencePolicy{ |
| ImportPolicy: imageapi.TagImportPolicy{Insecure: false}, | ||
| }}, | ||
| }, | ||
| "import tag setting referencePolicy": { |
There was a problem hiding this comment.
maybe add test with invalid reference policy? (optional ;)
There was a problem hiding this comment.
On second thought, I don't check Validate anywhere, so I'll drop the idea ;)
|
The empty tag reference comments addressed. Rest is either under discussion or will not be fixed. |
|
@miminar comment addressed. |
|
Evaluated for origin test up to 26e9be3 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/182/) (Base Commit: f617108) |
|
[merge] |
|
Flake #13386 [merge] |
|
Looks like #11016. [merge] |
|
Evaluated for origin merge up to 26e9be3 |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/90/) (Base Commit: 41a0dbd) (Image: devenv-rhel7_6070) |
|
Some examples of 110016 are image pulls - I found that out yesterday with
the router.
We need to start doing image prepulling and simplify the number of images
we use
On Mar 15, 2017, at 2:54 AM, OpenShift Bot <notifications@github.com> wrote:
Merged #13339 <#13339>.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#13339 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pw-1KPsuuqFcQq1xLIfGLR7tlBPwks5rl4s7gaJpZM4MZHlf>
.
|
When and where? |
|
Soon and in the jobs (somehow).
…On Wed, Mar 15, 2017 at 9:31 AM, Maciej Szulik ***@***.***> wrote:
We need to start doing image prepulling and simplify the number of images
we use
When and where?
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#13339 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pzzPs5AQUUrJIDXpqBYDK9bP0Hljks5rl-gwgaJpZM4MZHlf>
.
|
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1420976
@mfojtik @miminar ptal