Skip to content

deployment: carry over the securityContext from deployer to lifecycle hooks - #12733

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
mfojtik:lifecycle_security
Apr 6, 2017
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
mfojtik:lifecycle_security

Conversation

@mfojtik

@mfojtik mfojtik commented Jan 31, 2017

Copy link
Copy Markdown
Contributor

Fixes: #12103

@mfojtik

mfojtik commented Jan 31, 2017

Copy link
Copy Markdown
Contributor Author

@pweil- @Kargakis FYI

@0xmichalis

Copy link
Copy Markdown
Contributor

There was some discussion upstream related to securityContext for contaienrs being broken but I can't remember if it was an issue or from the mailing list.

@mfojtik

mfojtik commented Jan 31, 2017

Copy link
Copy Markdown
Contributor Author

@Kargakis if it was broken the deployer pod won't be working?

@0xmichalis

Copy link
Copy Markdown
Contributor

Not necessarily. Found the discussion: kubernetes/kubeadm#107

@mfojtik

mfojtik commented Feb 1, 2017

Copy link
Copy Markdown
Contributor Author

@pweil- @php-coder can you confirm the securityContext is broken for SELinux?

@Kargakis also it is possible to set securityContext for the deployer pod? If not we are just copying nil.

@pweil-

pweil- commented Feb 1, 2017

Copy link
Copy Markdown

can you confirm the securityContext is broken for SELinux?

looks like this was new to 1.12.5/1.13

Env: mergedEnv,
Resources: resources,
VolumeMounts: volumeMounts,
SecurityContext: baseContainer.SecurityContext,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is a pointer, should we be making a copy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes and should not be copied from baseContainer but from the deployment config...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pweil- fixed. finally ;)

@mfojtik
mfojtik force-pushed the lifecycle_security branch 3 times, most recently from a67f146 to a9b8931 Compare February 14, 2017 20:59
@mfojtik

mfojtik commented Feb 14, 2017

Copy link
Copy Markdown
Contributor Author

[test]

@pweil- updated, ptal


gracePeriod := int64(10)

podSecurityContext, err := kapi.Scheme.DeepCopy(rc.Spec.Template.Spec.SecurityContext)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mfojtik @Kargakis so the pod SC and the container SC can differ. The lifecycle hook targets a container to get the image. Do you think it is reasonable to use the container SC as well? Ie. set both the pod SC and container SC or just the pod SC.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pweil- if DC has RC with more than 1 container, which one will you pick for the hook pod? ;-)

@pweil- pweil- Feb 14, 2017 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you have to tell the hook pod the container name so it knows the image to use. That would be unique

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@mfojtik
mfojtik force-pushed the lifecycle_security branch 2 times, most recently from 8d9383e to 38576ca Compare February 15, 2017 09:07
@mfojtik
mfojtik force-pushed the lifecycle_security branch from 38576ca to d026451 Compare April 5, 2017 11:41
@mfojtik

mfojtik commented Apr 5, 2017

Copy link
Copy Markdown
Contributor Author

@pweil- updated, PTAL :)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to d026451

@openshift-bot

Copy link
Copy Markdown
Contributor

@php-coder

Copy link
Copy Markdown

I'd also update the comment here:

// The hook pod inherits the following from the container the hook refers to:
//
// * Environment (hook keys take precedence)
// * Working directory
// * Resources
func (e *hookExecutor) executeExecNewPod(hook *deployapi.LifecycleHook, rc *kapi.ReplicationController, suffix, label string) error {

@mfojtik

mfojtik commented Apr 6, 2017 •

Copy link
Copy Markdown
Contributor Author

good catch. (but will fix in next PR because I don't want to ruin the green test run of this ;-)

@mfojtik

mfojtik commented Apr 6, 2017

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to d026451

@openshift-bot

openshift-bot commented Apr 6, 2017 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/569/) (Base Commit: ed285a1) (Image: devenv-rhel7_6119)

@openshift-bot
openshift-bot merged commit b7a5b0f into openshift:master Apr 6, 2017
@mfojtik
mfojtik deleted the lifecycle_security branch September 5, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants