-
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
Bug 1420976 - Support passing reference-policy in import-image command #13339
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 |
@@ -52,6 +52,7 @@ func NewCmdImportImage(fullName string, f *clientcmd.Factory, out, errout io.Wri | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be constants, i.e. Local
and Source
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.
They are in pkg/cmd/cli/cmd/tag.go:79.
pkg/image/api/v1/types.go
Outdated
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooops... my bad. Fixing right away.
Comments addressed. |
pkg/cmd/cli/cmd/importimage.go
Outdated
@@ -118,6 +123,10 @@ func (o *ImportImageOptions) Validate(cmd *cobra.Command) error { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open an issue about adding support for this in the future
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that's not a problem. Will update.
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.
Thanks!
pkg/cmd/cli/cmd/importimage.go
Outdated
@@ -440,16 +463,13 @@ func (o *ImportImageOptions) newImageStream() (*imageapi.ImageStream, *imageapi. | |||
Kind: "DockerImage", | |||
Name: from, | |||
}, | |||
ReferencePolicy: imageapi.TagReferencePolicy{ |
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 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
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.
sgtm
pkg/cmd/cli/cmd/importimage.go
Outdated
@@ -498,6 +525,9 @@ func (o *ImportImageOptions) newImageStreamImportTags(stream *imageapi.ImageStre | |||
}, | |||
To: &kapi.LocalObjectReference{Name: tag}, | |||
ImportPolicy: imageapi.TagImportPolicy{Insecure: insecure}, | |||
ReferencePolicy: imageapi.TagReferencePolicy{ |
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 comment as above
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.
k
@@ -338,6 +339,28 @@ func TestCreateImageImport(t *testing.T) { | |||
ImportPolicy: imageapi.TagImportPolicy{Insecure: false}, | |||
}}, | |||
}, | |||
"import tag setting referencePolicy": { |
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.
maybe add test with invalid reference policy? (optional ;)
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.
sure
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.
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. |
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
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 <[email protected]> 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