-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Security context - types, kubelet, admission #7343
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
4784de1
to
63b8e2b
Compare
Suggest:
@bgrant0607 check above statements if you have time. |
10-4 - on it |
@erictune's proposal is correct. See container resources for an example where we used this approach. |
Conversion happens before admission control, and conversion sets corresponding values in SecurityContext if pod.privileged or pod.capabilities is set. SecurityContextDeny disallows pods with any values set in SecurityContext. So, are all pods with pod.privileged or pod.capabilities denied? I think that is okay, but just wanted to clarify my understanding. |
// both the Container AND the SecurityContext will result in an error. | ||
type SecurityContext struct { | ||
// Capabilities are the capabilities to add/drop when running the container | ||
// DUPLICATE OF CONTAINER 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.
replace DUPLICATE OF CONTAINER FIELD
with Must match Container.Privileged or be unset.
Almost there... |
63b8e2b
to
c183492
Compare
whew - git reflog saved me. @erictune the suggestion to move the check to the conversion really cleaned this up. The defaulting happens in the default.go of each v1beta* now. If an SC is already set then it won't be changed. The conversion errors if the container fields don't match the SC fields that exist. Otherwise a normal conversion occurs. Validation is left to do normal validation-y checks. Descriptions have been added to all fields in the feedback commit. @yifan-gu, @jonboulle - I removed the direct references to the docker options in the comments for everything except disabled. Perhaps disabled doesn't even need to be there, if you aren't specifying labels then maybe we just take no action. If you have thoughts on how to express this better please let me know. Thanks for the feedback so far. |
bec3167
to
52da39e
Compare
As it stand right now, yes, it would. It creates a conflict I didn't think of, the internal api is now completely based on SecurityContext but anything with SecurityContext is denied. I'll fix that first thing tomorrow. I'll allow a SecurityContext if it only has Privileged and Caps set. Good catch. |
52da39e
to
5cf28c8
Compare
69e69bc
to
fa20bae
Compare
This LGTM but needs to be squashed. Until #7779 goes in, we'll have to do the swagger changes as a separate PR. |
5527d3c
to
8c4c4f6
Compare
Okay, even with #7779 merged, there is still an upstream go-restful bug that makes the validation tests break after the swagger spec is regenerated. We need that fixed before we can regen the swagger spec after this. |
8c4c4f6
to
4ea84c3
Compare
Actually, I think I was wrong. I ran the script locally and it produced the correct output. |
4ea84c3
to
5e5b904
Compare
LGTM. I will merge on green. |
@@ -7623,7 +7627,8 @@ | |||
"description": "restart policy for all containers within the pod; one of RestartPolicyAlways, RestartPolicyOnFailure, RestartPolicyNever" | |||
}, | |||
"terminationGracePeriodSeconds": { | |||
"$ref": "int64", | |||
"type": "integer", |
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.
@bgrant0607 I'm not sure why this wasn't changed in #7779, but it looks like the pointers are being handled correctly now.
Security context - types, kubelet, admission
Merged |
This was reverted, and was the cause of #7805. See there for more context. |
For the record, the revert was itself reverted. |
It was verted.
|
This PR is a subset of the original code in #6287 and covers the following for SecurityContexts:
@erictune, some items I'd like to call out
I need to do some more testing on the functionality to make sure I carried it all over correctly but I wanted to get this under review while I did.
@erictune @smarterclayton @pmorie @liggitt @derekwaynecarr PTAL
History: #6287