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

Improve the process of pod updates by preferring non-mutating SCCs and reducing pod mutations #16934

Conversation

php-coder
Copy link
Contributor

@php-coder php-coder commented Oct 18, 2017

This is adaptation of kubernetes/kubernetes#52849 to SCC.

Details (mostly copy&pasted from original PR):

  • SCCs which allow the pod as-is (no defaulting/mutating) are preferred
  • During update operations, when mutations to pod specs are disallowed, only non-mutating SCCs are used to validate the pod
  • Removes unnecessary mutation of pods:
    • Determines effective security context for pods using a wrapper containing the pod and container security context, rather than building/setting a combined struct on every admission
    • Does not set privileged: &false on security contexts with privileged: nil
    • Does not set runAsNonRoot: &true on security contexts that already have a non-nil, non-0 runAsUser
    • Does not mutate/normalize container capabilities unless changes are required (missing defaultAddCapabilities or requiredDropCapabilities)

Fixes #16467

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 18, 2017
@php-coder php-coder requested a review from liggitt October 18, 2017 17:05
@openshift-merge-robot openshift-merge-robot added the vendor-update Touching vendor dir or related files label Oct 18, 2017
@php-coder php-coder force-pushed the gh16467_scc_no_defaulting_during_pod_update branch from 8941821 to 13f83ad Compare October 19, 2017 16:02
@php-coder
Copy link
Contributor Author

/assign @eparis

