Skip to content
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

Correct missing sizes for manifest schema 1 images #16325

Conversation

miminar
Copy link

@miminar miminar commented Sep 13, 2017

Instead of filling metadata in the image object in the registry, send the manifest and config blobs to the master and let it do the job.

Resolves #16306
Resolves: bz#1491589

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2017
@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 13, 2017
@miminar
Copy link
Author

miminar commented Sep 13, 2017

@dmage PTAL
@mfojtik FYI

@miminar
Copy link
Author

miminar commented Sep 13, 2017

The code is covered by extended_image_registry tests which will be part of a nightly job.

@miminar
Copy link
Author

miminar commented Sep 14, 2017

/retest

@@ -102,7 +102,7 @@ func (h *manifestSchema1Handler) FillImageMetadata(ctx context.Context, image *i
}
image.DockerImageMetadata.Object = meta

return nil
return encodeRawDockerImageMetadata(image, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above, imageMetadataFromManifest is called, which calls encodeRawDockerImageMetadata. Can't we merge the code above into imageMetadataFromManifest?

@0xmichalis
Copy link
Contributor

/retest

@smarterclayton
Copy link
Contributor

Add test so this doesn't regress

@miminar miminar force-pushed the encode-dockerimagemetadata-for-schema1 branch from 8c96906 to 063f110 Compare September 18, 2017 15:09
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 18, 2017
@miminar miminar changed the title Correct missing sizes for manifest schema 1 images [WIP] Correct missing sizes for manifest schema 1 images Sep 18, 2017
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 18, 2017
@miminar
Copy link
Author

miminar commented Sep 18, 2017

I moved the metadata filling into separate schema handlers since they differ a lot. I've also added few unit tests. I'll add some more coverage, especially for schema2.

@legionus, @dmage PTAL

@@ -53,56 +53,75 @@ type manifestSchema1Handler struct {
var _ ManifestHandler = &manifestSchema1Handler{}

func (h *manifestSchema1Handler) FillImageMetadata(ctx context.Context, image *imageapiv1.Image) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's our internal type, I'd like to propose to split this function into 3 parts:

Layers(ctx context.Context) (layers []imageapi.ImageLayer, annotations map[string]string, error)
Signatures(ctx context.Context) ([][]byte, error)
Metadata(ctx context.Context, layers []imageapi.ImageLayer) (imageapi.DockerImage, err error)

The output of these functions should depend only on the input manifest. And we do not need to parse manifest data in this functions, because we already have h.manifest (in this case we can remove DockerImageManifest in caller).

These functions can be reused in pkg/image/apis/image.ImageWithMetadata.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll rework.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked. I modified the declarations a bit. PTAL

@smarterclayton
Copy link
Contributor

smarterclayton commented Sep 18, 2017 via email

@miminar miminar force-pushed the encode-dockerimagemetadata-for-schema1 branch from 063f110 to 101be87 Compare September 21, 2017 14:11
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 21, 2017
@miminar miminar changed the title [WIP] Correct missing sizes for manifest schema 1 images Correct missing sizes for manifest schema 1 images Sep 21, 2017
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 21, 2017
@miminar miminar force-pushed the encode-dockerimagemetadata-for-schema1 branch from 101be87 to 9044499 Compare September 21, 2017 14:28
@miminar
Copy link
Author

miminar commented Sep 21, 2017

Added more tests.
Instead of filling metadata to the image object in the registry, the manifest and config blobs are sent to master API, which should do the job.

@@ -143,6 +148,7 @@ func (m *manifestService) Put(ctx context.Context, manifest distribution.Manifes
DockerImageReference: fmt.Sprintf("%s/%s/%s@%s", m.repo.config.registryAddr, m.repo.namespace, m.repo.name, dgst.String()),
DockerImageManifest: string(payload),
DockerImageManifestMediaType: mediaType,
DockerImageConfig: string(config),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will land in etcd, won't it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will land in etcd, won't it?

I've updated the image strategy to unset DockerImageConfig and DockerImageManifest.

@openshift-merge-robot openshift-merge-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 27, 2017
Instead of filling metadata on image object in the registry, send
manifest and config blobs to the master API and let it do the job.

Signed-off-by: Michal Minář <[email protected]>
@miminar miminar force-pushed the encode-dockerimagemetadata-for-schema1 branch from 7afd7f6 to 5ac2762 Compare September 28, 2017 12:05
@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 28, 2017

@miminar: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_image_registry 7afd7f6 link /test extended_image_registry

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.

@miminar
Copy link
Author

miminar commented Sep 28, 2017

@stevekuznetsov

When I click on detail link of ci/openshift-jenkins/extended_image_registry, I get:

Unable to load build details from gs://origin-ci-test/pr-logs/pull/16325/test_pull_request_origin_extended_image_registry/24
This may mean the job has not yet uploaded any artifacts, or that it failed to upload. Take a look at the job in Jenkins for more information.

The job link works fine though. Is this openshift/test-infra issue?

@miminar
Copy link
Author

miminar commented Sep 28, 2017

/retest

@miminar
Copy link
Author

miminar commented Sep 28, 2017

Most of the failing registry extended tests will be addressed by @legionus' PR. An others by #15807

@stevekuznetsov
Copy link
Contributor

@miminar yeah we had some issues yesterday... should be fixed from now on :)

@miminar
Copy link
Author

miminar commented Sep 29, 2017

@smarterclayton @dmage any other comments?

@smarterclayton
Copy link
Contributor

Looks fine to me but I'll let @dmage have the final say

@bparees
Copy link
Contributor

bparees commented Oct 3, 2017

@dmage can you sign off on this? looks like this is the fix for a blocking bug.

@bparees
Copy link
Contributor

bparees commented Oct 3, 2017

(it also appears to be blocking #15807, it would be great to clear this logjam)

@dmage
Copy link
Contributor

dmage commented Oct 3, 2017

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 3, 2017
@legionus
Copy link
Contributor

legionus commented Oct 3, 2017

@miminar @dmage Should we add the imageapi.ImageManifestBlobStoredAnnotation annotation in the TagService ?

https://github.com/miminar/origin/blob/5ac2762a6e0874359683a32567350917f7321b19/pkg/dockerregistry/server/tagservice.go#L170-L177

@legionus
Copy link
Contributor

legionus commented Oct 3, 2017

Should we add the imageapi.ImageManifestBlobStoredAnnotation annotation in the TagService ?

I will answer myself. No. This should not be done because the image we get from the API.

/lgtm
/approve

@miminar
Copy link
Author

miminar commented Oct 3, 2017

/assign @bparees

@bparees
Copy link
Contributor

bparees commented Oct 3, 2017

/approve

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, 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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 3, 2017
@bparees bparees added kind/bug Categorizes issue or PR as related to a bug. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 3, 2017
@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 3, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 5471922 into openshift:master Oct 3, 2017
@miminar miminar deleted the encode-dockerimagemetadata-for-schema1 branch October 10, 2017 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-approved approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. needs-api-review size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants