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

Compute diffID for mapped-layer at creating image source #2801

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

hshiina
Copy link
Contributor

@hshiina hshiina commented Nov 17, 2020

Signed-off-by: Hironori Shiina [email protected]

What type of PR is this?

/kind bug

What this PR does / why we need it:

If UID and GID mappings are specified, the container has a
mapped-layer, whose diffID is not computed when created.
Committing the image fails due to lack of diffID. This fix
computes diffID at creating an image source if a layer
doesn't have a diffID (UncompressedDigest).

This fix also tests if a container with UID and GID mappings
can be committed.

How to verify it

This PR adds a test to verify if a container with UID and GID
mappings can be committed to idmapping in namespaces.bats.

Which issue(s) this PR fixes:

Fixes #2800

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

If UID and GID mappings are specified, the container has a
mapped-layer, whose diffID is not computed when created.
Committing the image fails due to lack of diffID. This fix
computes diffID at creating an image source if a layer
doesn't have a diffID (UncompressedDigest).

This fix also tests if a container with UID and GID mappings
can be committed.

Signed-off-by: Hironori Shiina <[email protected]>
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 17, 2020
@rhatdan
Copy link
Member

rhatdan commented Nov 17, 2020

/approve
LGTM
@nalind @TomSweeneyRedHat @vrothberg PTAL

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hshiina, rhatdan

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Want a final head nod from @nalind and/or @TomSweeneyRedHat

if layer.UncompressedDigest == "" {
return nil, errors.Errorf("unable to look up size of layer %q", layerID)
}
if !i.exporting && !i.squash && layerID != i.layerID && layer.UncompressedDigest != "" {
Copy link
Member

Choose a reason for hiding this comment

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

I'm going back and forth. I'm just wondering if we should keep the if statement still, but replace the return with a debug. I'm leaning towards no, but not fully @nalind thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Well right now, we don't set this information on the mapped layer in the storage library, and this forces us to reconstruct the layer in such a way that its diffID might be different than that of the layer that it was based off of. We either do that, or we try to redirect ourselves to the corresponding not-mapped layer, and I don't think the storage library gives us quite enough information to do that.

@nalind
Copy link
Member

nalind commented Nov 17, 2020

LGTM

@rhatdan
Copy link
Member

rhatdan commented Nov 17, 2020

/lgtm

@rhatdan
Copy link
Member

rhatdan commented Nov 17, 2020

Thanks @hshiina

@openshift-merge-robot openshift-merge-robot merged commit d31c5fb into containers:master Nov 17, 2020
@hshiina hshiina deleted the idmapping branch December 23, 2020 15:42
@TomSweeneyRedHat
Copy link
Member

Just noting that this also fixes a BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1758999

@nalind nalind added todo-backport-to-1.16 We should do or consider a backport to 1.16. Remove when we either decide not to, or open a PR. todo-backport-to-1.17 We should do or consider a backport to 1.17. Remove when we either decide not to, or open a PR. todo-backport-to-1.18 We should do or consider a backport to 1.18. Remove when we either decide not to, or open a PR. labels Jan 13, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved kind/bug Categorizes issue or PR as related to a bug. lgtm locked - please file new issue/PR todo-backport-to-1.16 We should do or consider a backport to 1.16. Remove when we either decide not to, or open a PR. todo-backport-to-1.17 We should do or consider a backport to 1.17. Remove when we either decide not to, or open a PR. todo-backport-to-1.18 We should do or consider a backport to 1.18. Remove when we either decide not to, or open a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to commit a container with UID and GID mappings
7 participants