add v1 tests to hack/test-go; let default value of Container.SecurityContext to be nil

This commit is contained in:
Chao Xu
2015-06-01 21:51:26 -07:00
parent 9740c7c3ad
commit d52cef11a4
11 changed files with 165 additions and 5 deletions

View File

@@ -171,6 +171,9 @@ func defaultHostNetworkPorts(containers *[]Container) {
// defaultSecurityContext performs the downward and upward merges of a pod definition
func defaultSecurityContext(container *Container) {
if container.SecurityContext == nil {
if (len(container.Capabilities.Add) == 0) && (len(container.Capabilities.Drop) == 0) && (container.Privileged == false) {
return
}
glog.V(5).Infof("creating security context for container %s", container.Name)
container.SecurityContext = &SecurityContext{}
}