@php-coder php-coder changed the title [WIP] Improve process of pod updates by prefering non-mutating SCCs and reducing pod mutations Improve process of pod updates by prefering non-mutating SCCs and reducing pod mutations Oct 19, 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 Oct 19, 2017
if errs := scc.AssignSecurityContext(provider, pod, field.NewPath(fmt.Sprintf("provider %s: ", provider.GetSCCName()))); len(errs) > 0 {
clone, err := kapi.Scheme.DeepCopy(pod)
if err != nil {
return admission.NewForbidden(a, err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liggitt This is the equivalent for pod.DeepCopy(). I hope that it's ok to return Forbidden when we can't clone a pod.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, that's fine. definitely a "should never happen" type of error

// ensure anything we expected to be defaulted on the container level is set
if *containers[0].SecurityContext.RunAsUser != v.expectedUID {
t.Errorf("%s expected UID %d but found %d", k, v.expectedUID, *containers[0].SecurityContext.RunAsUser)
podSC := securitycontext.NewPodSecurityContextAccessor(v.pod.Spec.SecurityContext)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liggitt I decided to use accessors here but I suspect there should be a better option for updating this test. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it needs to look like the upstream tests... expectedPodSecurityContext and expectedContainerSecurityContext, and do literal comparisons

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've filled a separate PR for this change: #17296

@@ -15,6 +15,7 @@ import (
v1kapi "k8s.io/kubernetes/pkg/api/v1"
Copy link
Contributor Author

@php-coder php-coder Oct 19, 2017

Choose a reason for hiding this comment

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

@liggitt Shall I backport the tests for admission from your PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

it probably won't be an exact copy (since we prefer more restrictive rather than non-mutating), but we do need the tests to start looking at exact matches of PodSecurityContext and SecurityContext, and to check for non-mutation on update

@php-coder
Copy link
Contributor Author

PTAL @openshift/sig-security

@php-coder php-coder changed the title Improve process of pod updates by prefering non-mutating SCCs and reducing pod mutations Improve the process of pod updates by preferring non-mutating SCCs and reducing pod mutations Oct 20, 2017
@@ -141,16 +141,17 @@ func TestAdmitCaps(t *testing.T) {
for i := 0; i < 2; i++ {
for k, v := range tc {
v.pod.Spec.Containers, v.pod.Spec.InitContainers = v.pod.Spec.InitContainers, v.pod.Spec.Containers

testSCCAdmit(k, v.sccs, v.pod, v.shouldPass, t)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because testSCCAdmit() modifies containers, I had to move it above, so when we're assigning containers to a local variable we get the updated value.

As far I understand, prior this change the admissions plugin was modifying a members of the passed argument and now it completely replacing an argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, that's fine... shouldn't start saving pointers to internal bits of the admitted object until after it is admitted

allowingProvider = provider
break loop
case specMutationAllowed && allowedPod == nil:
// if mutation is allowed and this is the first SCC to allow the pod, remember it,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The approach that @liggitt has used for Kubernetes differs from the our current. For example, I created a simple pod under system:admin and a pod was admitted by the privileged SCC (because it accepts a pod without mutation). But the current version of OpenShift would admit my pod by the anyuid SCC (because it less permissive).

@liggitt @pweil- What is the desired behavior for this case? Preserve backward compatibility, be compatible with Kubernetes, or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@openshift/sig-security PTAL

What is the desired behavior for this case? Preserve backward compatibility, be compatible with Kubernetes, or something else?

@liggitt @pweil- Do you have opinion on that?

Copy link

Choose a reason for hiding this comment

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

I think we have to preserve backwards compatibility as much as possible here while working around the mutation bug. But if it doesn't mutate the pod does it matter which SCC admitted it? I would think only a change in mutation behavior would be a problem here. (wouldn't anyuid still mutate the selinux labels where privileged would not?)

Copy link
Contributor

Choose a reason for hiding this comment

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

on create, keep our current priority order. on update (where mutation is not allowed), follow the non-mutating logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

our handling of this will look different than PSP, because of our "prefer most restrictive" behavior we have to stay compatible with.

I'd expect something along these lines:

// the entire pod validated
switch {
  case specMutationAllowed:
    // if we allow mutation, just use the first SCC that allows the pod
    allowedPod = podCopy
    allowingProvider = provider
    break loop

  case apiequality.Semantic.DeepEqual(pod, podCopy):
    // if we don't allow mutation, only use the validated pod if it didn't require any spec changes
    allowedPod = podCopy
    allowingProvider = provider
    glog.V(6).Infof("pod %s (generate: %s) validated against provider %s without mutation", pod.Name, pod.GenerateName, provider.GetSCCName()) 
    break loop

  default:
    glog.V(6).Infof("pod %s (generate: %s) validated against provider %s, but required mutation, skipping", pod.Name, pod.GenerateName, provider.GetSCCName())
}

@php-coder
Copy link
Contributor Author

Test Flake #16999

/test extended_conformance_gce

@php-coder
Copy link
Contributor Author

/test cmd

Test flake #16273

sc := securitycontext.NewEffectiveContainerSecurityContextMutator(
securitycontext.NewPodSecurityContextAccessor(pod.Spec.SecurityContext),
securitycontext.NewContainerSecurityContextMutator(container.SecurityContext),
)
annotations := maps.CopySS(pod.Annotations)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to copy this? we're copying top-level... we should be free to modify anything in the pod now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we don't need to copy, so why didn't you remove it -- kubernetes/kubernetes@8c5b013#diff-291b8dd7d08cc034975ddb3925dbb08fR245 ? Should we remove it then?

Copy link
Contributor

Choose a reason for hiding this comment

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

oversight. we can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I've submitted kubernetes/kubernetes#55504 for that.

@php-coder php-coder force-pushed the gh16467_scc_no_defaulting_during_pod_update branch from 582ef5a to 5d40689 Compare November 16, 2017 13:18
openshift-merge-robot added a commit that referenced this pull request Nov 21, 2017
Automatic merge from submit-queue (batch tested with PRs 17369, 17296).

admission_test.go(TestAdmit): compare SecurityContexts instead of particular members

This makes the test close to the upstream implementation.

Extracted from #16934 (comment)

PTAL @liggitt @pweil- @adelton @simo5
@php-coder php-coder force-pushed the gh16467_scc_no_defaulting_during_pod_update branch 3 times, most recently from e857076 to 753f7ae Compare November 27, 2017 18:08
@php-coder
Copy link
Contributor Author

@liggitt All comments were addressed. PTAL.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 18, 2017
@openshift-merge-robot openshift-merge-robot removed the vendor-update Touching vendor dir or related files label Dec 18, 2017
@php-coder
Copy link
Contributor Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 18, 2017
@php-coder php-coder force-pushed the gh16467_scc_no_defaulting_during_pod_update branch from 7ec5eba to de94214 Compare December 19, 2017 16:28
@php-coder
Copy link
Contributor Author

/hold cancel
/retest

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 19, 2017
@php-coder
Copy link
Contributor Author

All checks failed because #17884

@php-coder
Copy link
Contributor Author

/retest

@php-coder
Copy link
Contributor Author

[Feature:Builds][pruning] prune builds based on settings in the buildconfig should prune completed builds based on the successfulBuildsHistoryLimit setting [Suite:openshift/conformance/parallel] failed because of #17330
/test extended_conformance_install

executing 'oc observe services --once --all-namespaces -a "bad{ .metadata.annotations.unset }key" --strict-templates' expecting failure and text 'annotations is not found' failed because of #17811
/test cmd

@php-coder
Copy link
Contributor Author

@liggitt PTAL

@php-coder
Copy link
Contributor Author

@liggitt New Year Ping :)

@liggitt
Copy link
Contributor

liggitt commented Jan 2, 2018

/retest
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 2, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, php-coder

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 2, 2018
@php-coder
Copy link
Contributor Author

php-coder commented Jan 3, 2018

Test flake #17781
/test integration

@php-coder
Copy link
Contributor Author

Test flake #17811
/test cmd

@php-coder
Copy link
Contributor Author

#17811 again
/test cmd

@php-coder
Copy link
Contributor Author

Tests failed because of #17985
I'll re-run them later when it will be fixed.

@php-coder
Copy link
Contributor Author

/retest

@php-coder
Copy link
Contributor Author

  1. Test [Feature:Builds] build have source revision metadata started build should contain source revision information [Suite:openshift/conformance/parallel] failed with error:
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/builds/revision.go:37
Expected
    <bool>: false
to be true
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/builds/revision.go:40

that is caused by:

2018-01-05T00:40:30.903979374Z ---> Cleaning up unused ruby gems ...
2018-01-05T00:40:33.267246916Z error: Execution of post execute step failed
2018-01-05T00:40:33.392567356Z error: build error: building docker.io/extended-test-cli-build-revision-qk54g-62cpr/sample-build-1:e109d8da failed when committing the image due to error: Error response from daemon: {"message":"devmapper: Error mounting '/dev/mapper/docker-202:2-79751976-145a7382414c7702c973e1dc53b7031e464dd5b5e1b0c97c637ee217a51b9b3a' on '/var/lib/docker/devicemapper/mnt/145a7382414c7702c973e1dc53b7031e464dd5b5e1b0c97c637ee217a51b9b3a': invalid argument"}

that is a test flake #17330

  1. Test [Feature:DeploymentConfig] deploymentconfigs with revision history limits [Conformance] should never persist more old deployments than acceptable after being observed by the controller [Suite:openshift/conformance/parallel] failed with error
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/deployments/deployments.go:62
2018-01-05 00:45:50.279614019 +0000 UTC m=+1566.878894511: Deployer pod invariant broken! More than one unterminated deployer pod exists for DC extended-test-cli-deployment-rxdwx-gz4fk/history-limit!
		List of unterminated pods: ([]*v1.Pod)[<*>(0xc420b4c000)&Pod{ObjectMeta:k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta{Name:history-limit-9-deploy,GenerateName:,Namespace:extended-test-cli-deployment-rxdwx-gz4fk,SelfLink:/api/v1/namespaces/extended-test-cli-deployment-rxdwx-gz4fk/pods/history-limit-9-deploy,UID:c6aadd22-f1b1-11e7-9dc2-0ed12d8e03ce,ResourceVersion:22633,Generation:0,CreationTimestamp:2018-01-05 00:45:50 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{openshift.io/deployer-pod-for.name: history-limit-9,},Annotations:map[string]string{openshift.io/deployment-config.name: history-limit,openshift.io/deployment.name: history-limit-9,openshift.io/scc: restricted,},OwnerReferences:[{v1 ReplicationController history-limit-9 a70c41fb-f1b1-11e7-9dc2-0ed12d8e03ce <nil> <nil>}],Finalizers:[],ClusterName:,Initializers:nil,},Spec:PodSpec{Volumes:[{deployer-token-w26zj {nil nil nil nil nil SecretVolumeSource{SecretName:deployer-token-w26zj,Items:[],DefaultMode:*420,Optional:nil,} nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil}}],Containers:[{deployment openshift/origin-deployer:589f389 [] []  [] [] [{KUBERNETES_MASTER https://ip-172-18-7-18.ec2.internal:8443 nil} {OPENSHIFT_MASTER https://ip-172-18-7-18.ec2.internal:8443 nil} {BEARER_TOKEN_FILE /var/run/secrets/kubernetes.io/serviceaccount/token nil} {OPENSHIFT_CA_DATA -----BEGIN CERTIFICATE-----
MIIC6jCCAdKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtvcGVu
c2hpZnQtc2lnbmVyQDE1MTUxMTEwMTgwHhcNMTgwMTA1MDAxMDE3WhcNMjMwMTA0
MDAxMDE4WjAmMSQwIgYDVQQDDBtvcGVuc2hpZnQtc2lnbmVyQDE1MTUxMTEwMTgw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs1cgO70ndfxZW5outZHwN
IiFqgwMCamf0z6EJ8dwxIew4DavJQqfKMdMQhd1th3FKPfKWVjSp/r8c5o8Xu4Mt
oOhD7CGLtfJzPvkjQXMxW17cR/aYcfxuDnmv9cxprBZjzLHsyKmwSr6hwXIBUfwH
mqv6/cPvcOUr+5WE+JNNPH5s7RMe14im69i8sPtsm1luLcqVwJrGZKOXnK5XKVnk
7fxuDCrYaEr/Fuccb+mo1wGFIUhfRGXCDztcaMLMcFxDXP74DTIDgo+xS98mOffV
fVSUl6c6oI37jp++syJ4FGp1BXnYzI0jwDfC1MJ6b3f5qjFT7uQMy1XD/qmc8FWJ
AgMBAAGjIzAhMA4GA1UdDwEB/wQEAwICpDAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
SIb3DQEBCwUAA4IBAQAS1ljhV4lXeDyargRLRcp4Nf8cgYeIyO2AWdrMBWhhNlmz
1iVxyRYmO5AOn77jH3pvAG3DrywRWtl5XdlRBGRbESkUS6F9l5hVW9TdqaoByCSW
/Fs5SzAdB4omxBX+GSHf32zx9u7fsyGnzww+ZWosYUWMSDwOmj3eKPc/oK7+siMW
bWOva9+J29t+f3qitW42VxE0+KpCrvWtegbLh0GCD/3GU04BgrBypdz+t6PcN8YL
to/+xi2HFr/10MNQb/KQrYahgEn1mSRhZnuAt4U4Y8IW58h7FhurpMNGrmbgYAwV
Ogfgac7F/+drEI8CB5vQPWAlZaBYbvBLDuKJMp/K
-----END CERTIFICATE-----
 nil} {OPENSHIFT_DEPLOYMENT_NAME history-limit-9 nil} {OPENSHIFT_DEPLOYMENT_NAMESPACE extended-test-cli-deployment-rxdwx-gz4fk nil}] {map[] map[]} [{deployer-token-w26zj true /var/run/secrets/kubernetes.io/serviceaccount  <nil>}] [] nil nil nil /dev/termination-log File IfNotPresent SecurityContext{Capabilities:&Capabilities{Add:[],Drop:[KILL MKNOD SETGID SETUID],},Privileged:nil,SELinuxOptions:nil,RunAsUser:*1001780000,RunAsNonRoot:nil,ReadOnlyRootFilesystem:nil,AllowPrivilegeEscalation:nil,} false false false}],RestartPolicy:Never,TerminationGracePeriodSeconds:*10,ActiveDeadlineSeconds:*21600,DNSPolicy:ClusterFirst,NodeSelector:map[string]string{region: infra,},ServiceAccountName:deployer,DeprecatedServiceAccount:deployer,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:&PodSecurityContext{SELinuxOptions:&SELinuxOptions{User:,Role:,Type:,Level:s0:c42,c29,},RunAsUser:nil,RunAsNonRoot:nil,SupplementalGroups:[],FSGroup:*1001780000,},ImagePullSecrets:[{deployer-dockercfg-hw25k}],Hostname:,Subdomain:,Affinity:nil,SchedulerName:default-scheduler,InitContainers:[],AutomountServiceAccountToken:nil,Tolerations:[],HostAliases:[],PriorityClassName:,Priority:nil,DNSConfig:nil,},Status:PodStatus{Phase:Pending,Conditions:[],Message:,Reason:,HostIP:,PodIP:,StartTime:<nil>,ContainerStatuses:[],QOSClass:BestEffort,InitContainerStatuses:[],},} <*>(0xc42034d880)&Pod{ObjectMeta:k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta{Name:history-limit-10-deploy,GenerateName:,Namespace:extended-test-cli-deployment-rxdwx-gz4fk,SelfLink:/api/v1/namespaces/extended-test-cli-deployment-rxdwx-gz4fk/pods/history-limit-10-deploy,UID:c6ab01c3-f1b1-11e7-9dc2-0ed12d8e03ce,ResourceVersion:22634,Generation:0,CreationTimestamp:2018-01-05 00:45:50 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{openshift.io/deployer-pod-for.name: history-limit-10,},Annotations:map[string]string{openshift.io/deployment-config.name: history-limit,openshift.io/deployment.name: history-limit-10,openshift.io/scc: restricted,},OwnerReferences:[{v1 ReplicationController history-limit-10 b1419961-f1b1-11e7-9dc2-0ed12d8e03ce <nil> <nil>}],Finalizers:[],ClusterName:,Initializers:nil,},Spec:PodSpec{Volumes:[{deployer-token-w26zj {nil nil nil nil nil SecretVolumeSource{SecretName:deployer-token-w26zj,Items:[],DefaultMode:*420,Optional:nil,} nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil}}],Containers:[{deployment openshift/origin-deployer:589f389 [] []  [] [] [{KUBERNETES_MASTER https://ip-172-18-7-18.ec2.internal:8443 nil} {OPENSHIFT_MASTER https://ip-172-18-7-18.ec2.internal:8443 nil} {BEARER_TOKEN_FILE /var/run/secrets/kubernetes.io/serviceaccount/token nil} {OPENSHIFT_CA_DATA -----BEGIN CERTIFICATE-----
MIIC6jCCAdKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtvcGVu
c2hpZnQtc2lnbmVyQDE1MTUxMTEwMTgwHhcNMTgwMTA1MDAxMDE3WhcNMjMwMTA0
MDAxMDE4WjAmMSQwIgYDVQQDDBtvcGVuc2hpZnQtc2lnbmVyQDE1MTUxMTEwMTgw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs1cgO70ndfxZW5outZHwN
IiFqgwMCamf0z6EJ8dwxIew4DavJQqfKMdMQhd1th3FKPfKWVjSp/r8c5o8Xu4Mt
oOhD7CGLtfJzPvkjQXMxW17cR/aYcfxuDnmv9cxprBZjzLHsyKmwSr6hwXIBUfwH
mqv6/cPvcOUr+5WE+JNNPH5s7RMe14im69i8sPtsm1luLcqVwJrGZKOXnK5XKVnk
7fxuDCrYaEr/Fuccb+mo1wGFIUhfRGXCDztcaMLMcFxDXP74DTIDgo+xS98mOffV
fVSUl6c6oI37jp++syJ4FGp1BXnYzI0jwDfC1MJ6b3f5qjFT7uQMy1XD/qmc8FWJ
AgMBAAGjIzAhMA4GA1UdDwEB/wQEAwICpDAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
SIb3DQEBCwUAA4IBAQAS1ljhV4lXeDyargRLRcp4Nf8cgYeIyO2AWdrMBWhhNlmz
1iVxyRYmO5AOn77jH3pvAG3DrywRWtl5XdlRBGRbESkUS6F9l5hVW9TdqaoByCSW
/Fs5SzAdB4omxBX+GSHf32zx9u7fsyGnzww+ZWosYUWMSDwOmj3eKPc/oK7+siMW
bWOva9+J29t+f3qitW42VxE0+KpCrvWtegbLh0GCD/3GU04BgrBypdz+t6PcN8YL
to/+xi2HFr/10MNQb/KQrYahgEn1mSRhZnuAt4U4Y8IW58h7FhurpMNGrmbgYAwV
Ogfgac7F/+drEI8CB5vQPWAlZaBYbvBLDuKJMp/K
-----END CERTIFICATE-----
 nil} {OPENSHIFT_DEPLOYMENT_NAME history-limit-10 nil} {OPENSHIFT_DEPLOYMENT_NAMESPACE extended-test-cli-deployment-rxdwx-gz4fk nil}] {map[] map[]} [{deployer-token-w26zj true /var/run/secrets/kubernetes.io/serviceaccount  <nil>}] [] nil nil nil /dev/termination-log File IfNotPresent SecurityContext{Capabilities:&Capabilities{Add:[],Drop:[KILL MKNOD SETGID SETUID],},Privileged:nil,SELinuxOptions:nil,RunAsUser:*1001780000,RunAsNonRoot:nil,ReadOnlyRootFilesystem:nil,AllowPrivilegeEscalation:nil,} false false false}],RestartPolicy:Never,TerminationGracePeriodSeconds:*10,ActiveDeadlineSeconds:*21600,DNSPolicy:ClusterFirst,NodeSelector:map[string]string{region: infra,},ServiceAccountName:deployer,DeprecatedServiceAccount:deployer,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:&PodSecurityContext{SELinuxOptions:&SELinuxOptions{User:,Role:,Type:,Level:s0:c42,c29,},RunAsUser:nil,RunAsNonRoot:nil,SupplementalGroups:[],FSGroup:*1001780000,},ImagePullSecrets:[{deployer-dockercfg-hw25k}],Hostname:,Subdomain:,Affinity:nil,SchedulerName:default-scheduler,InitContainers:[],AutomountServiceAccountToken:nil,Tolerations:[],HostAliases:[],PriorityClassName:,Priority:nil,DNSConfig:nil,},Status:PodStatus{Phase:Pending,Conditions:[],Message:,Reason:,HostIP:,PodIP:,StartTime:<nil>,ContainerStatuses:[],QOSClass:BestEffort,InitContainerStatuses:[],},}]
	
Expected
    <int>: 2
to be <=
    <int>: 1
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/deployments/util.go:695

that is test flake #17581

/test extended_conformance_install

@php-coder
Copy link
Contributor Author

Test [Fail] [Feature:Prometheus][Feature:Builds] Prometheus when installed to the cluster [It] should start and expose a secured proxy and verify build metrics [Suite:openshift/conformance/parallel] failed because of test flake #17330

/test extended_conformance_install

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17856, 16934, 17979, 17993, 18001).

openshift-merge-robot added a commit that referenced this pull request Jan 5, 2018
…ring_pod_update

Automatic merge from submit-queue (batch tested with PRs 17856, 16934, 17979, 17993, 18001).

Improve the process of pod updates by preferring non-mutating SCCs and reducing pod mutations

This is adaptation of kubernetes/kubernetes#52849 to SCC.

Details (mostly copy&pasted from original PR):
- SCCs which allow the pod as-is (no defaulting/mutating) are preferred
- During update operations, when mutations to pod specs are disallowed, only non-mutating SCCs are used to validate the pod
- Removes unnecessary mutation of pods:
  - Determines effective security context for pods using a wrapper containing the pod and container security context, rather than building/setting a combined struct on every admission
  - Does not set `privileged: &false` on security contexts with `privileged: nil`
  - Does not set `runAsNonRoot: &true` on security contexts that already have a non-nil, non-0 runAsUser
  - Does not mutate/normalize container capabilities unless changes are required (missing `defaultAddCapabilities` or `requiredDropCapabilities`)

Fixes #16467
@openshift-merge-robot openshift-merge-robot merged commit 239f50b into openshift:master Jan 5, 2018
@php-coder php-coder deleted the gh16467_scc_no_defaulting_during_pod_update branch January 6, 2018 00:13
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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants