reduce merge logging

This commit is contained in:
Paul Weil 2015-05-27 19:12:04 -04:00
parent 0bea034edb
commit ae981b73a3
3 changed files with 3 additions and 18 deletions

View File

@ -208,12 +208,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
// defaultSecurityContext performs the downward and upward merges of a pod definition // defaultSecurityContext performs the downward and upward merges of a pod definition
func defaultSecurityContext(container *Container) { func defaultSecurityContext(container *Container) {
if container.SecurityContext == nil { if container.SecurityContext == nil {
glog.V(4).Infof("creating security context for container %s", container.Name) glog.V(5).Infof("creating security context for container %s", container.Name)
container.SecurityContext = &SecurityContext{} container.SecurityContext = &SecurityContext{}
} }
// if there are no capabilities defined on the SecurityContext then copy the container settings // if there are no capabilities defined on the SecurityContext then copy the container settings
if container.SecurityContext.Capabilities == nil { if container.SecurityContext.Capabilities == nil {
glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
container.SecurityContext.Capabilities = &container.Capabilities container.SecurityContext.Capabilities = &container.Capabilities
} else { } else {
// if there are capabilities defined on the security context and the container setting is // if there are capabilities defined on the security context and the container setting is
@ -222,17 +221,14 @@ func defaultSecurityContext(container *Container) {
// there are settings in both then don't touch it, the converter will error if they don't // there are settings in both then don't touch it, the converter will error if they don't
// match // match
if len(container.Capabilities.Add) == 0 { if len(container.Capabilities.Add) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
container.Capabilities.Add = container.SecurityContext.Capabilities.Add container.Capabilities.Add = container.SecurityContext.Capabilities.Add
} }
if len(container.Capabilities.Drop) == 0 { if len(container.Capabilities.Drop) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
} }
} }
// if there are no privileged settings on the security context then copy the container settings // if there are no privileged settings on the security context then copy the container settings
if container.SecurityContext.Privileged == nil { if container.SecurityContext.Privileged == nil {
glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
container.SecurityContext.Privileged = &container.Privileged container.SecurityContext.Privileged = &container.Privileged
} else { } else {
// we don't have a good way to know if container.Privileged was set or just defaulted to false // we don't have a good way to know if container.Privileged was set or just defaulted to false
@ -240,7 +236,6 @@ func defaultSecurityContext(container *Container) {
// container is set to false and assume that the Privileged field was left off the container // container is set to false and assume that the Privileged field was left off the container
// definition and not an intentional mismatch // definition and not an intentional mismatch
if *container.SecurityContext.Privileged && !container.Privileged { if *container.SecurityContext.Privileged && !container.Privileged {
glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
container.Privileged = *container.SecurityContext.Privileged container.Privileged = *container.SecurityContext.Privileged
} }
} }

View File

@ -209,12 +209,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
// defaultSecurityContext performs the downward and upward merges of a pod definition // defaultSecurityContext performs the downward and upward merges of a pod definition
func defaultSecurityContext(container *Container) { func defaultSecurityContext(container *Container) {
if container.SecurityContext == nil { if container.SecurityContext == nil {
glog.V(4).Infof("creating security context for container %s", container.Name) glog.V(5).Infof("creating security context for container %s", container.Name)
container.SecurityContext = &SecurityContext{} container.SecurityContext = &SecurityContext{}
} }
// if there are no capabilities defined on the SecurityContext then copy the container settings // if there are no capabilities defined on the SecurityContext then copy the container settings
if container.SecurityContext.Capabilities == nil { if container.SecurityContext.Capabilities == nil {
glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
container.SecurityContext.Capabilities = &container.Capabilities container.SecurityContext.Capabilities = &container.Capabilities
} else { } else {
// if there are capabilities defined on the security context and the container setting is // if there are capabilities defined on the security context and the container setting is
@ -223,17 +222,14 @@ func defaultSecurityContext(container *Container) {
// there are settings in both then don't touch it, the converter will error if they don't // there are settings in both then don't touch it, the converter will error if they don't
// match // match
if len(container.Capabilities.Add) == 0 { if len(container.Capabilities.Add) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
container.Capabilities.Add = container.SecurityContext.Capabilities.Add container.Capabilities.Add = container.SecurityContext.Capabilities.Add
} }
if len(container.Capabilities.Drop) == 0 { if len(container.Capabilities.Drop) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
} }
} }
// if there are no privileged settings on the security context then copy the container settings // if there are no privileged settings on the security context then copy the container settings
if container.SecurityContext.Privileged == nil { if container.SecurityContext.Privileged == nil {
glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
container.SecurityContext.Privileged = &container.Privileged container.SecurityContext.Privileged = &container.Privileged
} else { } else {
// we don't have a good way to know if container.Privileged was set or just defaulted to false // we don't have a good way to know if container.Privileged was set or just defaulted to false
@ -241,7 +237,6 @@ func defaultSecurityContext(container *Container) {
// container is set to false and assume that the Privileged field was left off the container // container is set to false and assume that the Privileged field was left off the container
// definition and not an intentional mismatch // definition and not an intentional mismatch
if *container.SecurityContext.Privileged && !container.Privileged { if *container.SecurityContext.Privileged && !container.Privileged {
glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
container.Privileged = *container.SecurityContext.Privileged container.Privileged = *container.SecurityContext.Privileged
} }
} }

View File

@ -171,12 +171,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
// defaultSecurityContext performs the downward and upward merges of a pod definition // defaultSecurityContext performs the downward and upward merges of a pod definition
func defaultSecurityContext(container *Container) { func defaultSecurityContext(container *Container) {
if container.SecurityContext == nil { if container.SecurityContext == nil {
glog.V(4).Infof("creating security context for container %s", container.Name) glog.V(5).Infof("creating security context for container %s", container.Name)
container.SecurityContext = &SecurityContext{} container.SecurityContext = &SecurityContext{}
} }
// if there are no capabilities defined on the SecurityContext then copy the container settings // if there are no capabilities defined on the SecurityContext then copy the container settings
if container.SecurityContext.Capabilities == nil { if container.SecurityContext.Capabilities == nil {
glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
container.SecurityContext.Capabilities = &container.Capabilities container.SecurityContext.Capabilities = &container.Capabilities
} else { } else {
// if there are capabilities defined on the security context and the container setting is // if there are capabilities defined on the security context and the container setting is
@ -185,17 +184,14 @@ func defaultSecurityContext(container *Container) {
// there are settings in both then don't touch it, the converter will error if they don't // there are settings in both then don't touch it, the converter will error if they don't
// match // match
if len(container.Capabilities.Add) == 0 { if len(container.Capabilities.Add) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
container.Capabilities.Add = container.SecurityContext.Capabilities.Add container.Capabilities.Add = container.SecurityContext.Capabilities.Add
} }
if len(container.Capabilities.Drop) == 0 { if len(container.Capabilities.Drop) == 0 {
glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
} }
} }
// if there are no privileged settings on the security context then copy the container settings // if there are no privileged settings on the security context then copy the container settings
if container.SecurityContext.Privileged == nil { if container.SecurityContext.Privileged == nil {
glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
container.SecurityContext.Privileged = &container.Privileged container.SecurityContext.Privileged = &container.Privileged
} else { } else {
// we don't have a good way to know if container.Privileged was set or just defaulted to false // we don't have a good way to know if container.Privileged was set or just defaulted to false
@ -203,7 +199,6 @@ func defaultSecurityContext(container *Container) {
// container is set to false and assume that the Privileged field was left off the container // container is set to false and assume that the Privileged field was left off the container
// definition and not an intentional mismatch // definition and not an intentional mismatch
if *container.SecurityContext.Privileged && !container.Privileged { if *container.SecurityContext.Privileged && !container.Privileged {
glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
container.Privileged = *container.SecurityContext.Privileged container.Privileged = *container.SecurityContext.Privileged
} }
} }