Skip to content

Conversation

@nalind
Copy link
Member

@nalind nalind commented Feb 23, 2022

When we create a new user namespace so that we can get CAP_SYS_ADMIN over a mount namespace, if we're already UID 0, map the current set of ID mappings over themselves instead of trying to repeat the mapping that's been applied to the container we're in.

If we know we've been started in a namespace that doesn't have node-default mappings, log that we know.

Don't default to trying "metacopy=on" with "mount_program=fuse-overlayfs", since it knows nothing about the option and all we do is trigger a repeated warning about it not being recognized.

@nalind
Copy link
Member Author

nalind commented Feb 28, 2022

/retest

3 similar comments
@nalind
Copy link
Member Author

nalind commented Feb 28, 2022

/retest

@nalind
Copy link
Member Author

nalind commented Feb 28, 2022

/retest

@nalind
Copy link
Member Author

nalind commented Mar 1, 2022

/retest

@nalind
Copy link
Member Author

nalind commented Mar 8, 2022

/retest

@gabemontero
Copy link
Contributor

/assign @coreydaley

he has approval for builder repo now

@adambkaplan adambkaplan changed the title unprivileged: use the right mappings when we don't need to set any BUILD-433: use the right mappings when we don't need to set any Mar 9, 2022
cmd/userns.go Outdated
Comment on lines 106 to 108
isNodeDefaultMapping := func(m []specs.LinuxIDMapping) bool {
return len(m) == 1 && m[0].ContainerID == 0 && m[0].HostID == 0 && m[0].Size == 0xffffffff
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Style nit - I prefer we move this to a regular function so that we can document with a unit test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pulled it out as a separate function.

cmd/userns.go Outdated
}
uidMap += "]"
gidMap += "]"
klog.Infof("Started in kernel user namespace with UID map %s and GID map %s.", uidMap, gidMap)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something that we always want to log, log at debug level (5), or somewhere in between (2)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't personally have a preference. It's mainly there so that we can test for it, but the test can also adjust the logging level. Do you have a preference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Switched to (2) for now.

@nalind
Copy link
Member Author

nalind commented Mar 10, 2022

/retest

@nalind
Copy link
Member Author

nalind commented Mar 10, 2022

/retest-required

@nalind
Copy link
Member Author

nalind commented Mar 10, 2022

/retest

When we create a new user namespace so that we can get CAP_SYS_ADMIN
over a mount namespace, if we're already UID 0, map the current set of
ID mappings over themselves instead of trying to repeat the mapping
that's been applied to the container we're in.

If we know we've been started in a namespace that doesn't have
node-default mappings, log that we know.

Don't default to trying metacopy=on with mount_program=fuse-overlayfs,
since it knows nothing about the option and all we do is trigger a
repeated warning about it not being recognized.

Signed-off-by: Nalin Dahyabhai <[email protected]>
@nalind
Copy link
Member Author

nalind commented Mar 15, 2022

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 15, 2022

@nalind: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

@coreydaley
Copy link

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2022
@adambkaplan
Copy link
Contributor

/assign @rolfedh

For docs approval - I drafted docs in openshift/openshift-docs#44000

Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

/lgtm

@adambkaplan
Copy link
Contributor

/cc @jitendar-singh @prietyc123

For QE approval

@adambkaplan
Copy link
Contributor

/cc @RickJWagner

For PX approval

@openshift-ci openshift-ci bot requested a review from RickJWagner March 30, 2022 21:27
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 30, 2022
@prietyc123
Copy link

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Mar 31, 2022
Copy link

@RickJWagner RickJWagner left a comment

Choose a reason for hiding this comment

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

Thanks for the small touch-up for readability ('inUserNamespace' to 'inOurUserNamespace'). Posterity appreciates this.

@RickJWagner
Copy link

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Mar 31, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 31, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan, coreydaley, nalind, RickJWagner

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [adambkaplan,coreydaley]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@adambkaplan
Copy link
Contributor

/label docs-approved

This PR doesn't impact builds as is, and is not activated until openshift/openshift-controller-manager#173 merges. Furthermore, there won't be official docs for this feature because we are releasing it as Developer Preview.

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Mar 31, 2022
@openshift-merge-robot openshift-merge-robot merged commit 815f7d6 into openshift:master Mar 31, 2022
@nalind nalind deleted the unprivileged branch March 31, 2022 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants